From 39ba2c9c842c28dea7420e6c7baffe4805c19950 Mon Sep 17 00:00:00 2001 From: "Tondapu, Alekhya" Date: Thu, 13 May 2021 23:19:53 +0530 Subject: [PATCH] caretLink reload causing crash issue fixed --- MVMCoreUI/Atomic/Atoms/Buttons/CaretLink.swift | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/CaretLink.swift b/MVMCoreUI/Atomic/Atoms/Buttons/CaretLink.swift index 5ae68241..caa356cf 100644 --- a/MVMCoreUI/Atomic/Atoms/Buttons/CaretLink.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/CaretLink.swift @@ -59,12 +59,6 @@ open class CaretLink: Button, MVMCoreUIViewConstrainingProtocol { // MARK: - Lifecycle //------------------------------------------------------ - override open func layoutSubviews() { - - addCaretImageView() - super.layoutSubviews() - } - override public var isEnabled: Bool { didSet { changeCaretColor() } } @@ -135,7 +129,7 @@ open class CaretLink: Button, MVMCoreUIViewConstrainingProtocol { //------------------------------------------------------ public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { - + addCaretImageView() guard let model = model as? CaretLinkModel else { return } if let color = model.backgroundColor { @@ -150,6 +144,11 @@ open class CaretLink: Button, MVMCoreUIViewConstrainingProtocol { setTitle(model.title, for: .normal) } + open override func reset() { + super.reset() + rightView?.removeFromSuperview() + } + public func needsToBeConstrained() -> Bool { true } open func horizontalAlignment() -> UIStackView.Alignment { .leading }