As discussed earlier, we need to set up a workspace to work with RxSwift:
- Create a single view application project and name it RxBasics.
- Open Terminal and navigate to the project folder. Create a pod file inside your Xcode projects folder by executing the pod init command.
- Open the created pod file and paste the pod file's code:
# Uncomment the next line to define a global platform for your project
target 'RxBasics' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
pod 'RxSwift'
# Pods for RxBasics end
- Enter the pod install command to fetch all the listed libraries from GitHub and install all of them in the project.
- As a result of this installation, you will find a newly created workspace by the name .xcworkspace. Launch this file, and you are ready to work with the reactive components that will be introduced in the chapter.
We will work with playground in this chapter and as soon as we have the .xcworkspace ready, create a new playground file in the project and name it RxBasics. This is the easiest way to get things going. Working only with Playgrounds and third-party libraries is a gray area when it comes to Apple documentation. Next, Import RxSwift in this newly created RxBasics.playground file and build the project to get rid of any possible errors.