mirror of
https://github.com/jlengrand/5GUIs-1.git
synced 2026-03-10 08:01:25 +00:00
56 lines
962 B
Swift
56 lines
962 B
Swift
//
|
|
// PropertiesView.swift
|
|
// 5GUIs
|
|
//
|
|
// Created by Helge Heß on 05.10.20.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct PropertyLine: View {
|
|
|
|
let name : String
|
|
let value : Any?
|
|
var showMissing : Bool { false }
|
|
|
|
var body: some View {
|
|
Group {
|
|
if showMissing {
|
|
HStack {
|
|
Text(name + ": ")
|
|
Spacer()
|
|
if let value = value {
|
|
Text(verbatim: String(describing: value))
|
|
}
|
|
else {
|
|
Text("-")
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
if let value = value {
|
|
HStack {
|
|
Text(name + ": ")
|
|
Spacer()
|
|
Text(verbatim: String(describing: value))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
struct PropertiesView: View {
|
|
|
|
let properties : [ ( name: String, value: Any? ) ]
|
|
|
|
var body: some View {
|
|
Group {
|
|
ForEach(properties, id: \.name) { item in
|
|
PropertyLine(name: item.name, value: item.value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|