Advertisement
Guest User

Untitled

a guest
Jan 29th, 2016
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.89 KB | None | 0 0
  1. import Foundation
  2. import UIKit
  3. import Parse
  4.  
  5.  class ATM {
  6.     var id : NSString!
  7.     var bank : NSString!
  8.     var type : NSNumber!
  9.     var location : PFGeoPoint!
  10.     var description : NSString!
  11.    
  12.     init( id: NSString)
  13.     {
  14.         let query = PFQuery(className: "ATMs")
  15.        
  16.         query.getObjectInBackgroundWithId(id as String) { (object: PFObject?, error: NSError?) -> Void in
  17.            
  18.             if error != nil {
  19.                 print(error)
  20.                
  21.             }
  22.             else {
  23.                 if let atm = object {
  24.                 print("ATM found")
  25.                 self.bank = atm["bank"] as? NSString
  26.                 self.type = atm["type"] as? NSNumber
  27.                 self.location = atm["location"] as? PFGeoPoint
  28.                 self.description = atm["description"] as? NSString
  29.                 }
  30.             }
  31.         }
  32.  
  33.     }
  34.        
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement