refactored methods for action
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
90974afb8d
commit
d3c44cdf32
@ -156,11 +156,11 @@ open class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable {
|
|||||||
|
|
||||||
//add attribute on the string
|
//add attribute on the string
|
||||||
attribute.setAttribute(on: mutableAttributedString)
|
attribute.setAttribute(on: mutableAttributedString)
|
||||||
|
|
||||||
//see if the attribute is Actionable
|
//see if the attribute is Actionable
|
||||||
if let actionable = attribute as? any ActionLabelAttributeModel{
|
if let actionable = attribute as? any ActionLabelAttributeModel{
|
||||||
//create a accessibleAction
|
//create a accessibleAction
|
||||||
let customAccessibilityAction = customAccessibilityAction(range: actionable.range, accessibleText: actionable.accessibleText)
|
let customAccessibilityAction = customAccessibilityAction(text: mutableAttributedString.string, range: actionable.range, accessibleText: actionable.accessibleText)
|
||||||
|
|
||||||
//create a wrapper for the attributes range, block and
|
//create a wrapper for the attributes range, block and
|
||||||
actions.append(LabelAction(range: actionable.range, action: actionable.action, accessibilityID: customAccessibilityAction?.hashValue ?? -1))
|
actions.append(LabelAction(range: actionable.range, action: actionable.action, accessibilityID: customAccessibilityAction?.hashValue ?? -1))
|
||||||
@ -263,7 +263,7 @@ open class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Accessibility For Actions
|
// MARK: - Accessibility For Actions
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
private func customAccessibilityAction(range: NSRange, accessibleText: String? = nil) -> UIAccessibilityCustomAction? {
|
private func customAccessibilityAction(text: String?, range: NSRange, accessibleText: String? = nil) -> UIAccessibilityCustomAction? {
|
||||||
|
|
||||||
guard let text = text else { return nil }
|
guard let text = text else { return nil }
|
||||||
//TODO: accessibilityHint for Label
|
//TODO: accessibilityHint for Label
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user