SPB Git

Repository Public MIT

example-glass-toggle.txt 1.1 KB 33 lines text

1import SwiftUI2import SPGlassKit34public struct GlassToggleExample: GlassExample {5    public static let componentID = "glass-toggle"6    @State private var notifications = true7    @State private var summary = false8    @State private var analytics = false9    @State private var terms = false1011    public init() {}1213    public var body: some View {14        ScrollView {15            VStack(alignment: .leading, spacing: 20) {16                GlassToggle("Notifications", isOn: $notifications)17                GlassToggle(18                    "Weekly summary",19                    description: "A digest every Monday morning with the activity of the previous week, sent to the address of your account.",20                    systemImage: "envelope",21                    isOn: $summary22                )23                GlassToggle("Share usage statistics", description: "Managed by your organisation.", isOn: $analytics)24                    .disabled(true)25                GlassToggle("I accept the terms", appearance: .checkbox, isOn: $terms)26            }27            .padding()28        }29    }30}3132#Preview("GlassToggle") { GlassToggleExample().glassTheme(.emerald) }33
Files main
Menu

Theme