I am looking for a way to just change the color in an if statement. Is that possible or is the code below the best or the only way to do this?
Section(header: Text("Detail Sections Verification")) {
if order.specialRequestEnabled {
Text("Information Verified")
.color(.green)
.frame(minWidth: 0, maxWidth: .infinity,
alignment: .center)
} else {
Text("Information Not Verified")
.color(.red)
.frame(minWidth: 0, maxWidth: .infinity,
alignment: .center)
}
Toggle(isOn: $order.specialRequestEnabled) {
Text("Set if all data is verified")
}
}