Skip to content

Latest commit

 

History

History
22 lines (16 loc) · 408 Bytes

File metadata and controls

22 lines (16 loc) · 408 Bytes

AsyncBridge

Execute callback-based and sync functions asynchronously without rewriting their definitions.

// Callback Conversion

// Before:
foo.bar("baz", completion: { (result: Int) in })

// After:
async let result: Int = await foo.bar >>> ("baz")
// Sync Conversion

// Before:
let result: Int = foo.bar("baz")

// After:
async let result: Int = await foo.bar >>> ("baz")