SwiftUserManager for iOS

A usermanager written in swift 3.0 saves you from hassle of saving your active user session.

** Call api and give the json to MOProfile to make a model and call UserManager.setCurrentUser(model)

let profileFromServer = [
    "firstName" : "Zeeshan",
    "userName" : "xeieshan",
    "lastName" : "Haider",
    "id" : 1,
    "email" : "[email protected]"
    ] as [String : Any]
let profileModel : MOProfile = MOProfile(profileFromServer as Dictionary<String, AnyObject>)
UserManager.setCurrentUser(newCurrentUser: profileModel)

**Now you can use this**
debugPrint((UserManager.currentUser?.firstName)! as String)

**To logout simply call**
UserManager.logOutUserAndClearToken()

**If you want to see if your user is logged (for autologin)**
 if UserManager.currentUser != nil {
 // Take to App
 } else {
 // Take to Login
 }
Sponsored with ❤️ by Instabug
Instabug: Understand how your app is doing with real-time contextual insights from your users
Instabug

Get all the logs you need and fix bugs, crashes, and other issues in minutes instead of days. With Instabug you will automatically receive device data, network logs, and reproduction steps with every bug and crash report. It only takes a line of code to integrate and is perfect for teams that are now working remotely. See more detailed features comparison and try Instabug for free here.