lundi 11 juillet 2016

Missing return in a function


It's a simple question. As you can see in the code, there is return in every case. But , somehow, xcode does not recognizes the return in the refresh()'s completionHandler block.

Any suggestions?

    func accessTokenWithBearer() -> String {
            if !didTokenExpire() {
                return "Bearer (accessToken!)"
            }else{
                Token.refresh({
                    return "Bearer (self.accessToken!)"
                })
            }
    }

    class func refresh(completion: ()->()){
        completion()
    }

Aucun commentaire:

Enregistrer un commentaire