I have side bar menu in my project, it is work correctly, but I want to use every side bar option menu, when I click any side bar menu, it may router to other Swift UI. How can I create Swift UI for every side option menu?
SideMenuViewModel:
SideMenuView:
SideMenuViewModel:
Code Block enum SideMenuViewModel: Int, CaseIterable { case profile case lists case bookmarks case messages var title: String { switch self { case .profile: return "Profile" case .lists: return "lists" case .bookmarks: return "bookmarks" case .messages: return "messages" }} var imageName: String { switch self { case .profile: return "profile" case .lists: return "list.bullet" case .bookmarks: return "bookmark" case .messages: return "message" }}}
SideMenuView:
Code Block struct SideMenuView: View { @Binding var isShowing: Bool var body: some View { ZStack { LinearGradient(gradient: Gradient(colors: [Color("red"), Color("blue")]), startPoint: .top, endPoint: .bottom) .ignoresSafeArea() VStack { SideMenuHeaderView(isShowing: $isShowing) .frame(height: 240) ForEach(SideMenuViewModel.allCases, id:\.self) { option in NavigationLink( destination: Text(option.title), label: { SideMenuOptionView(viewModel: option) })} Spacer() }}.navigationBarHidden(true) }}