State Preservation and Restoration issue in iOS using MMDrawer State Preservation and Restoration issue in iOS using MMDrawer objective-c objective-c

State Preservation and Restoration issue in iOS using MMDrawer


You can easily do state preservation by storing states in NSUUserDefaultDo the following steps:1.When you launch the app first time.

  {      UserDefaults.standard.set("0", forKey: "state")     UserDefaults.standard.synchronize()   }

2.When you kill the app then store the state

   {                UserDefaults.standard.set("1", forKey: "state")             UserDefaults.standard.synchronize()        }3. When you relaunch the app get the state ,setup the drawer and move to particular controller using it's navigation controller. if let state = UserDefaults.standard.object(forKey: "state") as? String{         switch state{                case "0":                        //Do setup for MMDrawer for center ,left and right view                        break                case "1":                        //Do setup for MMDrawer for center ,left and right view                break                 default:                        break                    }                }