Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. -save id to the user default by using login button
  2. let id = UserDefaults.standard
  3. id.set(data.id , forKey : "ID")
  4. id.synchronize
  5. - using user id with this code in diferent pages
  6. let user_id = UserDefaults.standard.integer(forKey : "ID")
  7. - delete id from user default by using logout button
  8. UserDefaults.standard.removeObject(forKey : "ID")
  9. userDefaults.synchronize
  10. let appDelegate = UIApplication.shared.delegate as! AppDelegate
  11. let mainScreen = UIStoryboard.init(name : "Main" , bundle : nil).instantiateViewController(withIdentifier :"BG")
  12. appDelegate.window?.rootViewController = mainScreen
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement