In loginVC i have created a button on clicking it, it goes to main tabbarcontroller thru segue like this..
@IBAction func btnLoginPressed(sender: AnyObject) {
self.performSegueWithIdentifier("logintoMain", sender: self)
}
is succesfully goes to tabbarmainVC but after that the swRevealviewController is getting nil.. and the sliding not working here. why?
class MaintabbarController: UIViewController{
@IBOutlet weak var slideBtn: UIBarButtonItem!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
if self.revealViewController() != nil{
slideBtn.target = self.revealViewController()
slideBtn.action = #selector(SWRevealViewController.revealToggle(_:))
self.view.addGestureRecognizer(self.revealViewController().panGestureRecognizer())
}
}
Edited
I have tried this code also on login button click to go to the mainTabbarvc. Now its working fine . Actually i have to push the revealviewController than only it will be active..
@IBAction func btnLoginPressed(sender: AnyObject) {
let sb = UIStoryboard(name: "Main", bundle: nil)
let vc =sb.instantiateViewControllerWithIdentifier("yourtabbarvcidentifier") as! UITabBarController
vc.selectedIndex = 0
// self.presentViewController(vc, animated: true, completion: nil)
self.revealViewController().pushFrontViewController(vc, animated: true)
}