3 ms·
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. Th
by pixel_tracing 5y ago
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
- amw-zero 5y agoThey go hand in hand, because values can still implement protocols.
- pixel_tracing 5y agoI 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.