SwiftUI Preferences

Episode #438 | 14 minutes | published on May 7, 2020 | Uses Xcode-11.4, Swift-5.2
Subscribers Only
In SwiftUI we use State to push values from a parent to a child. What if you want to go the other way, passing data about a child up to a parent? To do this we can leverage Preferences. In this episode we will see how to define a custom preference key, how to use an overlay with a GeometryReader to measure the size of a view, and then set a preference with the view's size. Then we'll learn how to respond to preference changes in an ancestor view.

Nothing yet...

blog comments powered by Disqus