DevTechie
Published in

DevTechie

New in SwiftUI 4 : AnyLayout

Photo by Hal Gatewood on Unsplash

Introduced in SwiftUI 4, AnyLayout is a type-erased instance of the layout protocol. We can use AnyLayout instance to enable dynamic layout container change without destroying the state of subviews. For example, if we a VStack displaying two subviews in portrait mode, with the toggle of a button we can change the VStack to HStack without affecting current state of subviews.

--

--

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