RxSwift: Of Operator
.of
takes a variadic parameter.- Creates an
observable
of the specified type (Not an array of that type unless you provide the parameter as an array). - Type inference kicks in here so the type is not needed.
let lotteryNumberOne = 1
let lotteryNumberTwo = 2
let lotteryNumberThree = 3
let observable = Observable.of(lotteryNumberOne, lotteryNumberTwo, lotteryNumberThree)
// Observable of Int
let observable = Observable.of([lotteryNumberOne, lotteryNumberTwo, lotteryNumberThree])
// Observable ARRAY of Int
< All Posts