# conditional modifier

[SwiftUI](../..) ⟩ [view](..) ⟩ [modifier]() ⟩ conditional modifier

{% hint style="success" %}
Change view modifiers conditionally

```swift
Circle()
    // ⭐️ conditional modifier (`isOn`: @State view property)
    .foregroundColor( isOn ? .red : .yellow )    
```
{% endhint %}

{% tabs %}
{% tab title="👥 相關" %}
* [ternary conditional operator](../../../swift/op/ternary) ( a ? b : c)
* view [states](../../../master/term/state) ([@State](../state/value/state) property)
{% endtab %}
{% endtabs %}
