The SwiftUI framework is a reactive framework. No need to use any reactive framework like RxSwift to achieve reactive programming.
![](https://swiftbyrahul.com/wp-content/uploads/2020/04/states.gif)
The @State is a ‘propertyWrapper‘ struct. It wraps a value of property or object with a view at runtime. Did you confused? , Consider below example, fullName variable stated by @State, and then it’s wrapped with TextField view, When you will change the input value of TextField. it will get stored in the fullName property, and yes forgot to say when state value gets changed it will automatically get reflected in UI, wherever you used @State wrapped variable like fullName, Text label get reflected changed value in TextField.
Text(fullName).padding(12)
import SwiftUI
struct ContentView: View {
@State var fullName = ""
var body: some View {
NavigationView {
VStack {
TextField("Swift By Rahul", text: $fullName).padding(12)
Text(fullName).padding(12)
}
}.background(Color.white)
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
No need to use TextField lifecycle delegate in SwiftUI like textDidChange(), Its very crucial feature of SwiftUI over UIKit, For more to know more features of SwiftUI.