Skip to content

Instantly share code, notes, and snippets.

@efremidze
Created February 21, 2018 02:08
Show Gist options
  • 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