# iOS version

## check iOS version

{% tabs %}
{% tab title="💈範例" %}
```swift
extension Bool {
     /// ⭐️ Bool.iOS14
     static var iOS14: Bool {
         guard #available(iOS 14, *) else { return false }
         return true
     }
 }
 
 // use case
 Text("Hello, world!")
    .padding()
    .if(.iOS14) { $0.background(Color.red) }    // ⭐️ use case
```
{% endtab %}

{% tab title="📗 參考" %}
* SwiftLee ⟩ [How to create a Conditional View Modifier in SwiftUI](https://www.avanderlee.com/swiftui/conditional-view-modifier/)
{% endtab %}

{% tab title="👥 相關" %}
* [.if](../../custom/ext/view/.if "mention")
{% endtab %}
{% endtabs %}
