Functions
The following functions are available globally.
-
Asynchronously executes the passed-in function on a concurrent GCD queue.
Declaration
Swift
public func async(_ fn: @escaping () -> Void)
Parameters
fn
The function to execute asynchronously.
-
After a specified delay, asynchronously executes the passed-in function on a concurrent GCD queue.
Declaration
Swift
public func async(delay: TimeInterval, _ fn: @escaping () -> Void)
Parameters
delay
The number of seconds to wait before executing
fn
asynchronously. This is not real-time scheduling, so the function is guaranteed to execute after this amount of time, not after this amount of time.fn
The function to execute asynchronously.
-
Asynchronously executes the passed-in function on a concurrent GCD queue, treating it as a barrier. Functions submitted to the queue prior to the barrier are guaranteed to execute before the barrier, while functions submitted after the barrier are guaranteed to execute after the passed-in function has executed.
Declaration
Swift
public func asyncBarrier(_ fn: @escaping () -> Void)
Parameters
fn
The function to execute asynchronously.
-
Asynchronously executes the specified function on the main thread.
Declaration
Swift
public func mainThread(_ fn: @escaping () -> Void)
Parameters
fn
The function to execute on the main thread.
-
Asynchronously executes the specified function on the main thread.
Declaration
Swift
public func mainThread(delay: TimeInterval, _ fn: @escaping () -> Void)
Parameters
delay
The number of seconds to wait before executing
fn
asynchronously. This is not real-time scheduling, so the function is guaranteed to execute after this amount of time, not after this amount of time.fn
The function to execute on the main thread.