Concurrency Concepts
Async Functions
An async function can suspend before returning a value to the caller.
Await a result
async_functions.swift
func doubled(_ value: Int) async -> Int {
return value * 2
}
let input =
let result = await doubled(input)
let message = "result=\(result)"
print(message)
func doubled(_ value: Int) async -> Int {
return value * 2
}
let input =
let result = await doubled(input)
let message = "result=\(result)"
print(message)
func doubled(_ value: Int) async -> Int {
return value * 2
}
let input =
let result = await doubled(input)
let message = "result=\(result)"
print(message)
async function
`await` marks the point where the caller waits for an async function result.