I am quite new in iOS development and looking for your advice.
I am looking at one project at GitHub.
I would like to add some functionality. I would like to add a button which will show SideMenu and possibly hide it.
The sideMenu is an instance of class SideMenu and it is created in ViewDidLoad
method. How to call sideMenu.toggleMenu(true) method using button's action method.
class HomeViewController: UIViewController, SideMenuDelegate {
@IBAction func menuButtonTapped(_ sender: Any) {
sideMenu.toggleMenu(open: true)
}
override func viewDidLoad() {
super.viewDidLoad()
let sideMenu = SideMenu(menuWidth: 200 , menuItemTitles: ["", "", "Profile", "Settings", "Restaurant"], parentViewController: vviewController)
sideMenu.menuDelegate = self
}
My button is created using storyboard that is why I can't add it is action method into viewDidLoad
.
Theoretically I could create button programmatically in ViewDidLoad. Is it the only solution?