I am getting the error where var view: some View{.
enum HomeButtons: Int, Hashable, CaseIterable{
case registerSignal = 1
case setAlarm = 2
case tV = 3
case test = 4
var image: String{
switch self{
case .registerSignal:
return "wave.3.backward"
case .setAlarm:
return "alarm.fill"
case .tV:
return "tv.fill"
case .test:
return "av.remote.fill"
}
}
var text: String{
switch self{
case .registerSignal:
return "Register Signal for TV"
case .setAlarm:
return "Set up Alarm"
case .tV:
return "TV and Sequences"
case .test:
return "Test Device"
}
}
var view: some View{ <------- Error is displayed here
switch self{
case .registerSignal:
return RegisterView(title: self.text)
case .setAlarm:
return Text("Set up Alarm")
case .tV:
return Text("TV and Sequences")
case .test:
return Text("Test Device")
}
}
}
struct RegisterView: View{
var title: String
var body: some View{
ScrollView{
ForEach(getTVList(), id: \.TVID){ TV in
NavigationLink(value: TV.TVID){
Text(TV.name)
}
}
}
.background(Color("ToledoGolden"))
.foregroundColor(.accentColor)
.navigationTitle(title)
}
}
I tried changing var view: some View to var view: any View the error went away but where I was calling HomeButtons.view I got this error message: Type 'any View' cannot conform to 'View'