diff --git a/VDS/BaseClasses/Control.swift b/VDS/BaseClasses/Control.swift index 0dcaa3f1..ad138db9 100644 --- a/VDS/BaseClasses/Control.swift +++ b/VDS/BaseClasses/Control.swift @@ -78,7 +78,7 @@ open class Control: UIControl, ViewProtocol, UserInfoable, Clickable { //-------------------------------------------------- // MARK: - Lifecycle //-------------------------------------------------- - open func initialSetup() { + private func initialSetup() { if !initialSetupPerformed { initialSetupPerformed = true shouldUpdateView = false diff --git a/VDS/BaseClasses/View.swift b/VDS/BaseClasses/View.swift index b39afbf2..b8acb096 100644 --- a/VDS/BaseClasses/View.swift +++ b/VDS/BaseClasses/View.swift @@ -57,7 +57,7 @@ open class View: UIView, ViewProtocol, UserInfoable { //-------------------------------------------------- // MARK: - Lifecycle //-------------------------------------------------- - open func initialSetup() { + private func initialSetup() { if !initialSetupPerformed { initialSetupPerformed = true shouldUpdateView = false diff --git a/VDS/Components/Buttons/ButtonBase.swift b/VDS/Components/Buttons/ButtonBase.swift index b210560a..8af0ee68 100644 --- a/VDS/Components/Buttons/ButtonBase.swift +++ b/VDS/Components/Buttons/ButtonBase.swift @@ -97,12 +97,9 @@ open class ButtonBase: UIButton, ViewProtocol, UserInfoable, Clickable { //-------------------------------------------------- // MARK: - Lifecycle //-------------------------------------------------- - open func initialSetup() { + private func initialSetup() { if !initialSetupPerformed { initialSetupPerformed = true - backgroundColor = .clear - translatesAutoresizingMaskIntoConstraints = false - accessibilityCustomActions = [] shouldUpdateView = false setup() shouldUpdateView = true @@ -112,8 +109,9 @@ open class ButtonBase: UIButton, ViewProtocol, UserInfoable, Clickable { open func setup() { + backgroundColor = .clear translatesAutoresizingMaskIntoConstraints = false - + accessibilityCustomActions = [] titleLabel?.adjustsFontSizeToFitWidth = false titleLabel?.lineBreakMode = .byTruncatingTail titleLabel?.numberOfLines = 1 diff --git a/VDS/Components/Label/Label.swift b/VDS/Components/Label/Label.swift index 3d56470b..5930dea7 100644 --- a/VDS/Components/Label/Label.swift +++ b/VDS/Components/Label/Label.swift @@ -192,23 +192,9 @@ open class Label: UILabel, ViewProtocol, UserInfoable { //-------------------------------------------------- // MARK: - Lifecycle //-------------------------------------------------- - open func initialSetup() { + private func initialSetup() { if !initialSetupPerformed { initialSetupPerformed = true - //register for ContentSizeChanges - NotificationCenter - .Publisher(center: .default, name: UIContentSizeCategory.didChangeNotification) - .sink { [weak self] notification in - self?.setNeedsUpdate() - }.store(in: &subscribers) - backgroundColor = .clear - numberOfLines = 0 - lineBreakMode = .byTruncatingTail - translatesAutoresizingMaskIntoConstraints = false - accessibilityCustomActions = [] - isAccessibilityElement = true - accessibilityTraits = .staticText - textAlignment = .left shouldUpdateView = false setup() shouldUpdateView = true @@ -217,6 +203,20 @@ open class Label: UILabel, ViewProtocol, UserInfoable { } open func setup() { + //register for ContentSizeChanges + NotificationCenter + .Publisher(center: .default, name: UIContentSizeCategory.didChangeNotification) + .sink { [weak self] notification in + self?.setNeedsUpdate() + }.store(in: &subscribers) + backgroundColor = .clear + numberOfLines = 0 + lineBreakMode = .byTruncatingTail + translatesAutoresizingMaskIntoConstraints = false + accessibilityCustomActions = [] + isAccessibilityElement = true + accessibilityTraits = .staticText + textAlignment = .left } open func reset() { diff --git a/VDS/Components/TextFields/InputField/TextField.swift b/VDS/Components/TextFields/InputField/TextField.swift index 7adf1aa0..2f6ddb1a 100644 --- a/VDS/Components/TextFields/InputField/TextField.swift +++ b/VDS/Components/TextFields/InputField/TextField.swift @@ -98,13 +98,9 @@ open class TextField: UITextField, ViewProtocol, Errorable { //-------------------------------------------------- // MARK: - Lifecycle //-------------------------------------------------- - open func initialSetup() { + private func initialSetup() { if !initialSetupPerformed { initialSetupPerformed = true - backgroundColor = .clear - translatesAutoresizingMaskIntoConstraints = false - setContentCompressionResistancePriority(.defaultLow, for: .horizontal) - clipsToBounds = true shouldUpdateView = false setup() shouldUpdateView = true @@ -113,6 +109,11 @@ open class TextField: UITextField, ViewProtocol, Errorable { } open func setup() { + backgroundColor = .clear + translatesAutoresizingMaskIntoConstraints = false + setContentCompressionResistancePriority(.defaultLow, for: .horizontal) + clipsToBounds = true + let accessView = UIView(frame: .init(origin: .zero, size: .init(width: UIScreen.main.bounds.width, height: 44))) accessView.backgroundColor = .white accessView.addBorder(side: .top, width: 1, color: .lightGray) diff --git a/VDS/Components/TextFields/TextArea/TextView.swift b/VDS/Components/TextFields/TextArea/TextView.swift index 526911c4..575c2da8 100644 --- a/VDS/Components/TextFields/TextArea/TextView.swift +++ b/VDS/Components/TextFields/TextArea/TextView.swift @@ -107,11 +107,9 @@ open class TextView: UITextView, ViewProtocol, Errorable { //-------------------------------------------------- // MARK: - Lifecycle //-------------------------------------------------- - open func initialSetup() { + private func initialSetup() { if !initialSetupPerformed { initialSetupPerformed = true - backgroundColor = .clear - translatesAutoresizingMaskIntoConstraints = false shouldUpdateView = false setup() shouldUpdateView = true @@ -120,6 +118,9 @@ open class TextView: UITextView, ViewProtocol, Errorable { } open func setup() { + backgroundColor = .clear + translatesAutoresizingMaskIntoConstraints = false + let accessView = UIView(frame: .init(origin: .zero, size: .init(width: UIScreen.main.bounds.width, height: 44))) accessView.backgroundColor = .white accessView.addBorder(side: .top, width: 1, color: .lightGray)