Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // CONDITIONAL MODIFIERS & ENVIRONMENT MODIFIERS
- // & VIEWS AS PROPERTIES
- struct ContentView: View {
- @State private var useRedText = false
- let statement = Text("Using View as Properties!")
- var body: some View {
- VStack {
- Button("Red or Blue") {
- self.useRedText.toggle()
- }
- .foregroundColor(useRedText ? .blue : .red)
- VStack {
- Text("This is some text")
- Text("that will be modified")
- Text("by an environment modifier")
- statement
- }
- .font(.headline)
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment