layout
layout copied to clipboard
iOS 13, Xcode 11 infinite loop related to the swizzled layoutSubviews()
We have a custom view and we overrode layoutSubviews() as recommended:
open override func layoutSubviews() {
super.layoutSubviews()
// Ensure layout is updated after screen rotation, etc
self.layoutNode?.view.frame = self.bounds
// Update frame to match layout
self.frame.size = self.intrinsicContentSize
}
and it would appear the app is stuck in some kind of infinite loop, our custom view layoutSubviews () and layout_layoutSubviews() being called forever and blocking the main thread
extension UIView {
fileprivate static func _swizzle() {
guard !viewSwizzled else { return }
replace(#selector(layoutSubviews), of: self, with: #selector(layout_layoutSubviews))
viewSwizzled = true
}
// Swizzled layoutSubviews implementation
@objc private func layout_layoutSubviews() {
layout_layoutSubviews()
_layoutNode?.updateLayout()
}
}
Same here! Endless loop on iOS 13.1.1 with Layout.
Just on loading the first VC using self.loadLayout()
the app is running in endless loop.
![Bildschirmfoto 2019-10-01 um 09 01 41](https://user-images.githubusercontent.com/29303125/65940962-290d2f00-e42a-11e9-9e88-9384294c6a81.png)
@matape I got the same issue on 0.6.36. Updating to 0.6.38 fixed this issue.
@sebastienwindal @matape can you provide a larger code sample? I'm having trouble reproducing the problem.