added comments to View

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-05-26 16:18:10 -05:00
parent d358194b7d
commit c9ae6b0954

View File

@ -23,14 +23,19 @@ open class View: UIView, Handlerable, ViewProtocol, Resettable, UserInfoable {
//--------------------------------------------------
private var initialSetupPerformed = false
/// Key of whether or not updateView() is called in setNeedsUpdate()
open var shouldUpdateView: Bool = true
/// Dictionary for keeping information for this Control use only Primitives
open var userInfo = [String: Primitive]()
open var surface: Surface = .light { didSet { setNeedsUpdate() }}
/// Current Surface used within this Control and used to passdown to child views
open var surface: Surface = .light { didSet { setNeedsUpdate() } }
/// Control is disabled or not
open var disabled: Bool = false { didSet { isEnabled = !disabled } }
/// Override to deal with setNeedsUpdate()
open var isEnabled: Bool {
get { !disabled }
set {
@ -64,6 +69,7 @@ open class View: UIView, Handlerable, ViewProtocol, Resettable, UserInfoable {
// MARK: - Setup
//--------------------------------------------------
/// Executed on initialization for this View
open func initialSetup() {
if !initialSetupPerformed {
initialSetupPerformed = true
@ -75,22 +81,25 @@ open class View: UIView, Handlerable, ViewProtocol, Resettable, UserInfoable {
//--------------------------------------------------
// MARK: - Overrides
//--------------------------------------------------
/// Update this view based off of property changes
open func updateView() {
updateAccessibilityLabel()
}
/// Used to update any Accessibility properties
open func updateAccessibilityLabel() {
}
/// Resets to the Views default values
open func reset() {
backgroundColor = .clear
surface = .light
disabled = false
}
// MARK: - ViewProtocol
/// Will be called only once.
/// Will be called only once and should be overridden in subclasses to setup UI or defaults
open func setup() {
backgroundColor = .clear
translatesAutoresizingMaskIntoConstraints = false