Creating and subscribing to Observables
In the upcoming sections, we will work with a sample project and see how can we create and subscribe to Observables in code.
Project setup
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 apod
file inside your Xcode projects folder by executing thepod 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...