0

I'm using Alamo fire 5. If anyone could show me how to rewrite this using the switch case, I would be grateful:

AF.request(URL_USER_LOGIN, method: .post, parameters: parameters).responseJSON
{
     response in
     //printing response
     print(response)

     //getting the json value from the server
     if let result = response.result.value {
     let jsonData = result as! NSDictionary

     //if there is no error
     if(!(jsonData.value(forKey: "error") as! Bool)){

     //getting the user from response
     let user = jsonData.value(forKey: "user") as! NSDictionary

     //getting user values
     let customerID = user.value(forKey: "customerID") as! Int
     let email = user.value(forKey: "email") as! String
     let password = user.value(forKey: "password") as! String
     let name = user.value(forKey: "name") as! String
jvarela
  • 3,744
  • 1
  • 22
  • 43
ace
  • 1
  • 1

0 Answers0