Skip to content

Instantly share code, notes, and snippets.

@azamsharp
Last active January 14, 2021 01:47
Show Gist options
  • Save azamsharp/7412031c2aa4f94c0a4d5aa204f4d5f4 to your computer and use it in GitHub Desktop.
Save azamsharp/7412031c2aa4f94c0a4d5aa204f4d5f4 to your computer and use it in GitHub Desktop.
struct ContentView: View {
let countries = ["Pakistan", "United States", "Canada", "Iceland", "Thailand", "England", "Australia"]
var body: some View {
NavigationView {
List(countries, id: \.self) { country in
NavigationLink(
destination: DetailView(country: country),
label: {
Text(country)
})
}
.navigationTitle("Countries")
}
}
}
struct DetailView: View {
let country: String
var body: some View {
Text(country)
.font(.largeTitle)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment