Combine and data flow in SwiftUI
For many years, the reactive programming stream has played a big part in development architecture in terms of iOS and macOS. You may have heard of RxSwift and RxCocoa, a massive community committed to the reactive stream that allows for asynchronous events to be processed.
If you are not familiar with the terminology of Rx or reactive programming, you may have seen the use of Publishers
, Subscribers
, and Operators
in your code base. If you have, then you’ve most likely been subject to reactive programming at some point.
In this section, we are going to take a look at Apple’s offering for reactive programming, called Combine. Introduced alongside SwiftUI at WWDC 2019, Combine is the perfect accompaniment for the new layout and structure of SwiftUI (although not bound solely to SwiftUI). We’ll take a look at how we can create a seamless flow of data from an online resource, right up to our UI layer.
Getting ready
For this...