Добавить замыкание в конце метода AutheManager.Login
AutheManager.Login(username: String, password: String, completion: @escaping (_ success: Bool, response: [String: Any]?) -> ()) {
...
//call once you get response, for success
completion(true, response)
//for failure
completion(false, nil)
...
}
Теперь вызовите этот метод:
AutheManager.Login(username: newAccountName, password: newPassword) { (success, response) in
guard success, let response = response else { //show message }
print(response)
///move you rest of the code/logic here
}