1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-15 23:00:32 +05:30
yattee/Apple TV/OptionsSectionView.swift

36 lines
734 B
Swift
Raw Normal View History

2021-07-08 04:09:18 +05:30
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)
}
}