mike vorisis mike vorisis - 1 month ago 20
Swift Question

How to manage SWRevealViewController with button

I tried to implemented the SWRevealViewController to my project, but I want to do it with a button and all documentations I found are for barbuttonitems that have this code:

detailButton.target = revealViewController()
detailButton.action = #selector(SWRevealViewController.revealToggle(_:))

How can I do it with a simple button?


do like

let revealViewController = self.revealViewController()
var settingsButton = UIButton(type: .custom)
settingsButton.setImage(UIImage(named: "settings_icon")!, for: .normal)
settingsButton.addTarget(revealViewController, action: #selector(SWRevealViewController.revealToggle(_:)), for: .touchUpInside)