Skip to content

Instantly share code, notes, and snippets.

@michaeleisel
Last active August 10, 2021 06:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaeleisel/39f53b1f640f6533e4f0754b72ed862f to your computer and use it in GitHub Desktop.
Save michaeleisel/39f53b1f640f6533e4f0754b72ed862f to your computer and use it in GitHub Desktop.
func iterateOverViewAndSubviews(view: UIView, block: (UIView) -> Void) {
block(view)
for subview in view.subviews {
iterateOverViewAndSubviews(view: subview, block: block)
}
}
func runCheckers() {
if let keyWindow = UIApplication.shared.keyWindow {
iterateOverViewAndSubviews(view: keyWindow) { (view) in
if checkersFail() {
fatalError()
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment