Log content view size warning only for debug builds

This commit is contained in:
Drew Olbrich
2019-02-05 08:32:26 -08:00
parent 68233ec332
commit 9244d52a4a
+2
View File
@@ -231,6 +231,7 @@ public class ScrollingContentViewManager: KeyboardObservering, ScrollViewBounceC
return
}
#if DEBUG
let contentViewSystemLayoutSize = contentView.systemLayoutSizeFitting(UIView.layoutFittingCompressedSize)
let contentViewIntrinsicContentSize = contentView.intrinsicContentSize
let widthIsDefined = contentViewSystemLayoutSize.width > 0 || contentViewIntrinsicContentSize.width != UIView.noIntrinsicMetric
@@ -241,6 +242,7 @@ public class ScrollingContentViewManager: KeyboardObservering, ScrollViewBounceC
if !widthIsDefined && !heightIsDefined {
NSLog("Warning: The content view's size is undefined. You must have an unbroken chain of constraints and views stretching across at least one axis of the content view or the content view's intrinsic content size must be defined.")
}
#endif
if contentView.superview == nil {
addScrollViewToHostViewControllerRootView()