jeudi 10 novembre 2016

Swift 3 - making a variable from if-Statement global

While encoding JSON, i´m unwrapping stuff with an if-Statement:

do {
            if let json = try JSONSerialization.jsonObject(with: data) as? [String: String], let jsonIsExistant = json["isExistant"] {

                // Here I would like to make jsonIsExistant globally available

            }

My Question is, if this is even possible. Otherwise I could make an if-Statement inside of this one, but I don´t think that would be clever or even possible.

Aucun commentaire:

Enregistrer un commentaire