Type Safely

Type Safely

Share this post

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

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

Share this post

Type Safely
Type Safely
How To Initialise a View's Body Property With a Switch (and Why You Probably Shouldn't)
Share
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 …

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