vds_ios/VDS/Protocols/Accessable.swift
Matt Bruce 1e046fa336 removed / replaced anything to do with model
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
2022-10-20 15:41:41 -05:00

50 lines
1.5 KiB
Swift

//
// Accessable.swift
// VDS
//
// Created by Matt Bruce on 7/26/22.
//
import Foundation
import UIKit
public protocol Accessable {
var accessibilityHintEnabled: String? { get set }
var accessibilityHintDisabled: String? { get set }
var accessibilityValueEnabled: String? { get set }
var accessibilityValueDisabled: String? { get set }
var accessibilityLabelEnabled: String? { get set }
var accessibilityLabelDisabled: String? { get set }
}
//Configurations to set within the UIControl
extension Handlerable where Self: UIView, Self: Accessable {
public func setAccessibilityHint(_ override: Bool? = nil) {
let check = override ?? !disabled
if let value = accessibilityHintEnabled, check {
accessibilityHint = value
} else if let value = accessibilityHintDisabled, !check {
accessibilityHint = value
}
}
public func setAccessibilityValue(_ override: Bool? = nil) {
let check = override ?? !disabled
if let value = accessibilityValueEnabled, check {
accessibilityValue = value
} else if let value = accessibilityValueDisabled, !check {
accessibilityValue = value
}
}
public func setAccessibilityLabel(_ override: Bool? = nil) {
let check = override ?? !disabled
if let value = accessibilityLabelEnabled, check {
accessibilityLabel = value
} else if let value = accessibilityLabelDisabled, !check {
accessibilityLabel = value
}
}
}