@@ -52,9 +52,7 @@ extension AttributedString {
5252 andChanged changed: AttributedString . SingleAttributeTransformer < K > ,
5353 to attrStr: inout AttributedString ,
5454 key: K . Type
55- )
56- where
57- K. Value : Sendable {
55+ ) {
5856 if orig. range != changed. range || orig. attrName != changed. attrName {
5957 attrStr. _guts. removeAttributeValue ( forKey: K . self, in: orig. range. _bstringRange) // If the range changed, we need to remove from the old range first.
6058 }
@@ -65,7 +63,7 @@ extension AttributedString {
6563 andChanged changed: AttributedString . SingleAttributeTransformer < K > ,
6664 to attrStr: inout AttributedString ,
6765 key: K . Type
68- ) where K . Value : Sendable {
66+ ) {
6967 if orig. range != changed. range || orig. attrName != changed. attrName || orig. attr != changed. attr {
7068 if let newVal = changed. attr { // Then if there's a new value, we add it in.
7169 // 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 {
8078
8179@available ( macOS 12 , iOS 15 , tvOS 15 , watchOS 8 , * )
8280extension AttributedString {
83- @preconcurrency
8481 public func transformingAttributes< K> (
8582 _ k: K . Type ,
8683 _ c: ( inout AttributedString . SingleAttributeTransformer < K > ) -> Void
87- ) -> AttributedString
88- where
89- K. Value : Sendable {
84+ ) -> AttributedString {
9085 let orig = AttributedString ( _guts)
9186 var copy = orig
9287 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 {
10095 return copy
10196 }
10297
103- @preconcurrency
10498 public func transformingAttributes< K1, K2> (
10599 _ k: K1 . Type ,
106100 _ k2: K2 . Type ,
107101 _ c: ( inout AttributedString . SingleAttributeTransformer < K1 > ,
108102 inout AttributedString . SingleAttributeTransformer < K2 > ) -> Void
109- ) -> AttributedString
110- where
111- K1. Value : Sendable ,
112- K2. Value : Sendable {
103+ ) -> AttributedString {
113104 let orig = AttributedString ( _guts)
114105 var copy = orig
115106 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 {
127118 return copy
128119 }
129120
130- @preconcurrency
131121 public func transformingAttributes< K1, K2, K3> (
132122 _ k: K1 . Type ,
133123 _ k2: K2 . Type ,
134124 _ k3: K3 . Type ,
135125 _ c: ( inout AttributedString . SingleAttributeTransformer < K1 > ,
136126 inout AttributedString . SingleAttributeTransformer < K2 > ,
137127 inout AttributedString . SingleAttributeTransformer < K3 > ) -> Void
138- ) -> AttributedString
139- where
140- K1. Value : Sendable ,
141- K2. Value : Sendable ,
142- K3. Value : Sendable {
128+ ) -> AttributedString {
143129 let orig = AttributedString ( _guts)
144130 var copy = orig
145131 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 {
161147 return copy
162148 }
163149
164- @preconcurrency
165150 public func transformingAttributes< K1, K2, K3, K4> (
166151 _ k: K1 . Type ,
167152 _ k2: K2 . Type ,
@@ -171,12 +156,7 @@ extension AttributedString {
171156 inout AttributedString . SingleAttributeTransformer < K2 > ,
172157 inout AttributedString . SingleAttributeTransformer < K3 > ,
173158 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 {
180160 let orig = AttributedString ( _guts)
181161 var copy = orig
182162 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 {
202182 return copy
203183 }
204184
205- @preconcurrency
206185 public func transformingAttributes< K1, K2, K3, K4, K5> (
207186 _ k: K1 . Type ,
208187 _ k2: K2 . Type ,
@@ -214,13 +193,7 @@ extension AttributedString {
214193 inout AttributedString . SingleAttributeTransformer < K3 > ,
215194 inout AttributedString . SingleAttributeTransformer < K4 > ,
216195 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 {
224197 let orig = AttributedString ( _guts)
225198 var copy = orig
226199 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 {
253226
254227@available ( macOS 12 , iOS 15 , tvOS 15 , watchOS 8 , * )
255228extension AttributedString {
256- @preconcurrency
257229 public func transformingAttributes< K> (
258230 _ k: KeyPath < AttributeDynamicLookup , K > ,
259231 _ c: ( inout AttributedString . SingleAttributeTransformer < K > ) -> Void
260- ) -> AttributedString
261- where
262- K. Value : Sendable {
232+ ) -> AttributedString {
263233 self . transformingAttributes ( K . self, c)
264234 }
265235
266- @preconcurrency
267236 public func transformingAttributes< K1, K2> (
268237 _ k: KeyPath < AttributeDynamicLookup , K1 > ,
269238 _ k2: KeyPath < AttributeDynamicLookup , K2 > ,
270239 _ c: ( inout AttributedString . SingleAttributeTransformer < K1 > ,
271240 inout AttributedString . SingleAttributeTransformer < K2 > ) -> Void
272- ) -> AttributedString
273- where
274- K1. Value : Sendable ,
275- K2. Value : Sendable {
241+ ) -> AttributedString {
276242 self . transformingAttributes ( K1 . self, K2 . self, c)
277243 }
278244
279- @preconcurrency
280245 public func transformingAttributes< K1, K2, K3> (
281246 _ k: KeyPath < AttributeDynamicLookup , K1 > ,
282247 _ k2: KeyPath < AttributeDynamicLookup , K2 > ,
283248 _ k3: KeyPath < AttributeDynamicLookup , K3 > ,
284249 _ c: ( inout AttributedString . SingleAttributeTransformer < K1 > ,
285250 inout AttributedString . SingleAttributeTransformer < K2 > ,
286251 inout AttributedString . SingleAttributeTransformer < K3 > ) -> Void
287- ) -> AttributedString
288- where
289- K1. Value : Sendable ,
290- K2. Value : Sendable ,
291- K3. Value : Sendable {
252+ ) -> AttributedString {
292253 self . transformingAttributes ( K1 . self, K2 . self, K3 . self, c)
293254 }
294255
295- @preconcurrency
296256 public func transformingAttributes< K1, K2, K3, K4> (
297257 _ k: KeyPath < AttributeDynamicLookup , K1 > ,
298258 _ k2: KeyPath < AttributeDynamicLookup , K2 > ,
@@ -302,16 +262,10 @@ extension AttributedString {
302262 inout AttributedString . SingleAttributeTransformer < K2 > ,
303263 inout AttributedString . SingleAttributeTransformer < K3 > ,
304264 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 {
311266 self . transformingAttributes ( K1 . self, K2 . self, K3 . self, K4 . self, c)
312267 }
313268
314- @preconcurrency
315269 public func transformingAttributes< K1, K2, K3, K4, K5> (
316270 _ k: KeyPath < AttributeDynamicLookup , K1 > ,
317271 _ k2: KeyPath < AttributeDynamicLookup , K2 > ,
@@ -323,13 +277,7 @@ extension AttributedString {
323277 inout AttributedString . SingleAttributeTransformer < K3 > ,
324278 inout AttributedString . SingleAttributeTransformer < K4 > ,
325279 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 {
333281 self . transformingAttributes ( K1 . self, K2 . self, K3 . self, K4 . self, K5 . self, c)
334282 }
335283}
0 commit comments