title: Call generic controller
body: <p>I have class <code>Menu</code> that is 'UICollectionView'. In that class I have a function called <code>showMenu()</code></p>
  
  <p>In the show menu function I finish everything and then I need to navigate to the controller based on the actions (Edit, ShowAll, etc). I try to do this by calling controller variable in the class. Like this: self.controller.navigateToAction(action: action)</p>
  
  <pre><code>class Menu: NSObject, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout {
  
      weak var controller: ViewController? //can we define this as generic?
  
      func showMenu(action: Action) {
        // some logic        
        // then I need to navigate to the function in the controller
  
        self.controller?.navigateToAction(action: action)
     }
  }
  </code></pre>
  
  <p>From my controller I call this function as: (notice menu.controller = self). Please note I will have many viewcontrollers (homecontroller, summarycontroller, etc.)</p>
  
  <pre><code>class HomeController: UIViewController {
  
  lazy var menuLauncher: Menu = {
          let menu = Menu()
          menu.controller = self
          menu.actions =  {
              return [
                  Action(name: .Edit, imageName: "edit"),
                  Action(name: .ViewAll, imageName: "view-all"),
                  Action(name: .Cancel, imageName: "cancel")
              ]}()
  
          return menu
      }()
  
     func navigateToAction(action: action) {
  
      // based on action navigate to a certain viewcontroller(edit, viewall, etc)
      }
  
      // Cell delegate functions on button click    
      func launchSlider() {
           menuLauncher.showMenu()
      }
  }
  </code></pre>
  
  <p>Is there a way in the Menu class I can define generic viewcontroller which I can define in the 'menuLancher' initialization, so I can pass that information to the Menu class, showMenu function from where I will call back the function in the calling ViewController?</p>
  
  <p>I would need to access <code>navigateToAction</code> function in the calling <code>ViewController</code>.</p>