Getting started

Let's create a helper function called executeProcedure(with description:String, procedure: () -> Void). The function takes two params: a string description and a procedure closure. It will print the description and will execute the procedure. We will use this function to encapsulate each procedure and make it easier to determine what each procedure is printing to the console:

import UIKitimport RxSwiftpublic func executeProcedure(for description:String, procedure: () -> Void){    print("Procedure executed for:", description)    procedure()}

Firstly, we will cut and paste this function to a separate file in the Sources folder for this playground. By twisting down the playground page in the project navigator, right-click on the

Get Reactive Programming with Swift 4 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.