UIPopOverViewController in swift is writen in swift 3.1 and Use the xcode Version 8.3.2.
For use this import the PopOverViewController folder into your project.
For using this file create the instance of PopOverViewC class and inherit the UIPopoverPresentationControllerDelegate :

  var itemPopVC = PopOverViewC()

Add below line of code in your Tapable button function for set the properties of UIPopOverViewController, change the properties

self.itemPopVC.modalPresentationStyle = .popover
self.itemPopVC.popoverPresentationController?.barButtonItem = self.navigationItem.rightBarButtonItem
self.itemPopVC.popoverPresentationController?.permittedArrowDirections = .unknown
self.itemPopVC.popoverPresentationController?.delegate = self
self.itemPopVC.popoverPresentationController?.backgroundColor = UIColor.red
self.itemPopVC.popoverPresentationController?.popoverLayoutMargins = UIEdgeInsets.init(top: 50.0, left: 100.0, bottom: 0.0, right: 0.0)
self.present(self.itemPopVC, animated: true, completion: { _ in })

self.itemPopVC.popoverPresentationController?.barButtonItem in this pass the tapable bar button, and there is sourceRect also in which
we pass the rect of any button.

For Get the didSelectCell call back add the notification and add these functions:

func tableDidSelected(_ notification: Notification)
    var indexpath: IndexPath? = (notification.object as? IndexPath)
    self.itemPopVC.dismiss(animated: true, completion: { _ in })
  func popoverPresentationControllerShouldDismissPopover(_ popoverPresentationController: UIPopoverPresentationController) -> Bool
    return true
  func adaptivePresentationStyle(for controller: UIPresentationController) -> UIModalPresentationStyle
    return UIModalPresentationStyle.none

Related Post

New Tools for 64-bit Support in Xcode 9.3   New Tools for 64-bit Support in Xcode 9.3 The last macOS release to support 32-bit apps without compromise is macOS High Sierra. Make sure fu...
Strings String can be represented as a single-dimensional character type array. Strings in C are group of characters, digits, and symbols enclosed in quotatio...
Loop Control Statement Loop control statements are used when a section of code may either be executed a fixed number of times. C gives you a choice of three types of loop st...
Introduction to JVM Introduction to JVM JVM stands for Java Virtual Machine. It works as an engine that derives the Java Code. The JVM does not understand Java ty...
Loops in java Loops in JAVA Loops are used to execute a set of statements repeatedly until a particular condition is satisfied. Loop is used in programming ...
Variables Variables A variable is a named location in memory that is used to hold a value that can be modified by the program. All variable must be declared be...

Write A Comment