I am in a quandary about how to position the popup on the supplied screenshot to point to the word tapped. The word in the text view is the one that is grey. I would show some code but I have none that is relevant other than the code that handles the tap.
Here is some code:
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
if(segue.identifier == "popOverSegue") {
let destinationViewController: PopoverViewController = segue.destination as! PopoverViewController
destinationViewController.modalPresentationStyle = UIModalPresentationStyle.popover
destinationViewController.popoverPresentationController!.delegate = self
destinationViewController.popoverPresentationController?.permittedArrowDirections = .down
destinationViewController.tappedWord = tappedWord
destinationViewController.definitionText = "This is a test description"
let x = meaningText.frame.minX
let y = meaningText.frame.minY
destinationViewController.popupOrigin = CGPoint(x: x + pointOfTap.x,y: y + pointOfTap.y)
destinationViewController.popupSize = CGSize(width: 200, height: 200)
debugPrint(meaningText)
}
}