Other Functions

The following functions are available globally.

  • If on main thread then perform work block immediately, otherwise asynchrounsly perform work block on the main queue.

    Declaration

    Swift

    @_spi(MapboxInternal)
    public func onMainAsync(_ work: @escaping () -> Void)
  • If on main thread then performs a work item. If on non-main thread then performs the work item synchronously on main queue.

    Declaration

    Swift

    @_spi(MapboxInternal)
    public func onMainQueueSync<T>(execute work: () throws -> T) rethrows -> T

    Return Value

    The return value of the item in the work parameter.