Observables Enumeration Reference
public enum Observables
Contains factory methods for creating common Observable instances for use with the Tealium SDK.
-
The block called when an
ObservableofElementemits an event.Declaration
Swift
typealias Observer<Element> = Observable<Element>.Observer -
Creates a custom observable that can call
Observercallbacks with values of typeElement.Use this method to create different behaviors upon
Observablesubscription.Declaration
Swift
static func create<Element>(subscriptionHandler: @escaping Observable<Element>.SubscriptionHandler) -> Observable<Element>Parameter Description subscriptionHandlerThe code run every time the returned
Observableis subscribed upon. Within this block you can call theObserverblock with values of typeElement.Return Value
An
Observablethat can be subscribed upon. Every time someone subscribes to thisObservablethesubscriptionHandlerwill be invoked. -
Returns an observable that will send only one event once the asyncFunction has completed.
Declaration
Swift
static func callback<Element>(from asyncFunction: @escaping (@escaping Observer<Element>) -> Void) -> Observable<Element>Parameter Description asyncFunctionis the function that needs to be called and needs to report the completion to the provided observer. This function will only be called when an observer subscribes to the returned Observable. Every subscription will cause the asyncFunction to be called again.
Return Value
a
Observablethat, when a new observer subscribes, will call the asyncFunction and publish a new event to the subscribers when the function completes. -
Returns an observable that just reports the provided elements in order to each new subscriber.
Declaration
Swift
static func just<Element>(_ elements: Element...) -> Observable<Element> -
Returns an observable that just reports the provided elements in order to each new subscriber.
Declaration
Swift
static func from<Element>(_ elements: [Element]) -> Observable<Element> -
Returns an empty observable that never reports anything
Declaration
Swift
static func empty<Element>() -> Observable<Element> -
Returns a single observable with an array of Elements from the provided array of elements
The first element published from the returned observable will be published when all the observables provided emit at list one element. All subsequent changes to any observable will be emitted one by one.
Declaration
Swift
static func combineLatest<Element>(_ observables: [Observable<Element>]) -> Observable<[Element]>