I'm trying to build a menu using the code below. I've run into some difficulty declaring the destination view in the struct.
I get the error: Protocol 'View' can only be used as a generic constraint because it has Self or associated type requirements
The designation of course will be the a view in the app.
Any help would be greatly appreciated.
I get the error: Protocol 'View' can only be used as a generic constraint because it has Self or associated type requirements
The designation of course will be the a view in the app.
Any help would be greatly appreciated.
Code Block import SwiftUI struct MenuList: Identifiable { var id: Int var image: String var name: String var destination: View // This line is where the problem is } extension MenuList { static func getMenu() -> [MenuList] { return[ MenuList(id: 1, image: "house", name: "Welcome", destination: Welcome_View()), MenuList(id: 2, image: "text.justify", name: "MW List", destination: TrickList_View()), MenuList(id: 3, image: "list.bullet", name: "My Collection", destination: MyCollection_View()), MenuList(id: 4, image: "text.badge.plus", name: "Telly Sheet", destination: Tally_View()), MenuList(id: 5, image: "rectangle.and.paperclip", name: "Want List", destination: WantList_View()), MenuList(id: 6, image: "gear", name: "Settings", destination: Settings_View()), MenuList(id: 7, image: "arrowshape.turn.up.right", name: "Share", destination: Share_View()), MenuList(id: 8, image: "questionmark.circle.fill", name: "Help", destination: Help_View()), MenuList(id: 9, image: "photo.on.rectangle", name: "Presentation", destination: Presentation_View())] } }