Move Legacy Files
This commit is contained in:
parent
28cbcfee85
commit
3fda7db320
@ -52,10 +52,7 @@ public typealias ActionBlock = () -> ()
|
||||
isUserInteractionEnabled = !clauses.isEmpty
|
||||
if clauses.count > 1 {
|
||||
clauses.sort { first, second in
|
||||
guard let firstLocation = first.range?.location,
|
||||
let secondLocation = second.range?.location
|
||||
else { return false }
|
||||
return firstLocation < secondLocation
|
||||
return first.range.location < second.range.location
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -63,12 +60,18 @@ public typealias ActionBlock = () -> ()
|
||||
|
||||
/// Used for tappable links in the text.
|
||||
public struct ActionableClause {
|
||||
var range: NSRange?
|
||||
var actionBlock: ActionBlock?
|
||||
var accessibilityID: Int = 0
|
||||
public var range: NSRange
|
||||
public var actionBlock: ActionBlock
|
||||
public var accessibilityID: Int = 0
|
||||
|
||||
func performAction() {
|
||||
actionBlock?()
|
||||
public func performAction() {
|
||||
actionBlock()
|
||||
}
|
||||
|
||||
public init(range: NSRange, actionBlock: @escaping ActionBlock, accessibilityID: Int = 0) {
|
||||
self.range = range
|
||||
self.actionBlock = actionBlock
|
||||
self.accessibilityID = accessibilityID
|
||||
}
|
||||
}
|
||||
|
||||
@ -897,8 +900,7 @@ extension Label {
|
||||
let mutableAttributedString = NSMutableAttributedString(attributedString: attributedText)
|
||||
|
||||
clauses.forEach { clause in
|
||||
guard let range = clause.range else { return }
|
||||
mutableAttributedString.removeAttribute(NSAttributedString.Key.underlineStyle, range: range)
|
||||
mutableAttributedString.removeAttribute(NSAttributedString.Key.underlineStyle, range: clause.range)
|
||||
}
|
||||
|
||||
self.attributedText = mutableAttributedString
|
||||
@ -981,7 +983,7 @@ extension Label {
|
||||
|
||||
for clause in clauses {
|
||||
// This determines if we tapped on the desired range of text.
|
||||
if let range = clause.range, gesture.didTapAttributedTextInLabel(self, inRange: range) {
|
||||
if gesture.didTapAttributedTextInLabel(self, inRange: clause.range) {
|
||||
clause.performAction()
|
||||
return
|
||||
}
|
||||
|
||||
@ -9,7 +9,6 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
@class LabelWithInternalButton;
|
||||
@class MFSizeObject;
|
||||
|
||||
//enum for border
|
||||
|
||||
Loading…
Reference in New Issue
Block a user