Created
February 21, 2018 02:08
-
-
Save efremidze/88dc093d41efb3cf85192ee382c694d0 to your computer and use it in GitHub Desktop.
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 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