Size classes help us determine which device our user is on as well as the orientation of that device. In SwiftUI we use environment variables to access size class information and adapt our UI accordingly. In this video, I show an example of how to adjust between landscape and portrait on an iPhone in SwiftUI.
iOS Developer Courses
https://seanallen.teachable.com/
Twitter:
Sean Allen - https://twitter.com/seanallen_dev
iOS Developer Courses
https://seanallen.teachable.com/
Timestamps:
0:00 - What are Size Classes?
0:41 - Device Examples - MAX Exception
1:24 - Size Class Chart - HIG
2:09 - iPad Split View Considerations
2:36 - Code - Access Size Class in SwiftUI
4:11 - iPhone - Determine Landscape
4:29 - Code - Change UI in Landscape
5:08 - Quick Refactor
5:53 - Quick Review & Run App
Hired.com:
https://hired.com/x/1n01g
Book and learning recommendations that help out the channel if you decide to purchase (Affiliate Links):
Paul Hudson's Hacking With Swift:
https://gumroad.com/a/762098803
Donny Wals - Combine:
https://gumroad.com/a/909014131
Mark Moeyken’s SwiftUI Books:
www.bigmountainstudio.com/swiftui-views-book/fzc51
Objc.io Books (Thinking in SwiftUI & Advanced Swift):
https://gumroad.com/a/656585843
Ray Wenderlich Books:
https://store.raywenderlich.com/a/20866/link/1
Links to my iOS Dev Setup & iOS Dev Book Recommendations
https://www.amazon.com/shop/seanallen
#swift #softwaredeveloper #iosdeveloper