I everyone! I spent hours looking for something that I guess very simple but I can not managed to find the best way... I have my body view :
var body: some View {
VStack {
// The CircularMenu
CircularMenu(menuItems: homeMenuItems, menuRadius: 55, menuButtonSize: 55, menuButtonColor: .black, buttonClickCompletion: buttonClickHandler(_:))
.buttonStyle(PlainButtonStyle())
}
}
Which contains a circular menu. Each click on a menu item calls :
func buttonClickHandler(_ index: Int) {
/// Your actions here
switch index {
//Thermometer
case 0:
print("0")
//Light
case 1:
print("1")
//Video
case 2:
print("2")
//Alarm
case 3:
print("3")
//Car
case 4:
self.destinationViewType = .car
self.nextView(destination: .car)
default:
print("not found")
}
}
I want to perform a simple view transition to another view called Car. nextView
function looks like this :
func nextView(destination: DestinationViewType) {
switch destination {
case .car: Car()
}
}
I thought that was simple like this but I get : Result of 'Car' initializer is unused
on the case line.
So someone knows how to achieve that ? Thanks a lot in advance!