I'm trying to add a tap and pan gesture recognizer to my RevealViewController() and I'm getting a Value of optional type 'UIGestureRecognizer?' must be unwrapped. How should I unwrap this?
// My App
// Main.storyboard
// HomeVC
override func viewDidLoad() {
super.viewDidLoad()
menuBtn.addTarget(self.revealViewController(), action: #selector(SWRevealViewController.revealToggle(_:)), for: .touchUpInside)
if self.revealViewController() != nil{
self.view.addGestureRecognizer(self.revealViewController()!.tapGestureRecognizer())
self.view.addGestureRecognizer(self.revealViewController()!.panGestureRecognizer())
}
}



This question is vague and you didn't provide a lot of context so excuse the answer if it's not exactly what you need but why not do a simple
if letstatement to gracefully unwrap it.