iOS 9 introduced a new way of creating Popovers on iPhone. Instead of using the UIPopoverController class we can now use the UIPopoverPresentationController.

Presenting a Popover from a Bar Button Item

We need a content View controller that's displayed inside the Popover and also need to set properties for contentSize, modalPresentationStyle and sourceView.

Action for right BarButtonItem-

 @IBAction func addEntity(_ sender: UIBarButtonItem) {
 let vc: TableViewController =...

Read complete blog post