@@ -52,9 +52,7 @@ extension AttributedString {
52
52
andChanged changed: AttributedString . SingleAttributeTransformer < K > ,
53
53
to attrStr: inout AttributedString ,
54
54
key: K . Type
55
- )
56
- where
57
- K. Value : Sendable {
55
+ ) {
58
56
if orig. range != changed. range || orig. attrName != changed. attrName {
59
57
attrStr. _guts. removeAttributeValue ( forKey: K . self, in: orig. range. _bstringRange) // If the range changed, we need to remove from the old range first.
60
58
}
@@ -65,7 +63,7 @@ extension AttributedString {
65
63
andChanged changed: AttributedString . SingleAttributeTransformer < K > ,
66
64
to attrStr: inout AttributedString ,
67
65
key: K . Type
68
- ) where K . Value : Sendable {
66
+ ) {
69
67
if orig. range != changed. range || orig. attrName != changed. attrName || orig. attr != changed. attr {
70
68
if let newVal = changed. attr { // Then if there's a new value, we add it in.
71
69
// Unfortunately, we can't use the attrStr[range].set() provided by the AttributedStringProtocol, because we *don't know* the new type statically!
@@ -80,13 +78,10 @@ extension AttributedString {
80
78
81
79
@available ( macOS 12 , iOS 15 , tvOS 15 , watchOS 8 , * )
82
80
extension AttributedString {
83
- @preconcurrency
84
81
public func transformingAttributes< K> (
85
82
_ k: K . Type ,
86
83
_ c: ( inout AttributedString . SingleAttributeTransformer < K > ) -> Void
87
- ) -> AttributedString
88
- where
89
- K. Value : Sendable {
84
+ ) -> AttributedString {
90
85
let orig = AttributedString ( _guts)
91
86
var copy = orig
92
87
copy. ensureUniqueReference ( ) // ???: Is this best practice? We're going behind the back of the AttributedString mutation API surface, so it doesn't happen anywhere else. It's also aggressively speculative.
@@ -100,16 +95,12 @@ extension AttributedString {
100
95
return copy
101
96
}
102
97
103
- @preconcurrency
104
98
public func transformingAttributes< K1, K2> (
105
99
_ k: K1 . Type ,
106
100
_ k2: K2 . Type ,
107
101
_ c: ( inout AttributedString . SingleAttributeTransformer < K1 > ,
108
102
inout AttributedString . SingleAttributeTransformer < K2 > ) -> Void
109
- ) -> AttributedString
110
- where
111
- K1. Value : Sendable ,
112
- K2. Value : Sendable {
103
+ ) -> AttributedString {
113
104
let orig = AttributedString ( _guts)
114
105
var copy = orig
115
106
copy. ensureUniqueReference ( ) // ???: Is this best practice? We're going behind the back of the AttributedString mutation API surface, so it doesn't happen anywhere else. It's also aggressively speculative.
@@ -127,19 +118,14 @@ extension AttributedString {
127
118
return copy
128
119
}
129
120
130
- @preconcurrency
131
121
public func transformingAttributes< K1, K2, K3> (
132
122
_ k: K1 . Type ,
133
123
_ k2: K2 . Type ,
134
124
_ k3: K3 . Type ,
135
125
_ c: ( inout AttributedString . SingleAttributeTransformer < K1 > ,
136
126
inout AttributedString . SingleAttributeTransformer < K2 > ,
137
127
inout AttributedString . SingleAttributeTransformer < K3 > ) -> Void
138
- ) -> AttributedString
139
- where
140
- K1. Value : Sendable ,
141
- K2. Value : Sendable ,
142
- K3. Value : Sendable {
128
+ ) -> AttributedString {
143
129
let orig = AttributedString ( _guts)
144
130
var copy = orig
145
131
copy. ensureUniqueReference ( ) // ???: Is this best practice? We're going behind the back of the AttributedString mutation API surface, so it doesn't happen anywhere else. It's also aggressively speculative.
@@ -161,7 +147,6 @@ extension AttributedString {
161
147
return copy
162
148
}
163
149
164
- @preconcurrency
165
150
public func transformingAttributes< K1, K2, K3, K4> (
166
151
_ k: K1 . Type ,
167
152
_ k2: K2 . Type ,
@@ -171,12 +156,7 @@ extension AttributedString {
171
156
inout AttributedString . SingleAttributeTransformer < K2 > ,
172
157
inout AttributedString . SingleAttributeTransformer < K3 > ,
173
158
inout AttributedString . SingleAttributeTransformer < K4 > ) -> Void
174
- ) -> AttributedString
175
- where
176
- K1. Value : Sendable ,
177
- K2. Value : Sendable ,
178
- K3. Value : Sendable ,
179
- K4. Value : Sendable {
159
+ ) -> AttributedString {
180
160
let orig = AttributedString ( _guts)
181
161
var copy = orig
182
162
copy. ensureUniqueReference ( ) // ???: Is this best practice? We're going behind the back of the AttributedString mutation API surface, so it doesn't happen anywhere else. It's also aggressively speculative.
@@ -202,7 +182,6 @@ extension AttributedString {
202
182
return copy
203
183
}
204
184
205
- @preconcurrency
206
185
public func transformingAttributes< K1, K2, K3, K4, K5> (
207
186
_ k: K1 . Type ,
208
187
_ k2: K2 . Type ,
@@ -214,13 +193,7 @@ extension AttributedString {
214
193
inout AttributedString . SingleAttributeTransformer < K3 > ,
215
194
inout AttributedString . SingleAttributeTransformer < K4 > ,
216
195
inout AttributedString . SingleAttributeTransformer < K5 > ) -> Void
217
- ) -> AttributedString
218
- where
219
- K1. Value : Sendable ,
220
- K2. Value : Sendable ,
221
- K3. Value : Sendable ,
222
- K4. Value : Sendable ,
223
- K5. Value : Sendable {
196
+ ) -> AttributedString {
224
197
let orig = AttributedString ( _guts)
225
198
var copy = orig
226
199
copy. ensureUniqueReference ( ) // ???: Is this best practice? We're going behind the back of the AttributedString mutation API surface, so it doesn't happen anywhere else. It's also aggressively speculative.
@@ -253,46 +226,33 @@ extension AttributedString {
253
226
254
227
@available ( macOS 12 , iOS 15 , tvOS 15 , watchOS 8 , * )
255
228
extension AttributedString {
256
- @preconcurrency
257
229
public func transformingAttributes< K> (
258
230
_ k: KeyPath < AttributeDynamicLookup , K > ,
259
231
_ c: ( inout AttributedString . SingleAttributeTransformer < K > ) -> Void
260
- ) -> AttributedString
261
- where
262
- K. Value : Sendable {
232
+ ) -> AttributedString {
263
233
self . transformingAttributes ( K . self, c)
264
234
}
265
235
266
- @preconcurrency
267
236
public func transformingAttributes< K1, K2> (
268
237
_ k: KeyPath < AttributeDynamicLookup , K1 > ,
269
238
_ k2: KeyPath < AttributeDynamicLookup , K2 > ,
270
239
_ c: ( inout AttributedString . SingleAttributeTransformer < K1 > ,
271
240
inout AttributedString . SingleAttributeTransformer < K2 > ) -> Void
272
- ) -> AttributedString
273
- where
274
- K1. Value : Sendable ,
275
- K2. Value : Sendable {
241
+ ) -> AttributedString {
276
242
self . transformingAttributes ( K1 . self, K2 . self, c)
277
243
}
278
244
279
- @preconcurrency
280
245
public func transformingAttributes< K1, K2, K3> (
281
246
_ k: KeyPath < AttributeDynamicLookup , K1 > ,
282
247
_ k2: KeyPath < AttributeDynamicLookup , K2 > ,
283
248
_ k3: KeyPath < AttributeDynamicLookup , K3 > ,
284
249
_ c: ( inout AttributedString . SingleAttributeTransformer < K1 > ,
285
250
inout AttributedString . SingleAttributeTransformer < K2 > ,
286
251
inout AttributedString . SingleAttributeTransformer < K3 > ) -> Void
287
- ) -> AttributedString
288
- where
289
- K1. Value : Sendable ,
290
- K2. Value : Sendable ,
291
- K3. Value : Sendable {
252
+ ) -> AttributedString {
292
253
self . transformingAttributes ( K1 . self, K2 . self, K3 . self, c)
293
254
}
294
255
295
- @preconcurrency
296
256
public func transformingAttributes< K1, K2, K3, K4> (
297
257
_ k: KeyPath < AttributeDynamicLookup , K1 > ,
298
258
_ k2: KeyPath < AttributeDynamicLookup , K2 > ,
@@ -302,16 +262,10 @@ extension AttributedString {
302
262
inout AttributedString . SingleAttributeTransformer < K2 > ,
303
263
inout AttributedString . SingleAttributeTransformer < K3 > ,
304
264
inout AttributedString . SingleAttributeTransformer < K4 > ) -> Void
305
- ) -> AttributedString
306
- where
307
- K1. Value : Sendable ,
308
- K2. Value : Sendable ,
309
- K3. Value : Sendable ,
310
- K4. Value : Sendable {
265
+ ) -> AttributedString {
311
266
self . transformingAttributes ( K1 . self, K2 . self, K3 . self, K4 . self, c)
312
267
}
313
268
314
- @preconcurrency
315
269
public func transformingAttributes< K1, K2, K3, K4, K5> (
316
270
_ k: KeyPath < AttributeDynamicLookup , K1 > ,
317
271
_ k2: KeyPath < AttributeDynamicLookup , K2 > ,
@@ -323,13 +277,7 @@ extension AttributedString {
323
277
inout AttributedString . SingleAttributeTransformer < K3 > ,
324
278
inout AttributedString . SingleAttributeTransformer < K4 > ,
325
279
inout AttributedString . SingleAttributeTransformer < K5 > ) -> Void
326
- ) -> AttributedString
327
- where
328
- K1. Value : Sendable ,
329
- K2. Value : Sendable ,
330
- K3. Value : Sendable ,
331
- K4. Value : Sendable ,
332
- K5. Value : Sendable {
280
+ ) -> AttributedString {
333
281
self . transformingAttributes ( K1 . self, K2 . self, K3 . self, K4 . self, K5 . self, c)
334
282
}
335
283
}
0 commit comments