I just recently started working at Swift and I still don’t understand much
I wrote this code
if let myData = data{ do{ let myJson = try JSONSerialization.jsonObject(with: myData, options: JSONSerialization.ReadingOptions.mutableContainers) as AnyObject if let data = myJson["data"] as AnyObject? { let id = data["id"] as! NSString? print (id!) let logo = data["logo"] as! NSString? print (logo!) let name = data["name"] as! NSString? print (name!) } let status = myJson["status"] as! String! print (status!) if(status == "OK") { UserDefaults.standard.set(true,forKey:"isUserLoggedIn"); UserDefaults.standard.synchronize(); self.dismiss(animated: true, completion: nil); } } when the login and password are correct, everything is fine my JSON code comes and I can parse it, but if the login or password is incorrect, then the program knocks out and issues an error fatal error
I check the login and password on the server