Skip to content

Instantly share code, notes, and snippets.

@laevandus
Last active August 30, 2020 00:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laevandus/84dc55a639b67fd2e0b76859c26b3026 to your computer and use it in GitHub Desktop.
Save laevandus/84dc55a639b67fd2e0b76859c26b3026 to your computer and use it in GitHub Desktop.
enum Fruit: String, CaseIterable {
case apple, orange, pear
}
func makeFruitPicker() -> some View {
Picker("Fruits", selection: $selectedFruit) {
ForEach(Fruit.allCases, id: \.rawValue) { fruit in
Text(fruit.rawValue).tag(fruit)
}
}.pickerStyle(SegmentedPickerStyle())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment