Fetching Remote Async API with Apple Combine Framework

Alfian Losari
8 min readSep 22, 2019

You can also read this article in my Xcoding With Alfian blog website using the link below.

Combine is a framework that has just been recently released for all Apple platforms and it is included in Xcode 11. By using combine, it’s easier to process sequence of value over time whenever it is updated. It also helps us to simplify asynchronous code by not using delegation and avoiding complex nested callbacks.

There are several main components of Combine:

  1. Publisher. It’s a protocol that provides interface to publish value to the subscribers. Sometimes, it’s also referred as the upstream source. It provides generic for the Input type and Failure error type. A publisher that never publish an error uses Never as the Failure type.
  2. Subscriber. It’s a protocol that provides for interface to subscribe value from publisher. It is the downstream destination in the sequence chain. It provides generic for Output type and Failure error type.
  3. Subject. It’s a protocol that provides interface to the client…

--

--

Alfian Losari

Mobile Developer and Lifelong Learner. Currently building super app @ Go-Jek. Xcoding with Alfian at https://alfianlosari.com