I am new to Swift language. I would like to know what is the alternative of wait all tasks to finish before executing the next functions in Swift?
I tried the async/await functions of Swift, but the functions just run in the background instead of waiting until the tasks finish.
Thank you.
func checkData(firstName: String) async {
Task(priority: .high) {
await compareFirstName(firstName: firstName)
}
Task(priority: .low) {
await uploadFirstName(firstName: firstName)
}
}
I want the compareFirstName() to finish first, but the uploadFirstName() always finish before the compareFirstName().