Is it possible to do something such as:
Vstack {
Text("Hello, World!")
}
if Role == "administrator" {
.offset(y: 15)
}
Doing this right now gives an error on the var body: some View {
line.
CodePudding user response:
You can do like this
struct ContentView: View {
@State private var Role: String = "administrator"
var body: some View {
VStack {
Text("Hello, World!")
}
.offset(y: Role == "administrator" ? 15 : 0)
}
}