Skip to content

Instantly share code, notes, and snippets.

@karigrooms
Created February 17, 2021 20:45
Show Gist options
  • Save karigrooms/78cc289c0bcf410f5149ccfa00ee3777 to your computer and use it in GitHub Desktop.
Save karigrooms/78cc289c0bcf410f5149ccfa00ee3777 to your computer and use it in GitHub Desktop.
SwiftUI picker example for Lessons in SwiftUI blog post
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