Created
December 20, 2018 20:55
-
-
Save commanda/ad376eb4de4c3a6044a5710139c40500 to your computer and use it in GitHub Desktop.
get all subviews of a UIView, recursively
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 { | |
var allSubviews: [UIView] { | |
return self.subviews.reduce(into: [self]) { array, subview in | |
array += subview.allSubviews | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment