29 lines
647 B
Swift
29 lines
647 B
Swift
import SwiftUI
|
|
|
|
struct SettingsListToggleItem: View {
|
|
|
|
let title: String
|
|
|
|
@Binding
|
|
var value: Bool
|
|
|
|
let subtitle: String
|
|
|
|
var body: some View {
|
|
VStack(alignment: .leading) {
|
|
Toggle(title, isOn: $value)
|
|
Text(subtitle)
|
|
.font(.footnote)
|
|
.foregroundColor(.secondary)
|
|
}
|
|
.padding()
|
|
.cornerRadius(8)
|
|
}
|
|
}
|
|
|
|
struct SettingsListToggleItem_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
SettingsListToggleItem(title: "Toggle", value: .constant(true), subtitle: "Some longer text explaining what the toggle does")
|
|
}
|
|
}
|