ensure updateView() can't be called until setup() is run

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2024-08-09 11:21:51 -05:00
parent 8723cfa5c3
commit 317cf89fb6
6 changed files with 12 additions and 0 deletions

View File

@ -81,7 +81,9 @@ open class Control: UIControl, ViewProtocol, UserInfoable, Clickable {
open func initialSetup() {
if !initialSetupPerformed {
initialSetupPerformed = true
shouldUpdateView = false
setup()
shouldUpdateView = true
setNeedsUpdate()
}
}

View File

@ -60,7 +60,9 @@ open class View: UIView, ViewProtocol, UserInfoable {
open func initialSetup() {
if !initialSetupPerformed {
initialSetupPerformed = true
shouldUpdateView = false
setup()
shouldUpdateView = true
setNeedsUpdate()
}
}

View File

@ -103,7 +103,9 @@ open class ButtonBase: UIButton, ViewProtocol, UserInfoable, Clickable {
backgroundColor = .clear
translatesAutoresizingMaskIntoConstraints = false
accessibilityCustomActions = []
shouldUpdateView = false
setup()
shouldUpdateView = true
setNeedsUpdate()
}
}

View File

@ -209,7 +209,9 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
isAccessibilityElement = true
accessibilityTraits = .staticText
textAlignment = .left
shouldUpdateView = false
setup()
shouldUpdateView = true
setNeedsUpdate()
}
}

View File

@ -105,7 +105,9 @@ open class TextField: UITextField, ViewProtocol, Errorable {
translatesAutoresizingMaskIntoConstraints = false
setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
clipsToBounds = true
shouldUpdateView = false
setup()
shouldUpdateView = true
setNeedsUpdate()
}
}

View File

@ -112,7 +112,9 @@ open class TextView: UITextView, ViewProtocol, Errorable {
initialSetupPerformed = true
backgroundColor = .clear
translatesAutoresizingMaskIntoConstraints = false
shouldUpdateView = false
setup()
shouldUpdateView = true
setNeedsUpdate()
}
}