34 lines
797 B
Swift
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)
|
|
}
|
|
}
|
|
}
|
|
}
|