A result builder for ViewModifiers.
import SwiftUI
import ViewModifierBuilder
struct ContentView: View {
@State
private var toggler = false
var body: some View {
VStack {
Button("Toggle Modifier") {
toggler.toggle()
}
}
.modifiers {
CustomModifier1()
CustomModifier2()
if toggler {
CustomModifier3()
}
}
}
}