Type Safely

Type Safely

Using Enum Instead of Struct For SwiftUI Views

Daily Coding Tip 078

Millie Sturgeon's avatar
Millie Sturgeon
May 03, 2022
∙ Paid
Image by fijidji from Pixabay

Here I have a SwiftUI view called EnumView that is an enum rather than a struct.

It has three cases: red, blue and green.

For each case it unsurprisingly returns a Color, which conforms to View.

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