title: Programmatically Create Popover Menu Swift
body: <p>Desired Popover Output:</p>
  
  <p><a href="https://i.stack.imgur.com/FPIhQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FPIhQ.png" alt="enter image description here"></a></p>
  
  <p>I tried following the tutorial <a href="http://gracefullycoded.com/display-a-popover-in-swift/" rel="nofollow noreferrer">here</a>... However, I can't seem to get this working</p>
  
  <p>Current Code: </p>
  
  <pre><code>  func adaptivePresentationStyleForPresentationController(
      controller: UIPresentationController!) -&gt; UIModalPresentationStyle {
          return .None
  }
  
  @IBAction func UploadClicked(sender: AnyObject)
  {
  
      let menuViewController =  MenuViewController()
      menuViewController.modalPresentationStyle = .Popover
      menuViewController.preferredContentSize = CGSizeMake(50, 100)
  
      let popoverMenuViewController = menuViewController.popoverPresentationController
      popoverMenuViewController?.permittedArrowDirections = .Any
      popoverMenuViewController?.delegate = self
      popoverMenuViewController?.sourceView = sender
      popoverMenuViewController?.sourceRect = CGRect(
          x: location.x,
          y: location.y,
          width: 1,
          height: 1)
      presentViewController(
          menuViewController,
          animated: true,
          completion: nil)
  }
  </code></pre>
  
  <blockquote>
    <p>Use of unresolved identifier menuviewcontroller</p>
    
    <p>Use of unresolved identifier location</p>
  </blockquote>