added shouldUpdateAccessibility
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
40a31dfe25
commit
a043bd33f2
@ -47,6 +47,8 @@ open class Control: UIControl, ViewProtocol, UserInfoable, Clickable {
|
||||
//--------------------------------------------------
|
||||
open var shouldUpdateView: Bool = true
|
||||
|
||||
open var shouldUpdateAccessibility: Bool = true
|
||||
|
||||
open var userInfo = [String: Primitive]()
|
||||
|
||||
open var surface: Surface = .light { didSet { setNeedsUpdate() } }
|
||||
|
||||
@ -46,6 +46,8 @@ open class View: UIView, ViewProtocol, UserInfoable {
|
||||
//--------------------------------------------------
|
||||
open var shouldUpdateView: Bool = true
|
||||
|
||||
open var shouldUpdateAccessibility: Bool = true
|
||||
|
||||
/// Dictionary for keeping information for this Control use only Primitives.
|
||||
open var userInfo = [String: Primitive]()
|
||||
|
||||
|
||||
@ -110,6 +110,8 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
|
||||
/// Key of whether or not updateView() is called in setNeedsUpdate()
|
||||
open var shouldUpdateView: Bool = true
|
||||
|
||||
open var shouldUpdateAccessibility: Bool = true
|
||||
|
||||
/// Will determine if a scaled font should be used for the font.
|
||||
open var useScaledFont: Bool = false { didSet { setNeedsUpdate() }}
|
||||
|
||||
|
||||
@ -56,6 +56,8 @@ open class TextField: UITextField, ViewProtocol, Errorable {
|
||||
/// Key of whether or not updateView() is called in setNeedsUpdate()
|
||||
open var shouldUpdateView: Bool = true
|
||||
|
||||
open var shouldUpdateAccessibility: Bool = true
|
||||
|
||||
open var surface: Surface = .light { didSet { setNeedsUpdate() } }
|
||||
|
||||
open var showError: Bool = false { didSet { setNeedsUpdate() } }
|
||||
|
||||
@ -48,6 +48,8 @@ open class TextView: UITextView, ViewProtocol, Errorable {
|
||||
/// Key of whether or not updateView() is called in setNeedsUpdate()
|
||||
open var shouldUpdateView: Bool = true
|
||||
|
||||
open var shouldUpdateAccessibility: Bool = true
|
||||
|
||||
open var surface: Surface = .light { didSet { setNeedsUpdate() } }
|
||||
|
||||
/// Array of LabelAttributeModel objects used in rendering the text.
|
||||
|
||||
@ -16,6 +16,9 @@ public protocol ViewProtocol: AnyObject, Initable, Resettable, Enabling, Surface
|
||||
/// Key of whether or not updateView() is called in setNeedsUpdate()
|
||||
var shouldUpdateView: Bool { get set }
|
||||
|
||||
/// Key of whether or not updateAccessibility() is called in setNeedsUpdate()
|
||||
var shouldUpdateAccessibility: Bool { get set }
|
||||
|
||||
/// Executed on initialization for this View.
|
||||
func initialSetup()
|
||||
|
||||
@ -30,12 +33,15 @@ public protocol ViewProtocol: AnyObject, Initable, Resettable, Enabling, Surface
|
||||
}
|
||||
|
||||
extension ViewProtocol {
|
||||
|
||||
/// Called when there are changes in a View based off a change events or from local properties.
|
||||
public func setNeedsUpdate() {
|
||||
if shouldUpdateView {
|
||||
shouldUpdateView = false
|
||||
updateView()
|
||||
updateAccessibility()
|
||||
if shouldUpdateAccessibility {
|
||||
updateAccessibility()
|
||||
}
|
||||
shouldUpdateView = true
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user