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/917e1de6eb06e7e4cae6d957c00522c7 to your computer and use it in GitHub Desktop.
Save laevandus/917e1de6eb06e7e4cae6d957c00522c7 to your computer and use it in GitHub Desktop.
@State private var selectedPlanet = ""
let planets = ["Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Neptune", "Uranus"]
func makePlanetPicker() -> some View {
Picker("Planets", selection: $selectedPlanet) {
ForEach(planets, id: \.self) { planet in
Text(planet)
}.navigationBarTitle("Planets")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment