Created
January 24, 2021 02:30
-
-
Save azamsharp/49c482d196db62c59ba43517ae8321be to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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