Advertisement
Guest User

Untitled

a guest
Apr 26th, 2016
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.78 KB | None | 0 0
  1. let verse = Alamofire.request(.POST, url, encoding: .JSON)
  2.             .authenticate(user: key, password: key)
  3.             .responseJSON
  4.             { response in switch response.result {
  5.             case .Success(let JSON):
  6.                 //print("Success with JSON: \(JSON)")
  7.                
  8.                 let response = JSON as! NSDictionary
  9.                
  10.                 //example if there is an id
  11.                 let responseone = response.objectForKey("response")
  12.                 let verses = responseone?.objectForKey("verses")
  13.                 let text = verses?.objectForKey("text")
  14.                 print(responseone)
  15.                
  16.             case .Failure(let error):
  17.                 print("Request failed with error: \(error)")
  18.                 }
  19.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement