Skip to content

Instantly share code, notes, and snippets.

@azamsharp
Created January 24, 2021 02:30
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 azamsharp/49c482d196db62c59ba43517ae8321be to your computer and use it in GitHub Desktop.
Save azamsharp/49c482d196db62c59ba43517ae8321be to your computer and use it in GitHub Desktop.
var body: some View {
NavigationView {
VStack {
// get the selected customer
CustomerListView(customers: customers) { (customer) in
selectedCustomer = customer
}
if let selectedCustomer = selectedCustomer {
NavigationLink(
destination: DetailView(customer: selectedCustomer),
isActive: .constant(true)) {
EmptyView()
}
}
}
.onAppear {
selectedCustomer = nil
}
.navigationTitle("Customers")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment