title: Swift Popover Anchor
body: <p>I'm trying to show a popover over an image and I'm failing trying to point the anchor point to my image border (the image is the info icon).
  Here is my code:</p>
  
  <p><strong>The button action:</strong></p>
  
  <pre><code>@IBAction func infoTapped(_ sender: AnyObject) {
          self.performSegue(withIdentifier: "InfoPopOver", sender: nil)
      }
  </code></pre>
  
  <p><strong>And the prepare for segue:</strong></p>
  
  <pre><code>extension AddExpenseViewController: UIPopoverPresentationControllerDelegate {
      func adaptivePresentationStyle(for controller: UIPresentationController) -&gt; UIModalPresentationStyle {
          return UIModalPresentationStyle.none
      }
      override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
          if segue.identifier == "InfoPopOver" {
              if let vctr = segue.destination as? MyPopOverViewController {
                  vctr.modalPresentationStyle = .popover
                  vctr.popoverPresentationController?.delegate = self
                  vctr.popoverPresentationController?.sourceView = self.view
                  vctr.popoverPresentationController?.sourceRect = infoIcon.frame
  
              }
          }
      }
  
  }
  
  class MyPopOverViewController: UIViewController {
      override func viewDidLoad() {
          super.viewDidLoad()
          self.preferredContentSize = CGSize(width: 185, height: 80)
  
      }
  }
  </code></pre>
  
  <p>Here a couple of screenshots:
  <a href="https://i.stack.imgur.com/UJ0Fh.png" rel="nofollow noreferrer">Main View</a>
  <a href="https://i.stack.imgur.com/uwEMP.png" rel="nofollow noreferrer">Popover shown</a></p>
  
  <p>The best I got was setting the coordinates manually, but it doesn't fit neither every screen type...</p>