Flip value because it kept going true when nothing changed

This commit is contained in:
Kevin G Christiano 2020-03-24 11:01:08 -04:00
parent f0870bda5d
commit a1d43e338c
2 changed files with 9 additions and 8 deletions

View File

@ -27,7 +27,7 @@ import UIKit
public var formValidator: FormValidator?
public var needsUpdateUI = true
public var needsUpdateUI = false
private var observingForResponses = false
private var initialLoadFinished = false
private var previousScreenSize = CGSize.zero
@ -36,7 +36,7 @@ import UIKit
/// Checks if the screen width has changed
open func screenSizeChanged() -> Bool {
return MVMCoreGetterUtility.cgfequalwiththreshold(previousScreenSize.width, view.bounds.size.width, 0.1)
return !MVMCoreGetterUtility.cgfequalwiththreshold(previousScreenSize.width, view.bounds.size.width, 0.1)
}
// MARK: - Response handling
@ -276,17 +276,18 @@ import UIKit
open override func viewDidLayoutSubviews() {
// Add to fix a constraint bug where the width is zero and things get messed up.
guard isViewLoaded,
view.bounds.width > 1 else {
super.viewDidLayoutSubviews()
return
guard isViewLoaded, view.bounds.width > 1 else {
super.viewDidLayoutSubviews()
return
}
if needsUpdateUI || screenSizeChanged() {
updateViews()
needsUpdateUI = false
}
previousScreenSize = view.bounds.size;
super.viewDidLayoutSubviews()
}

View File

@ -273,9 +273,9 @@ import UIKit
if moleculeLayoutUpdated || heightChanged {
delegateObject?.moleculeDelegate?.moleculeLayoutUpdated(self)
setNeedsDisplay()
}
setNeedsDisplay()
layoutIfNeeded()
}
}