Detecting overlap of NSView/UIViews

Hi,

I'm trying to figure out how we can detect if an NSView/UIView overlaps another one. This includes artefacts like NSButton/UIButton that inherits from NSView/UIView. The use case is that, if I drag around or resize a View and it covers/overlaps another one, I want to adjust the size of the view being overlapped.

Thanks!

Detecting overlap of NSView/UIViews
 
 
Q