Type Safely

Share this post
Use AnyLayout To Choose a Layout At Runtime
typesafely.substack.com

Use AnyLayout To Choose a Layout At Runtime

Daily Coding Tip 115

Rob Sturgeon
Jun 22
Share this post
Use AnyLayout To Choose a Layout At Runtime
typesafely.substack.com
Image by Dušan Cvetanović from Pixabay

I originally started this by creating an enum with vertical and horizontal cases, but Apple has already done that for me by creating Axis.

Instead of creating a similar enum with the same cases, I’m simply going to extend the existing type, adding a computed property that returns AnyLayout(VStack()) when the enum va…

Keep reading with a 7-day free trial

Subscribe to Type Safely to keep reading this post and get 7 days of free access to the full post archives.

Already a paid subscriber? Sign in
© 2022 Type Safely
Privacy ∙ Terms ∙ Collection notice
Publish on Substack Get the app
Substack is the home for great writing