Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. do {
  2. let allContactsData = try Data(contentsOf: url!)
  3. let allContacts: AnyObject! = try JSONSerialization.jsonObject(with: allContactsData, options: JSONSerialization.ReadingOptions.allowFragments) as! NSArray
  4.  
  5. if let arrJSON = allContacts {
  6. for index in 0...arrJSON.count-1 {
  7.  
  8. let aObject = arrJSON[index] as! [String : AnyObject]
  9.  
  10.  
  11. names.append(aObject["post_name"] as! String)
  12. contacts.append(aObject["post_inn"] as! String)
  13. //contacts.append(aObject["email"] as! String)
  14. let post=Post(post_id: aObject["post_id"] as! String,post_name: aObject["post_name"] as! String,post_inn: aObject["post_inn"] as! String)
  15. posts.append(post)
  16. }
  17. }
  18. print(names)
  19. print(contacts)
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement