docs/Classes/MainScheduler.html
public final class MainScheduler : SerialDispatchQueueScheduler
Abstracts work that needs to be performed on DispatchQueue.main. In case schedule methods are called from DispatchQueue.main, it will perform action immediately without scheduling.
This scheduler is usually used to perform UI work.
Main scheduler is a specialization of SerialDispatchQueueScheduler.
This scheduler is optimized for observeOn operator. To ensure observable sequence is subscribed on main thread using subscribeOn operator please use ConcurrentMainScheduler because it is more optimized for that purpose.
`
init()
`
Initializes new instance of MainScheduler.
Swift
public init()
`
instance
`
Singleton instance of MainScheduler
Swift
public static let instance: MainScheduler
`
asyncInstance
`
Singleton instance of MainScheduler that always schedules work asynchronously and doesn’t perform optimizations for calls scheduled from main queue.
Swift
public static let asyncInstance: SerialDispatchQueueScheduler
`
ensureExecutingOnScheduler(errorMessage:)
`
In case this method is called on a background thread it will throw an exception.
Swift
public static func ensureExecutingOnScheduler(errorMessage: String? = nil)
`
ensureRunningOnMainThread(errorMessage:)
`
In case this method is running on a background thread it will throw an exception.
Swift
public static func ensureRunningOnMainThread(errorMessage: String? = nil)