Created
February 17, 2021 20:45
-
-
Save karigrooms/78cc289c0bcf410f5149ccfa00ee3777 to your computer and use it in GitHub Desktop.
SwiftUI picker example for Lessons in SwiftUI blog post
This file contains 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
enum ButtonType: String, CaseIterable, Identifiable { | |
case primary | |
case secondary | |
case link | |
case overlay | |
} | |
// View usage | |
Picker(selection: $selectedButtonType, label: Text("Select a button type")) { | |
ForEach(ButtonType.allCases) { buttonType in | |
Text(buttonType.rawValue.capitalized).tag(buttonType) | |
} | |
} | |
.pickerStyle(SegmentedPickerStyle()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment