// // Control.swift // VDS // // Created by Matt Bruce on 7/22/22. // import Foundation import UIKit @objcMembers open class Control: UIControl { //-------------------------------------------------- // MARK: - Properties //-------------------------------------------------- private var initialSetupPerformed = false //-------------------------------------------------- // MARK: - Initializers //-------------------------------------------------- public override init(frame: CGRect) { super.init(frame: .zero) initialSetup() } public init() { super.init(frame: .zero) initialSetup() } public required init?(coder: NSCoder) { super.init(coder: coder) fatalError("Control does not support xib.") } //-------------------------------------------------- // MARK: - Setup //-------------------------------------------------- public func initialSetup() { if !initialSetupPerformed { initialSetupPerformed = true setupView() } } open func reset() { backgroundColor = .clear } } // MARK: - ViewProtocol extension Control: ViewProtocol { open func updateView(_ size: CGFloat) { } /// Will be called only once. open func setupView() { translatesAutoresizingMaskIntoConstraints = false insetsLayoutMarginsFromSafeArea = false } }