Type Safely

Type Safely

How To Initialise a View's Body Property With a Switch (and Why You Probably Shouldn't)

Daily Coding Tip 290

Type Safely's avatar
Type Safely
Jun 18, 2023
∙ Paid
window curtain open wide
Photo by Rob Wingate on Unsplash
Last tested on Xcode 15 beta 1

After my previous Daily Coding Tip, I was interested to know what the limitations of assigning a value to a property or variable.

The body in a SwiftUI view is usually a computed property, meaning it’s kinda like a function that returns the opaque type some View. If you know it’ll be the same …

User's avatar

Continue reading this post for free, courtesy of Type Safely.

Or purchase a paid subscription.
© 2026 Type Safely · Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture