Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Not that great of an example to be honest.

For starters the use-case which was defined `UserDefaults` you can just use a property wrapper to make it easier. Then in your class you can do:

@Defaults(key: “usesDarkTheme”) var usesDarkTheme: Bool

Now it uses type erasure under the hood and call sites are cleaner.

For PoP, it’s kind of outdated. Better to use Value Oriented programming nowadays



They go hand in hand, because values can still implement protocols.


I don’t understand what you’re referring to.

What does hand in hand?

Addressing the specific example in the article we can do a lot better (without protocol oriented programming).

For most cases you aren’t going to even need PoP. And I would argue it REALLY depends on your usecase, and business requirements.

Strong arming and shoe boxing business requirements into specific architectures is the wrong approach, should be the other way around.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: