Video: SwiftUI Property Wrappers Version 2

Channel: Stewart Lynch

关于

Data flow in SwiftUI is controlled by Property Wrappers

A Property wrapper is a simple generic class/struct that has some logic that gets triggered whenever the value of property gets modified. SwiftUI offers 17 property wrappers for our applications, each of which provide different functionality. . In the first version of my video of this topic, we covered @State, @Binding, @ObservedObject, @Published and @EnvironmentObject and we will repeat them again in this video but will also add in two more that were introduced in 2020; @StateObject and @AppStorage

We will take a very simple starter project and work our way though each of these different property wrappers so that by the end, you will hopefully have a clear understanding of when and how to use each of them in your own SwiftUI projects.

Starter Project:

https://www.createchsol.com/StarterProjects/SwiftUIPropertyWrappers-2.zip

Completed Project on GitHub:

https://github.com/StewartLynch/SwiftUI-Property-Wrappers-2-Complete

References:

Donny Wals:

https://swiftuipropertywrappers.com

Majid:

https://swiftwithmajid.com/2020/07/02/the-difference-between-stateobject-environmentobject-and-observedobject-in-swiftui/

John Sundell:

Sundell https://swiftbysundell.com/articles/swiftui-state-management-guide/

Previous links from first video

Sarar Unagar:

https://www.sagarunagar.com/Property%20wrappers%20in%20SwiftUI/

Majid:

https://swiftwithmajid.com/2019/06/12/understanding-property-wrappers-in-swiftui/

Sarun:

https://sarunw.com/posts/data-in-swiftui-3/

Paul Hudson:

https://www.hackingwithswift.com/quick-start/swiftui/understanding-property-wrappers-in-swift-and-swiftui

******** Download my StewartLynch YouTube Channel Application - Free ***********

https://stewartlynch.gumroad.com/l/obsjz

Stewart Lynch's YouTube Channel

https://youtube.com/StewartLynch

CreaTECH Solutions Website

https://www.createchsol.com

Stewart Lynch's GitHub

https://github.com/StewartLynch

Buy me a coffee :)

https://ko-fi.com/stewartlynch