9
A switch statement?
A switch statement?
One option would be to use an enum with a label
computed property.
enum TransitionState {
case stageOne, stageTwo, stageThree
var label: String {
switch self {
case .stageOne: "Stage one!"
case .stageTwo: "Stage two!"
case .stageThree: "Stage three!"
}
}
}
struct MyView: View {
@State var transitionState: TransitionState = .stageOne
var body: some View {
Text(transitionState.label)
}
}
It looks like an enum with calculated properties would be great here.
This group focus on the content related to the development of Apple Eco-system software. So feel free to share and talk about, for example;