ios - How to instantiate SWRevealController programmatically with the value? -


my goal instantiate swrevealcontroller programmatically seems like, every time crash

here's code

    if let vc = self.storyboard?.instantiateviewcontroller(withidentifier: "onjobviewcontrollerid") as? onjobviewcontroller {         var firstname = "aegon"        vc.drivername.text = firstname           let navcontroller = uinavigationcontroller(rootviewcontroller: vc)         navcontroller.setviewcontrollers([vc], animated:true)         self.revealviewcontroller().setfront(navcontroller, animated: true)     } 

onjobviewcontroller viewcontroller

always crash in here.

enter image description here

for clarity here storyboard

the main view controller

enter image description here

setfront segue

enter image description here

setrear segue

enter image description here

try :-

  let frontnavigationcontroller:uinavigationcontroller let rearnavigationcontroller:uinavigationcontroller let revealcontroller = swrevealviewcontroller() var mainrevealcontroller = swrevealviewcontroller() let objstoryboardmain                   = uistoryboard(name: "main",  bundle: nil)  let sidebar = objstoryboardmain.instantiateviewcontroller(withidentifier:  "viewsidemenu")as! sidemenuviewcontroller  let homepage = objstoryboardmain.instantiateviewcontroller(withidentifier: "viewhomepage") as! homepageviewcontroller  frontnavigationcontroller =  uinavigationcontroller(rootviewcontroller: homepage) rearnavigationcontroller = uinavigationcontroller(rootviewcontroller: sidebar)  revealcontroller.frontviewcontroller = frontnavigationcontroller revealcontroller.rearviewcontroller = rearnavigationcontroller revealcontroller.delegate = self mainrevealcontroller  = revealcontroller  self.window?.rootviewcontroller = mainrevealcontroller     self.window?.makekeyandvisible() 

reference:-

 https://github.com/john-lluch/swrevealviewcontroller 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

javascript - How to bind ViewModel Store to View? -

javascript - Solution fails to pass one test with large inputs? -