programmatically tap UIButton swift
<p><strong>Direct Question:</strong></p>

<p>How do you programmatically tap a UIButton in Swift 2.0?</p>

<p>Example: <code>UIButton.tap()</code></p>

<p><strong>Explanation as to why i cannot call button click function directly:</strong></p>

<p>I am currently using AKSwiftSlideMenu (<a href="https://github.com/ashishkakkad8/AKSwiftSlideMenu" rel="noreferrer">https://github.com/ashishkakkad8/AKSwiftSlideMenu</a>) (<a href="https://www.cocoacontrols.com/controls/akswiftslidemenu" rel="noreferrer">https://www.cocoacontrols.com/controls/akswiftslidemenu</a>) to create a menu. This is accomplished by adding the menu view controller to the main view controller as a child view.</p>

<pre><code>let menuVC : BackTableViewController = self.storyboard!.instantiateViewControllerWithIdentifier("backTableViewController") as! BackTableViewController
    menuVC.btnMenu = sender

    self.view.addSubview(menuVC.view)
    self.addChildViewController(menuVC)
</code></pre>

<p>As you can see, the <code>btnMenu</code>, which is a <code>UIButton</code>, is being passed to the <code>menuVC</code>. Having the same button on both view controllers allows for a single <code>onSlideMenuButtonPressed(sender : UIButton)</code> function in the home view controller  to handle the presentation of the <code>menuVC</code>. One of the options in the menu i am creating is the "Log out" button that presents a <code>UIAlertViewController</code> which ask if the user wants to sign out. The following is my code for my "Yes" button handler in the <code>menuVC</code>:</p>

<pre><code>        logOutAlert.addAction(UIAlertAction(title:"Yes", style: .Default, handler:  { action in 
        self.btnMenu.touchInside
        CURRENT_USER.unauth()
        NSUserDefaults.standardUserDefaults().setValue(nil, forKey: "uid")
        print("User logged out")
        CurrentUser.checkIfUserIsLoggedIn()
    }))
</code></pre>

<p>I am attempting to tap the button with the <code>touchInside</code> method (which is not right of course) in order to dismiss the <code>menuVC</code> . Is there such thing as a <code>UIButton.tap()</code> equivalent or a way to access the <code>btnMenu</code> <code>onSlideMenuButtonPressed(sender : UIButton)</code> function? </p>

<p><strong>Side Note:</strong>
I played with the idea of creating a homeViewControllerDelegate object for the <code>menuVC</code> to call the <code>onSlideMenuButtonPressed(sender : UIButton)</code> directly, which might work, but it seems like a round about way seeing as the <code>btnMenu</code> already has a reference to that function.</p>