Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. //I have a menuItem: (used as row in a ForEach loop)
  2.  
  3. struct MenuItem{
  4. var id = UUID()
  5. var menuImageName: String
  6. var menuItemTitle: String
  7. let menuItemDestination: () -> View // Should this be ()->Void?
  8. }
  9.  
  10. //and trying to instantiate menuItems using:
  11.  
  12. let menuItems = [
  13. MenuItem(menuImageName: "a.circle", menuItemTitle: "Menu A", menuItemDestination: MenuDestinationView()),
  14.  
  15. ...] // Bunch of menu items
  16.  
  17. // with MenuDestinationView() right now being a simple:
  18.  
  19. struct MenuDestinationView: View {
  20. var body: some View {
  21. Text("Destination View")
  22. }
  23. }
  24.  
  25.  
  26. //I've tried all the ways I can think of passing which view to present for that specific menu item, but no luck.
  27.  
  28. //How do I pass which View to use on that specific menuItem(Row)?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement