iOS Swift - Concurrency
How do you correctly create a
Task in Swift that asynchronously returns the integer 42?Task in Swift that asynchronously returns the integer 42?Task is created using Task { ... } with a closure that returns the desired value asynchronously.Task { return 42 }. let task = TaskTask and prints instead of returning. let task = Task.run { 42 } uses a non-existent Task.run method. let task = Task.async { return 42 } uses Task.async which is invalid.Task { ... } syntax [OK]15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions