Property Wrappers, introduced in Swift 5.1, simplify the code you write for SwiftUI views. For example, if you need to declare a property in your view and have the view update automatically when that property changes, you use the @State property wrapper. Property Wrappers have logic abstracted away that can accomplish various things. Choosing the right Property Wrapper for your use case will help you simplify your code.
In this tutorial, we’ll look at the @State and @StateObject property wrappers. Let’s begin with @State.
[Read more…]