Skip to content

Instantly share code, notes, and snippets.

@efremidze
Created February 21, 2018 02:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save efremidze/88dc093d41efb3cf85192ee382c694d0 to your computer and use it in GitHub Desktop.
Save efremidze/88dc093d41efb3cf85192ee382c694d0 to your computer and use it in GitHub Desktop.
extension UIView {
func hasSuperview(_ superview: UIView) -> Bool {
var view = self
while let _view = view.superview {
defer { view = _view }
if _view === superview {
return true
}
}
return false
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment