Use a computed property :
var opacity: Double { disabled ? 0.5 : 1 }
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: