Why use Combine?
Apple’s Combine framework is considered to have a steep learning curve, but not because it is technically complex. This is because many developers don’t understand why, how, and where they should use Combine in their apps.
To answer these questions, let’s try to understand Combine. Combine is Apple’s reactive framework and provides a unified API for asynchronous events and data streams.
But why do we need a reactive framework? Don’t we have everything we need?
Let’s see what we have in our iOS SDK:
- Notifications allow us to send messages that any object can observe
- Delegates allow objects to respond to events or changes triggered by other objects
- Closures are self-contained functionality blocks we can pass around and call whenever we need
- Key-Value Observing (KVO) allows us to observe value changes in object property
That’s a powerful toolbox! But while we have a toolbox with so many...