Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //I have a menuItem: (used as row in a ForEach loop)
- struct MenuItem{
- var id = UUID()
- var menuImageName: String
- var menuItemTitle: String
- let menuItemDestination: () -> View // Should this be ()->Void?
- }
- //and trying to instantiate menuItems using:
- let menuItems = [
- MenuItem(menuImageName: "a.circle", menuItemTitle: "Menu A", menuItemDestination: MenuDestinationView()),
- ...] // Bunch of menu items
- // with MenuDestinationView() right now being a simple:
- struct MenuDestinationView: View {
- var body: some View {
- Text("Destination View")
- }
- }
- //I've tried all the ways I can think of passing which view to present for that specific menu item, but no luck.
- //How do I pass which View to use on that specific menuItem(Row)?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement