Hi. this is my observable object
final class ToolbarItemProperties: ObservableObject {
var visible = false
var disabled = false
var icon = "questionmark"
var action: () -> Void = { }
var opacity: Double = 1
}
the opacity property value should either be 0.5 or 1 depending on the value of the property disabled. How to listen to it?
The purpose for this is because if i set a button to disabled, it does not render any way to the user to let them know it is disabled. So i thought of changing the opacity instead, hence the opacity property.
So if i do something like this
item.disabled = true
the opacity property value should become 0.5. if disabled is set to false, the opacity value will be 1.