Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. import SwiftUI
  2. import PlaygroundSupport
  3.  
  4. struct Contact: Identifiable {
  5. // important for each to be unique
  6. var id = UUID()
  7. var name: String
  8. }
  9.  
  10. struct MyTableView: View {
  11.  
  12. let contacts: [Contact] = [
  13. Contact(name: "Matt"),
  14. Contact(name: "Andy"),
  15. Contact(name: "Hubert")
  16. ]
  17.  
  18. var body: some View {
  19.  
  20. List(contacts) { contact in
  21. Text(contact.name)
  22. }
  23. }
  24. }
  25.  
  26. PlaygroundPage.current.liveView = UIHostingController(rootView: MyTableView())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement