
This video is only available to subscribers. Start a subscription today to get access to this and 470 other videos.
SwiftUI Anchor Preferences
Episode
#442
|
22 minutes
| published on
June 16, 2020
| Uses Xcode-11.5, Swift-5.3
Subscribers Only
Anchors are a way we can refer to the absolute positioning of a view at any level in the view tree. This is useful when you want to have one view surround, underline, or point to another element in the view tree. Combined with GeometryReader, you don't need to worry about converting between coordinate systems like you do in UIKit. Anchors work much like other preferences, with some small differences. In this episode we will build a bar graph view, then use anchors to animate an indicator on the selected item in the graph.