ChWebsiteApp/CHDataManagement/Views/Generic/GenericPropertyView.swift
2025-01-05 09:21:21 +01:00

34 lines
797 B
Swift

import SwiftUI
struct GenericPropertyView<Content>: View where Content: View {
let title: LocalizedStringKey
let footer: LocalizedStringKey?
let content: Content
public init(title: LocalizedStringKey, footer: LocalizedStringKey? = nil, @ViewBuilder content: () -> Content) {
self.title = title
self.footer = footer
self.content = content()
}
var body: some View {
VStack(alignment: .leading) {
Text(title)
.font(.headline)
if let footer {
content
Text(footer)
.foregroundStyle(.secondary)
.padding(.bottom)
} else {
content
.padding(.bottom)
}
}
}
}