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