Files
Pulse/Sources/PulseUI/Views/LargeSectionHeader.swift
2022-07-26 22:03:18 -04:00

35 lines
735 B
Swift
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// The MIT License (MIT)
//
// Copyright (c) 20202022 Alexander Grebenyuk (github.com/kean).
import SwiftUI
#if os(iOS) || os(macOS)
struct LargeSectionHeader<Accessory: View>: View {
let title: String
var accessory: (() -> Accessory)?
var body: some View {
VStack(spacing: 10) {
HStack(alignment: .bottom) {
Text(title)
.bold()
.font(.title)
.padding(.top, 16)
Spacer()
accessory?()
}
Divider()
}.padding(.bottom, 8)
}
}
extension LargeSectionHeader where Accessory == EmptyView {
init(title: String) {
self.title = title
}
}
#endif