title: Implement PopOver in Swift
body: <p>I want to show a popup menu and without using nib.I dont like using nib since the headache to implement delegate for a simple functionality. I succeeded using <code>modalPresentationStyle</code> as a <code>Popover</code> to show <code>ViewController</code> as a <code>Popover</code> and it works fine with the below code.</p>
  
  <pre><code>import UIKit
  
  class ViewController: UIViewController {
  
      @IBOutlet weak var btnShowPopOver: UIButton!
      override func viewDidLoad() {
          super.viewDidLoad()
          // Do any additional setup after loading the view, typically from a nib.
      }
  
      override func didReceiveMemoryWarning() {
          super.didReceiveMemoryWarning()
          // Dispose of any resources that can be recreated.
      }
  
  
      @IBAction func showPopUP(sender: AnyObject) {
  
          let storyboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
          let popVC = storyboard.instantiateViewControllerWithIdentifier("pop")as! PopViewController
          popVC.modalPresentationStyle = UIModalPresentationStyle.Popover
          popVC.preferredContentSize = CGSizeMake(320, 240)
          popVC.popoverPresentationController!.delegate = self
  
  
          let popOverController = popVC.popoverPresentationController
          popOverController!.sourceView = sender as! UIView // where to stick the bar item in which view
          popOverController!.sourceRect = CGRectMake(70,30, 0, 0) //where to stick the bar
  
          popOverController?.permittedArrowDirections = nil
          self.presentViewController(popVC, animated: true, completion: nil)
  
  
      }
  
  
  
  
  }
  
  
  extension ViewController :UIPopoverPresentationControllerDelegate {
  
      func adaptivePresentationStyleForPresentationController(PC: UIPresentationController) -&gt; UIModalPresentationStyle {
          return UIModalPresentationStyle.None
      }
  
  
      func popoverPresentationControllerDidDismissPopover(popoverPresentationController: UIPopoverPresentationController) {
  
          var controller = popoverPresentationController.presentedViewController as! PopViewController
           println(" this is data from pop view controller \(controller.textField.text)")
  
      }
  
  
  }
  </code></pre>
  
  <p><a href="https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIPopoverController_class/" rel="nofollow">Apple doc</a> says </p>
  
  <blockquote>
    <p>Popover controllers are for use exclusively on iPad devices.
    Attempting to create one on other devices results in an exception.</p>
  </blockquote>
  
  <p>I tested this on real device iphone-6 and its working fine..I am loving this <code>Popover</code>.</p>
  
  <p><strong>Should i use <code>Popover</code> or not as per the apple documentation?Since its working fine in iphone,will my app get rejected for using it later?</strong></p>