With this extension, we can add the .if()
modifier to our View!
struct ContentView: View {
@State private var shouldAddShadow: Bool = true
var body: some View {
Text("Hello, world!")
.if(shouldAddShadow) { view in
view.shadow(color: .black, radius: 10, x: 0.0, y: 0.0)
}
}
}