Make package manifest a constant
An extremely simple promise library.
Add a Package.swift dependency:
.Package(url: "https://github.com/OpenKitten/Schrodinger.git", majorVersion: 1)
Run code asynchronously and await their results. Supports error throwing.
let promisedResult = async { // Run your heavy code throw An.error return successfulResults } try promise.await()
And set custom timeouts.
// times out after a minute let promise = async(timingOut: .seconds(60)) { ... }
版权所有:中国计算机学会技术支持:开源发展技术委员会 京ICP备13000930号-9 京公网安备 11010802032778号
Schrodinger
An extremely simple promise library.
Usage
Add a Package.swift dependency:
.Package(url: "https://github.com/OpenKitten/Schrodinger.git", majorVersion: 1)Run code asynchronously and await their results. Supports error throwing.
And set custom timeouts.