Removed unneeded parameter.
This commit is contained in:
parent
211d9f6c3b
commit
2f69b07bf5
@ -50,7 +50,6 @@ public typealias ActionBlock = () -> Void
|
||||
|
||||
// Used for tappable links in the text.
|
||||
private struct ActionableClause {
|
||||
var labelView: Label?
|
||||
var location: Int?
|
||||
var length: Int?
|
||||
var actionText: String?
|
||||
@ -173,8 +172,7 @@ public typealias ActionBlock = () -> Void
|
||||
let subStringRange = Range(range, in: text)
|
||||
else { return }
|
||||
|
||||
clauses.append(ActionableClause(labelView: self,
|
||||
location: range.location,
|
||||
clauses.append(ActionableClause(location: range.location,
|
||||
length: range.length,
|
||||
actionText: String(text[subStringRange]),
|
||||
actionBlock: actionBlock))
|
||||
@ -198,8 +196,7 @@ public typealias ActionBlock = () -> Void
|
||||
let subStringRange = Range(range, in: text)
|
||||
else { return }
|
||||
|
||||
clauses.append(ActionableClause(labelView: self,
|
||||
location: range.location,
|
||||
clauses.append(ActionableClause(location: range.location,
|
||||
length: range.length,
|
||||
actionText: String(text[subStringRange]),
|
||||
actionBlock: { [weak self, weak delegate] in
|
||||
@ -233,8 +230,7 @@ public typealias ActionBlock = () -> Void
|
||||
let string = text as NSString
|
||||
let range = string.range(of: actionText)
|
||||
|
||||
clauses.append(ActionableClause(labelView: self,
|
||||
location: range.location,
|
||||
clauses.append(ActionableClause(location: range.location,
|
||||
length: range.length,
|
||||
actionText: actionText,
|
||||
actionBlock: actionBlock))
|
||||
@ -258,7 +254,7 @@ public typealias ActionBlock = () -> Void
|
||||
let string = text as NSString
|
||||
let range = string.range(of: actionText)
|
||||
|
||||
clauses.append(ActionableClause(labelView: self, location: range.location, length: range.length, actionText: actionText,
|
||||
clauses.append(ActionableClause(location: range.location, length: range.length, actionText: actionText,
|
||||
actionBlock: { [weak self, weak delegate] in
|
||||
var willPerform = true
|
||||
|
||||
@ -400,8 +396,7 @@ public typealias ActionBlock = () -> Void
|
||||
let subStringRange = Range(NSRange(location: actionLocation, length: actionLength), in: text)
|
||||
else { continue }
|
||||
|
||||
label.clauses.append(ActionableClause(labelView: label,
|
||||
location: actionLocation,
|
||||
label.clauses.append(ActionableClause(location: actionLocation,
|
||||
length: actionLength,
|
||||
actionText: String(text[subStringRange]),
|
||||
actionBlock: { [weak delegate] in
|
||||
@ -563,7 +558,7 @@ extension Label {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
@ -603,7 +598,6 @@ extension Label {
|
||||
// MARK: - UITapGestureRecognizer Override
|
||||
extension UITapGestureRecognizer {
|
||||
|
||||
|
||||
func didTapAttributedTextInLabel(_ label: Label, inRange targetRange: NSRange) -> Bool {
|
||||
|
||||
guard let attributedText = label.attributedText else { return false }
|
||||
@ -620,7 +614,7 @@ extension UITapGestureRecognizer {
|
||||
textContainer.maximumNumberOfLines = label.numberOfLines
|
||||
let labelSize = label.bounds.size
|
||||
textContainer.size = labelSize
|
||||
|
||||
let j = layoutManager.boundingRect(forGlyphRange: targetRange, in: textContainer)
|
||||
let indexOfCharacter = layoutManager.characterIndex(for: location(in: label), in: textContainer, fractionOfDistanceBetweenInsertionPoints: nil)
|
||||
|
||||
return NSLocationInRange(indexOfCharacter, targetRange)
|
||||
|
||||
@ -210,7 +210,7 @@ public typealias CoreObjectActionLoadPresentDelegate = MVMCoreActionDelegateProt
|
||||
setAlternateActionTextAttributes([NSAttributedString.Key.underlineStyle: NSNumber(value: NSUnderlineStyle.single.rawValue)])
|
||||
|
||||
self.label?.attributedText = attributedText
|
||||
self.label?.accessibilityTraits = .button
|
||||
self.label?.accessibilityTraits = actionText?.isEmpty ?? false ? .staticText : .button
|
||||
}
|
||||
|
||||
@objc public func setActionMap(_ actionMap: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, delegateObject: DelegateObject?) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user