Install via SPM per usual. Supports iOS 13+. MIT License.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Foundation | |
| import SwiftUI | |
| // MARK: Demo | |
| struct Example: RawRepresentable, Codable { | |
| let id: UUID | |
| } | |
| // This is functionally the same as above, but we have a neater type without creating a new protocol. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import SwiftUI | |
| import swiftui_betterpicker | |
| struct GridPickerView: View { | |
| enum Colors: CaseIterable { | |
| case red | |
| case blue | |
| case green | |
| case purple | |
| case yellow |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import SwiftUI | |
| import swiftui_betterpicker | |
| struct ListPickerView: View { | |
| enum DayOfWeek: String, CaseIterable { | |
| case monday, tuesday, wednesday, thursday, friday, saturday, sunday | |
| var title: String { rawValue.localizedCapitalized } | |
| } | |
| @State |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import SwiftUI | |
| // MARK: Demo | |
| struct ContentView: View { | |
| @State | |
| private var isActive = false | |
| @SceneStorage("OtherKey") | |
| private var isActiveStock = false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import SwiftUI | |
| struct IsToggledOnKey: EnvironmentKey { | |
| static let defaultValue: Bool = false | |
| } | |
| extension EnvironmentValues { | |
| fileprivate var _isToggledOn: Bool { | |
| get { self[IsToggledOnKey.self] } | |
| set { self[IsToggledOnKey.self] = newValue } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import SwiftUI | |
| extension Toggle where Label == SwiftUI.Label<Text, Image> { | |
| public init(_ titleKey: LocalizedStringKey, systemImage named: String, isOn: Binding<Bool>) { | |
| self.init(isOn: isOn, label: { Label(titleKey, systemImage: named) }) | |
| } | |
| public init(_ titleKey: LocalizedStringKey, image named: String, isOn: Binding<Bool>) { | |
| self.init(isOn: isOn, label: { Label(titleKey, image: named) }) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| debug server graph://127.0.0.1:51000/?token=1706701259 | |
| == UInt32, 4 bytes == | |
| (layout #:length 18 | |
| (== #:size 4 #:type UInt32)) | |
| == EnvironmentValues, 16 bytes == | |
| (layout #:length 23 | |
| (enum #:size 8 #:type Optional<Element> | |
| (case 0 | |
| (read 8))) | |
| (enum #:size 8 #:type Optional<Tracker> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| struct ContentView: View { | |
| var body: some View { | |
| List { | |
| ForEach(0..<100) { index in | |
| Text("Index: \(index)") | |
| .listRowSeparatorInsets( | |
| .init( | |
| top: 0, | |
| left: CGFloat(index) * 5, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import SwiftUI | |
| struct ContentView: View { | |
| @State | |
| private var show = false | |
| @State | |
| private var selection = 0 | |
| var body: some View { |