logoalt Hacker News

vor_today at 6:26 AM1 replyview on HN

> actually using swift enums and protocols is so painful.

In what way? My understanding is they're widely used and encouraged.


Replies

JackYoustratoday at 7:57 AM

If you look at most swiftui views, there will be a mass of optionals, rather than enum cases for every possible state that the view can occupy and a state machine transitioning between each state.

If you actually try and write it all out (like go full-on and use TCA to model all the states and actions such that all and only valid states can be represented in the state types) the compiler is going to have a hard time, you're going to write masses of boilerplate, and just in general it's much rougher than zustand and expo.