Poptips can appear off screen
Thanks for the great framework!
Wanted to report what seems like a bug with a similar behavior to #133.

In the image the tooltip is being presented from the superview of the people button it is pointing at but it ends up being positioned partially off screen.
The full config for the popTip is
popTip.cornerRadius = 8
popTip.textColor = UIColor.black
popTip.bubbleColor = UIColor.white
popTip.borderColor = UIColor.white
popTip.shadowColor = UIColor.black
popTip.shadowRadius = 10
popTip.shadowOffset = CGSize(width: 0, height: 4)
popTip.shadowOpacity = 0.25
popTip.arrowSize = CGSize(width: 18, height: 7)
popTip.edgeMargin = -3
popTip.padding = 16
popTip.shouldDismissOnTapOutside = true
popTip.shouldDismissOnSwipeOutside = true
popTip.shouldDismissOnTap = true
popTip.constrainInContainerView = false
Would it make sense to have a property like constrainOnScreen that is similar to constrainInContainerView except that a check is made to make sure that he tooltip is on screen?
Note that I increased edgeMargin to 20 and it had no effect in this case. Another side note is that I set edgeMargin to -3 since if a tooltip is close to the top of the screen and the arrowSize is larger then the tooltip arrow does not render correctly but that is a separate issue I can file.
In the example above the superview is fully on the screen but because of constrainInContainerView = false the tooltip is allowed to be laid out off the screen.
Also note that the tooltip could be presented from the keywindow or a top level view controller to avoid being offscreen since the window is full screen and constrainInContainerView can be set to true, but then if the button (or whatever the tooltip is pointing at) moves then the tooltip is just left floating pointing at nothing. Keeping the tooltip presented from a view close in the view hierarchy avoids a lot of corner case handling for when views move.
I ended adding a constrainToView property in the referenced PR to handle the case above: There is a view that I want to target and I want to present the tooltip from the target view's superview so they stay more closely attached, but I also don't want the tooltip to appear off screen.
To use this property to limit the tooltip to the screen you can do something like:
popTip.constrainToView = UIApplication.shared.keyWindow?.rootViewController?.view
Since the rootViewController should get orientation events as well and end up with the correct dimensions.