Essential Developer

View Original

How do senior iOS devs decouple features from frameworks like StoreKit? | Live Dev Mentoring

This video was publicly available only until May 16th, 2022. Now, it's only available to students of the iOS Lead Essentials program.

Watch on YouTube

Have you ever felt like Apple frameworks such as StoreKit for in-app purchases are hard to use and complicate your code? 👇

For example, you may have to deal with many confusing optional properties (that should never be nil). Or callbacks with optional results - even though there's no reason to ever get nil back in your specific case.

This is not because Apple's framework design is bad. But think about it... Apple frameworks need to accommodate every app. So those frameworks need to be very flexible and offer a wide variety of features. And this brings complexity.

But your app may need only a tiny subset of the features Apple frameworks (or any other 3rd-party framework) provide.

To become a complete senior iOS developer, you need to know how to separate your features from frameworks' complexity in such cases.

To do so, you can model your app needs with plain Swift types and clean abstractions - without ever referencing specific framework details in your features. And you "plug" or "inject" frameworks into your features later. This strategy is a combination of "Dependency Inversion" and other design principles and practices applied in unison.

This is a common strategy in Domain-Driven Design (DDD) - where you design/model your core domain to be decoupled from frameworks and infrastructure complexity. This makes your core domain logic much easier to implement, maintain, understand, and test.

Watch this mentoring session now to learn how senior iOS devs decouple features from frameworks!

But hurry up because this video is publicly available only until May 16th, 2022. After that, it'll only be available to students of the iOS Lead Essentials program.

Also, subscribe to our Youtube channel