Guest User

Untitled

a guest
Jun 9th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. // == JSON Login Signature
  2. static func loginUser(_ username:String, password:String, completion: @escaping (_ response: Int) -> Void)
  3. {
  4. ...
  5. }
  6. // ==== UIViewController calling it
  7.  
  8. APIManager.loginUser(tUsername.text!, password: tPassword.text!) { [weak self] (respStatus: Int) in
  9.  
  10. if(respStatus == 200) {
  11. APIManager.shared.currentUserState = APIManager.UserState.LoggedIn
  12. DispatchQueue.main.async {
  13. self?.newView()
  14. }
  15.  
  16. } else {
  17. APIManager.shared.currentUserState = APIManager.UserState.LoggedOut
  18. }
  19. }
Add Comment
Please, Sign In to add comment