In this SwiftUI tutorial, I discuss the new data flow and observation features for iOS 17 and Xcode 15. We explore how these features can simplify your code and improve the performance of your apps. I walk through the process of converting existing code to use the new observation style and highlight potential pitfalls to avoid.
You will learn about the new @Observable macro and the @State and @Bindable property wrappers.
I also demonstrate how to optimize the data flow to only update views when necessary. Overall, the new observation features in Swift UI offer a more streamlined and efficient way to handle data flow in your apps.
I am using Xcode 15 beta 3
⬇️ get the project files at https://github.com/gahntpo/SwiftUIObservationProject
Overview
00:00 introduction
02:39 demo project and problem with too many view updates
06:41 converting from observableObject to the new Observation
16:55 demo of Observation
21:41 how to write SwiftUI views for better view redraws
31:10 Summary
If you liked what you learned and you want to see more, check out one of my courses!
👨💻 my SwiftUI course https://learn.swiftyplace.com/swiftui-layout-course
👨💻 my Core Data and SwiftUI course https://learn.swiftyplace.com/swiftui-core-data-mastery-course
#SwiftUI #dataflow #observation