iOS: Problem of display the popover border in the iOS13
As mentioned in this answer it is a new feature of iOS 13 that UIPopovers include the arrows in their content views. You should use the safe area to properly react to this change.
You cannot use the safe area to react to this change. My feeling is that this is a bug in iOS 13 and I'll explain why...
When you have a situation where you use UIPopoverArrowDirectionAny you will see that the problem only exists when the arrow is at the top or left of the popover and not when the arrow appears at the right or the bottom of the popover. If you make adjustments in your code to compensate it will work if you use UIPopoverArrowDirectionUp or UIPopoverArrowDirectionLeft but will not display correctly using that adjustment when using UIPopoverArrowDirectionAny and the popup appears above or to the right of the target rectangle.
I think it is an iOS bug in the iOS13 version, and I advice you to do your own popover by using that git project:
DDPopoverBackgroundView
and using this for displaying the popover:
// Popover
_popoverController = UIPopoverController(contentViewController: navController)
_popoverController?.delegate = self
let rect = slotCollectionView.cellForItem(at: indexPath)!.frame
self._popoverController!.contentSize = CGSize(width: 350, height: 600)
self._popoverController!.backgroundViewClass = DDPopoverBackgroundView.self
self._popoverController!.backgroundColor = UIColor.init(rgb: Int(quaternaryColorHexa)) //arrow color
OperationQueue.main.addOperation({
self._popoverController?.present(from: rect, in: self.slotCollectionView, permittedArrowDirections: UIPopoverArrowDirection.any, animated: true)
})
enjoy ! ;-)