I need to run a function A, have function A complete before running function B, have function B complete before function C starts and my the await statements are not working and functions are running at the same time. I have separate Alamofire requests inside function A and function B
@State var a = [A]()
@State var b = [B]()
@State var cDict = [[String:Any]]()
func runAlgorithm() {
Task {
await functionA()
await functionB()
await functionC()
}
}
func functionA() async {
...code...
a = ...
}
func functionB() async {
...code...
b = ...
}
func functionC() async {
...code...
create dictionary cDict from a and b
}
Per Matt’s suggestion I needed to turn the Alamofire requests into async/await too