Introducing View Preferences in SwiftUI

Mark van Wijnen
9 min readOct 2, 2020

Intro

Apple spent a lot of time talking about @State, @Binding and the Environment, but they didn’t give much attention to View Preferences. In fact they only briefly mention its existence in their SwiftUI Essentials talk from WWDC 2019. Even the documentation isn’t much of a help here with descriptions like ‘No overview available’ and no sample code to demonstrate how it should work. So…

--

--

Mark van Wijnen

macOS/iPadOS/iOS/watchOS/visionOS developer and SwiftUI enthousiast. “Stay Hungry, Stay Foolish!” — Steve Jobs