SHARE
TWEET

Untitled

a guest Jul 22nd, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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)?
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top