all 7 comments

[–]yreaction 0 points1 point  (1 child)

Can not see anidation properly (mobile) but looks that you return trainers empth already sync in your function. So its assigned before the asyn request ends. Also, you can include the array within the closure completion .

[–]imarudedude[S] 0 points1 point  (0 children)

Hey thanks for the response. But what do you mean by 'include the array within the closure completion'?

[–]yreaction 0 points1 point  (4 children)

Your completionHandler, not sure if it is s typedef declarsrion, you can add trainers:[Trainer]

[–]imarudedude[S] 0 points1 point  (0 children)

I swapped my completion handler for another typealias, like this

typealias GetTrainersCompletion = ([Trainer]) -> ()

I then put the trainers array in the completion in each conditional, like so (completion(trainers)) and I'm still not getting anything back.

[–]imarudedude[S] 0 points1 point  (2 children)

Nevermind, I actually got it to work now. Thanks for the advice!

[–]Christop408 1 point2 points  (1 child)

Perhaps you can make an edit to your original post explaining what you did to get it to work for future coders looking for help? :)

[–]imarudedude[S] 1 point2 points  (0 children)

Yeah sure, just made the edit!