I need to create a new popover view as the anchor is not visible in Interface Builder during compile time.
According to this post, implementing the delegate method will
It seems moving the line presentViewController(contentView, animated: true, completion: nil)
to the end of the function would fix the issue.
let contentView =
PLMainNavigationManager.sharedInstance.storyboard.instantiateViewControllerWithIdentifier("PLSearchVCID") as! PLSearchVC
contentView.modalPresentationStyle = UIModalPresentationStyle.Popover
contentView.preferredContentSize = CGSizeMake(400.0, 500.0)
var _popoverPresentationController = contentView.popoverPresentationController!
_popoverPresentationController.delegate = self
_popoverPresentationController.permittedArrowDirections = UIPopoverArrowDirection.Any
_popoverPresentationController.sourceView = self.view
_popoverPresentationController.sourceRect = CGRectMake(-30, -280, 320, 400)
PLMainNavigationManager.sharedInstance.navigationController?.presentViewController(contentView, animated: true, completion: nil)