I have build a side menu with 4 cases and one of the is the Home
struct SideMenuSwitchView: View {
private let viewModel: SideMenuViewModel
init(viewmodel: SideMenuViewModel) {
self.viewModel = viewmodel
}
var body: some View {
switch viewModel {
case .Home:
HomeView()
case .Users:
UsersView()
case .TODOs:
TODOsView()
case .AboutUs:
AboutUsView()
}
}
}
that this option is already my default screen. With my code I call the items of side menu view and one case is the Home that is same as default screen. (Default screen = Home and presents an API)
ForEach(SideMenuViewModel.allCases, id: \.self) { option in
NavigationLink(destination: SideMenuSwitchView(viewmodel: option) , label: {SideMenuOptionView(viewModel: option)})
}
I am going in a new link for Home, so I have 2 separate views with the same info.
How can I make HomeView Navigation Link option return as default screen?