Created
June 26, 2019 06:20
-
-
Save fitsyu/7fb48fcaf0983ef6348af618214efbfe to your computer and use it in GitHub Desktop.
Detect UIView out of screen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension UIView { | |
func origin(in view: UIView) -> CGPoint { | |
return view.convert(CGPoint.zero, from: self) | |
} | |
func isVisible(in view: UIView) -> Bool { | |
return view.frame.contains(self.origin(in: view)) | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment