Created
December 6, 2017 18:45
-
-
Save regnerjr/3b46e538a98b86549555eadef30615dd to your computer and use it in GitHub Desktop.
A UIView Extension to help debug auto layout issues
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 exerciseAmbiguityInLayoutRepeatedly(_ recursive: Bool) { | |
#if DEBUG | |
if hasAmbiguousLayout { | |
Timer.scheduledTimer(timeInterval: 0.5, | |
target: self, | |
selector: #selector(exerciseAmbiguityInLayout), | |
userInfo: nil, | |
repeats: true) | |
} | |
if recursive { | |
for subview in subviews { | |
subview.exerciseAmbiguityInLayoutRepeatedly(true) | |
} | |
} | |
#endif | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment