SHARE
TWEET

Untitled

a guest Feb 4th, 2016 116 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import UIKit
  2.  
  3. class API : NSObject {
  4.    
  5.     class var sharedInstance: API {
  6.         struct Static {
  7.             static var instance: API?
  8.             static var token: dispatch_once_t = 0
  9.         }
  10.        
  11.         dispatch_once(&Static.token) {
  12.             Static.instance = API()
  13.         }
  14.        
  15.         return Static.instance!
  16.     }
  17.  
  18.     func login(username: String, password: String, success: (BackendlessUser) -> Void, failure: (Int, String) -> Void) {
  19.         let backendless = Backendless.sharedInstance()
  20.         backendless.userService.login(username, password: password,
  21.             response: { (user: BackendlessUser!) -> () in
  22.                 success(user)
  23.             },
  24.             error: { (fault: Fault!) -> () in
  25.                
  26.             }
  27.         )
  28.     }
  29.  
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top