DevTechie
Published in

DevTechie

New in SwiftUI 4: ViewThatFits

Photo by Annie Spratt on Unsplash

ViewThatFits is a container view introduced with SwiftUI 4 and iOS 16. ViewThatFits holds collection of child views and displays a view depending upon the available size.

It does so by evaluating child views in the order they are defined and selects the child view whose size is ideal to fit in within the constrained space.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store