File tree Expand file tree Collapse file tree 4 files changed +21
-3
lines changed Expand file tree Collapse file tree 4 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,12 @@ extension AttributedString {
44
44
self . highlights = highlights
45
45
self . callback = callback
46
46
}
47
+
48
+ init ( _ trigger: Trigger = . click, highlights: [ Highlight ] = . defalut) {
49
+ self . trigger = trigger
50
+ self . highlights = highlights
51
+ self . callback = { _ in }
52
+ }
47
53
}
48
54
}
49
55
Original file line number Diff line number Diff line change @@ -98,7 +98,11 @@ extension AttributedStringWrapper where Base: NSTextField {
98
98
99
99
default :
100
100
guard let value = observation [ type] else { return }
101
- base. actions [ range] = . init( . click, highlights: value. 0 ) { _ in value. 1 ( result) }
101
+ var action = Action ( . click, highlights: value. 0 )
102
+ action. handle = {
103
+ value. 1 ( result)
104
+ }
105
+ base. actions [ range] = action
102
106
}
103
107
}
104
108
}
Original file line number Diff line number Diff line change @@ -127,7 +127,11 @@ extension AttributedStringWrapper where Base: UILabel {
127
127
128
128
default :
129
129
guard let value = observation [ type] else { return }
130
- base. actions [ range] = . init( . click, highlights: value. 0 ) { _ in value. 1 ( result) }
130
+ var action = Action ( . click, highlights: value. 0 )
131
+ action. handle = {
132
+ value. 1 ( result)
133
+ }
134
+ base. actions [ range] = action
131
135
}
132
136
}
133
137
}
Original file line number Diff line number Diff line change @@ -97,7 +97,11 @@ extension AttributedStringWrapper where Base: UITextView {
97
97
98
98
default :
99
99
guard let value = observation [ type] else { return }
100
- base. actions [ range] = . init( . click, highlights: value. 0 ) { _ in value. 1 ( result) }
100
+ var action = Action ( . click, highlights: value. 0 )
101
+ action. handle = {
102
+ value. 1 ( result)
103
+ }
104
+ base. actions [ range] = action
101
105
}
102
106
}
103
107
}
You can’t perform that action at this time.
0 commit comments