Created
January 22, 2021 04:18
-
-
Save azamsharp/936f8abc4b913c12bdddd86042071805 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import SwiftUI | |
struct CustomerListView: View { | |
let customers: [String] | |
var body: some View { | |
List(customers, id: \.self) { customer in | |
NavigationLink( | |
destination: DetailView(customer: customer), | |
label: { | |
HStack { | |
Text(customer) | |
Spacer() | |
}.contentShape(Rectangle()) | |
}) | |
}.listStyle(PlainListStyle()) | |
} | |
} | |
struct CustomersView_Previews: PreviewProvider { | |
static var previews: some View { | |
CustomerListView(customers: ["John", "Mary", "Alex"]) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment