mirror of
https://github.com/yattee/yattee.git
synced 2024-12-15 23:00:32 +05:30
36 lines
734 B
Swift
36 lines
734 B
Swift
import SwiftUI
|
|
|
|
struct OptionsSectionView<Content: View>: View {
|
|
let title: String?
|
|
|
|
let rowsView: Content
|
|
let divider: Bool
|
|
|
|
init(_ title: String? = nil, divider: Bool = true, @ViewBuilder rowsView: @escaping () -> Content) {
|
|
self.title = title
|
|
self.divider = divider
|
|
self.rowsView = rowsView()
|
|
}
|
|
|
|
var body: some View {
|
|
VStack(alignment: .leading) {
|
|
if title != nil {
|
|
sectionTitle
|
|
}
|
|
|
|
rowsView
|
|
}
|
|
|
|
if divider {
|
|
Divider()
|
|
.padding(.vertical)
|
|
}
|
|
}
|
|
|
|
var sectionTitle: some View {
|
|
Text(title ?? "")
|
|
.font(.title3)
|
|
.padding(.bottom)
|
|
}
|
|
}
|