SPB Git

Repository Public MIT

example-glass-floating-button.txt 734 B 24 lines text

1import SwiftUI2import SPGlassKit34public struct GlassFloatingButtonExample: GlassExample {5    public static let componentID = "glass-floating-button"6    @State private var notes = ["Groceries", "Reading list", "Trip ideas"]7    @State private var isExtended = true89    public init() {}1011    public var body: some View {12        List {13            Toggle("Show title", isOn: $isExtended)14            ForEach(notes, id: \.self) { Text($0) }15        }16        .frame(minHeight: 280)17        .glassFloatingButton("New note", systemImage: "plus", position: .bottomTrailing, isExtended: isExtended) {18            notes.append("Note \(notes.count + 1)")19        }20    }21}2223#Preview("GlassFloatingButton") { GlassFloatingButtonExample() }24
Files main
Menu

Theme