From the course: RxSwift: Design Patterns for iOS Developers
Unlock this course with a free trial
Join today to access over 22,500 courses taught by industry experts.
Observable types - Swift Tutorial
From the course: RxSwift: Design Patterns for iOS Developers
Observable types
- [Instructor] Observable types are like onions, they have layers. There are three types of Observables to work with: Variable, Subjects, and Observables. Deep down inside, they're all really just a special case of Observable and Variables are the easiest to work with, Subjects are a little more difficult, but an actual Observable is typically only used in complex tasks, such as chaining dependent network calls or something like that. Again, Variables are the easiest piece to work with and often are the best solution for 90% of your needs. They give us the ability to get and set just like a regular variable in Swift, and you can even think of them as just a normal variable, but one that you can subscribe to changes on it, if you want. These are also known as a type of Hot Observable, which means events may have already happened before you started subscribing. You won't get any of those other events, but you will get the last events value or the default value when you first subscribe…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.