Skip to content

Instantly share code, notes, and snippets.

@commanda
Created December 20, 2018 20:55
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 commanda/ad376eb4de4c3a6044a5710139c40500 to your computer and use it in GitHub Desktop.
Save commanda/ad376eb4de4c3a6044a5710139c40500 to your computer and use it in GitHub Desktop.
get all subviews of a UIView, recursively
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