From d901ded4c12a1e91ad56864b035fd0f136ef0734 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Tue, 29 Oct 2019 13:56:19 -0400 Subject: [PATCH] open view up! --- MVMCoreUI/BaseClasses/View.swift | 49 ++++++++++++++++---------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/MVMCoreUI/BaseClasses/View.swift b/MVMCoreUI/BaseClasses/View.swift index 735243df..d470c539 100644 --- a/MVMCoreUI/BaseClasses/View.swift +++ b/MVMCoreUI/BaseClasses/View.swift @@ -8,47 +8,46 @@ import UIKit -public class View: UIView { - var json: [AnyHashable: Any]? +open class View: UIView { + open var json: [AnyHashable: Any]? private var initialSetupPerformed = false public override init(frame: CGRect) { - super.init(frame: .zero) - initialSetup() - } + super.init(frame: .zero) + initialSetup() + } - init() { - super.init(frame: .zero) - initialSetup() - } - - public required init?(coder: NSCoder) { - super.init(coder: coder) - initialSetup() - } - - public func initialSetup() { - if !initialSetupPerformed { - initialSetupPerformed = true - setupView() - } + init() { + super.init(frame: .zero) + initialSetup() + } + + public required init?(coder: NSCoder) { + super.init(coder: coder) + initialSetup() + } + + public func initialSetup() { + if !initialSetupPerformed { + initialSetupPerformed = true + setupView() } } +} extension View: MVMCoreViewProtocol { - public func updateView(_ size: CGFloat) { - } + open func updateView(_ size: CGFloat) {} /// Will be called only once. - public func setupView() { + open func setupView() { translatesAutoresizingMaskIntoConstraints = false insetsLayoutMarginsFromSafeArea = false } } extension View: MVMCoreUIMoleculeViewProtocol { - public func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) { + open func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) { self.json = json if let backgroundColorString = json?.optionalStringForKey(KeyBackgroundColor) { @@ -56,7 +55,7 @@ extension View: MVMCoreUIMoleculeViewProtocol { } } - public func reset() { + open func reset() { backgroundColor = .clear } }