added shouldUpdateAccessibility

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2024-06-05 16:15:35 -05:00
parent 40a31dfe25
commit a043bd33f2
6 changed files with 17 additions and 1 deletions

View File

@ -47,6 +47,8 @@ open class Control: UIControl, ViewProtocol, UserInfoable, Clickable {
//-------------------------------------------------- //--------------------------------------------------
open var shouldUpdateView: Bool = true open var shouldUpdateView: Bool = true
open var shouldUpdateAccessibility: Bool = true
open var userInfo = [String: Primitive]() open var userInfo = [String: Primitive]()
open var surface: Surface = .light { didSet { setNeedsUpdate() } } open var surface: Surface = .light { didSet { setNeedsUpdate() } }

View File

@ -46,6 +46,8 @@ open class View: UIView, ViewProtocol, UserInfoable {
//-------------------------------------------------- //--------------------------------------------------
open var shouldUpdateView: Bool = true open var shouldUpdateView: Bool = true
open var shouldUpdateAccessibility: Bool = true
/// Dictionary for keeping information for this Control use only Primitives. /// Dictionary for keeping information for this Control use only Primitives.
open var userInfo = [String: Primitive]() open var userInfo = [String: Primitive]()

View File

@ -110,6 +110,8 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
/// Key of whether or not updateView() is called in setNeedsUpdate() /// Key of whether or not updateView() is called in setNeedsUpdate()
open var shouldUpdateView: Bool = true open var shouldUpdateView: Bool = true
open var shouldUpdateAccessibility: Bool = true
/// Will determine if a scaled font should be used for the font. /// Will determine if a scaled font should be used for the font.
open var useScaledFont: Bool = false { didSet { setNeedsUpdate() }} open var useScaledFont: Bool = false { didSet { setNeedsUpdate() }}

View File

@ -56,6 +56,8 @@ open class TextField: UITextField, ViewProtocol, Errorable {
/// Key of whether or not updateView() is called in setNeedsUpdate() /// Key of whether or not updateView() is called in setNeedsUpdate()
open var shouldUpdateView: Bool = true open var shouldUpdateView: Bool = true
open var shouldUpdateAccessibility: Bool = true
open var surface: Surface = .light { didSet { setNeedsUpdate() } } open var surface: Surface = .light { didSet { setNeedsUpdate() } }
open var showError: Bool = false { didSet { setNeedsUpdate() } } open var showError: Bool = false { didSet { setNeedsUpdate() } }

View File

@ -48,6 +48,8 @@ open class TextView: UITextView, ViewProtocol, Errorable {
/// Key of whether or not updateView() is called in setNeedsUpdate() /// Key of whether or not updateView() is called in setNeedsUpdate()
open var shouldUpdateView: Bool = true open var shouldUpdateView: Bool = true
open var shouldUpdateAccessibility: Bool = true
open var surface: Surface = .light { didSet { setNeedsUpdate() } } open var surface: Surface = .light { didSet { setNeedsUpdate() } }
/// Array of LabelAttributeModel objects used in rendering the text. /// Array of LabelAttributeModel objects used in rendering the text.

View File

@ -16,6 +16,9 @@ public protocol ViewProtocol: AnyObject, Initable, Resettable, Enabling, Surface
/// Key of whether or not updateView() is called in setNeedsUpdate() /// Key of whether or not updateView() is called in setNeedsUpdate()
var shouldUpdateView: Bool { get set } 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. /// Executed on initialization for this View.
func initialSetup() func initialSetup()
@ -30,12 +33,15 @@ public protocol ViewProtocol: AnyObject, Initable, Resettable, Enabling, Surface
} }
extension ViewProtocol { extension ViewProtocol {
/// Called when there are changes in a View based off a change events or from local properties. /// Called when there are changes in a View based off a change events or from local properties.
public func setNeedsUpdate() { public func setNeedsUpdate() {
if shouldUpdateView { if shouldUpdateView {
shouldUpdateView = false shouldUpdateView = false
updateView() updateView()
updateAccessibility() if shouldUpdateAccessibility {
updateAccessibility()
}
shouldUpdateView = true shouldUpdateView = true
} }
} }