SPB Git

Repository Public MIT

GlassToggleExample.swift 2.7 KB 73 lines swift

1// =============================================================================2//                  SP BOUCHER | SOFTWARE & RESEARCH3//             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// Project          : SP GlassKit7// File             : Examples/Gallery/Selection/GlassToggleExample.swift8// Module           : Examples9// Repository       : https://git.spboucher.ai/sp-glasskit10// Project Website  : https://glass.spboucher.ai11// Created          : 2026-12-0212// Last Modified    : 2026-12-0213//14// Author           : Simon-Pierre Boucher15// Position         : Professor of Finance16// Institution      : Université du Québec en Outaouais (UQO)17// Organization     : SP Boucher18// Website          : https://spboucher.ai19// Git              : https://git.spboucher.ai20//21// Preferred Contact: contact@spboucher.ai22// Development      : dev@spboucher.ai23// Support          : support@spboucher.ai24// Security/Admin   : admin@spboucher.ai25//26// Copyright (c) 202627// Simon-Pierre Boucher28// All rights reserved where applicable. This file is governed by the29// applicable project license, copyright notices and relevant law.30// Existing third-party rights and notices remain unaffected.31//32// License          : MIT33//34// Do not embed credentials, private keys, access tokens,35// certificates or confidential personal information.36//37// =============================================================================38// END OF SP BOUCHER SOURCE HEADER39// =============================================================================4041import SwiftUI42import SPGlassKit4344public struct GlassToggleExample: GlassExample {45    public static let componentID = "glass-toggle"46    @State private var notifications = true47    @State private var summary = false48    @State private var analytics = false49    @State private var terms = false5051    public init() {}5253    public var body: some View {54        ScrollView {55            VStack(alignment: .leading, spacing: 20) {56                GlassToggle("Notifications", isOn: $notifications)57                GlassToggle(58                    "Weekly summary",59                    description: "A digest every Monday morning with the activity of the previous week, sent to the address of your account.",60                    systemImage: "envelope",61                    isOn: $summary62                )63                GlassToggle("Share usage statistics", description: "Managed by your organisation.", isOn: $analytics)64                    .disabled(true)65                GlassToggle("I accept the terms", appearance: .checkbox, isOn: $terms)66            }67            .padding()68        }69    }70}7172#Preview("GlassToggle") { GlassToggleExample().glassTheme(.emerald) }73
Files main
Menu

Theme