Type Safely

Type Safely

Share this post

Type Safely
Type Safely
Use AnyLayout To Choose a Layout At Runtime

Use AnyLayout To Choose a Layout At Runtime

Daily Coding Tip 115

Millie Sturgeon's avatar
Millie Sturgeon
Jun 22, 2022
∙ Paid

Share this post

Type Safely
Type Safely
Use AnyLayout To Choose a Layout At Runtime
Share
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
© 2025 Type Safely
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture

Share