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
SwiftLee โฉ How to create a Conditional View Modifier in SwiftUI
.if(_:then:)
Last updated 2 years ago