Runtime-based setup for tracking autolayout feedback loops
LayoutLoopHunter
The library helps to catch the OOMs caused by Autolayout Feedback Loop by replicating the behavior of UIViewLayoutFeedbackLoopDebuggingThreshold in the live code.
This is the final result of the runtime tutorial on AppCoda.
Installation
LayoutLoopHunter is available through CocoaPods. To install
it, simply add the following line to your Podfile:
pod 'LayoutLoopHunter'
and run pod install
in your terminal.
Alternatively, you can manually add the files from the LayoutLoopHunter
directory to your project.
Usage
Please use the setUp
method to set up tracking for your UIView:
static func setUp(for view: UIView, threshold: Int = 100, onLoop: @escaping () -> ())
The callback will be called when the layoutSubviews()
method is called a certain amount of times in a single run loop.
Example
LayoutLoopHunter.setUp(for: view) {
print("Hello, world")
}