Using Reactive Streams
In this first recipe, we’re going to create a simple SwiftUI view to demonstrate a simple reactive flow. Considering SwiftUI and Combine were released at the same time, it only makes sense to review reactive programming using Apple’s first-party frameworks built specifically for it!
Getting ready
For all the recipes in this chapter, you’ll need the latest version of Xcode available from the Mac App Store.
How to do it...
With Xcode open, let’s get started:
- Create a new project in Xcode. Go to File | New | Project | iOS App. Be sure to choose SwiftUI for the interface.
- First, create a view called
FetchView
that simply holds aBinding
property and a body that displays that property’s value:struct FetchView: View {
@Binding var nameDownStream: String
var body: some View {
...