how to make something happen when a word it typed in a textfield

I want to know how to make something happen when i type a specific word in a textfield
Answered by fromtoronto in 662079022
Code Block
 TextField("enter text", text: $text)
      .onChange(of: text) {
        if $0 == "magic" { // use $0.lowercased() for case-insensitive
          // do something
        }
   }

Accepted Answer
Code Block
 TextField("enter text", text: $text)
      .onChange(of: text) {
        if $0 == "magic" { // use $0.lowercased() for case-insensitive
          // do something
        }
   }

Thanks. is the $0 a variable if not could use give a example of what it is I'm a beginner.

never mind about the $0 I figured it out.
how to make something happen when a word it typed in a textfield
 
 
Q