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"
}
}
@ViewBuilder var view: some View{
switch self{
case .registerSignal:
RegisterView(title: self.text)
case .setAlarm:
Text("Set up Alarm")
case .tV:
Text("TV and Sequences")
case .test:
Text("Test Device")
}
}
}
1条答案
按热度按时间bbmckpt71#
您必须将变量设为
@ViewBuilder
并移除return