Coex comes from Coexistence and is a lightweight Swift library & syntactic sugar for async (GCD) operations.
Made with ♥ in pure Swift 5.x, no dependencies, simple & fully portable.
You can also use Coex.async(...)
instead of async(...)
.
main
background
utility
userInitiated
userInteractive
custom
Running a block of code in a specific DispatchQueue. Default is .main
.
BECOMES | |
---|---|
DispatchQueue.<queue>.async { } |
async(.<queue>) { } |
DispatchQueue.main.async { } |
async(.main) { } async { } (.main is default) |
DispatchQueue.global(qos: .background).async { } |
async(.main, after: 3.0) { } |
Executing a block of code after a specific time (in seconds). Default is nil
.
BECOMES | |
---|---|
DispatchQueue.<queue>.asyncAfter(deadline: .now() + 3.0) { } |
async(.<queue>, after: 3.0) { } |
DispatchQueue.main.asyncAfter(deadline: .now() + 3.0) { } |
async(.main, after: 3.0) { } |
Add the following as a dependency to your Package.swift
:
.package(url: "https://github.com/chryb/coex.git", .exact("1.0.0"))
Insert the following into your Cartfile
:
github "chryb/coex" == 1.0.0
Add the following to your Podspec
:
use_frameworks!
pod "Coex"
Just MIT. See LICENSE.