how to wait for the URLSession to finish before returning the result from a function in Swift 3
问题 Hi i have a beginner question, where i cant find a good solution for in Swift 3. I hope someone is able to hlep. i have the following code that will check a rest api if the user credentials are valid or not. I want it to wait for the resquest is finished and then return true or false. now it is being send async. Also any improvement in the way i check the JSON value's would be welcome too. func CheckUsernamePassword(username :String ,code:String )-> bool { var validCredentials = false let