@@ -17,7 +17,8 @@ extension SharedSequenceConvertibleType {
17
17
- parameter selector: A transform function to apply to each source element.
18
18
- returns: An observable sequence whose elements are the result of invoking the transform function on each element of source.
19
19
*/
20
- public func map< Result> ( _ selector: @escaping ( Element ) -> Result ) -> SharedSequence < SharingStrategy , Result > {
20
+ @preconcurrency @MainActor
21
+ public func map< Result> ( _ selector: @escaping @MainActor ( Element ) -> Result ) -> SharedSequence < SharingStrategy , Result > {
21
22
let source = self
22
23
. asObservable ( )
23
24
. map ( selector)
@@ -35,7 +36,8 @@ extension SharedSequenceConvertibleType {
35
36
- returns: An observable sequence whose elements are the result of filtering the transform function for each element of the source.
36
37
37
38
*/
38
- public func compactMap< Result> ( _ selector: @escaping ( Element ) -> Result ? ) -> SharedSequence < SharingStrategy , Result > {
39
+ @preconcurrency @MainActor
40
+ public func compactMap< Result> ( _ selector: @escaping @MainActor ( Element ) -> Result ? ) -> SharedSequence < SharingStrategy , Result > {
39
41
let source = self
40
42
. asObservable ( )
41
43
. compactMap ( selector)
@@ -51,7 +53,8 @@ extension SharedSequenceConvertibleType {
51
53
- parameter predicate: A function to test each source element for a condition.
52
54
- returns: An observable sequence that contains elements from the input sequence that satisfy the condition.
53
55
*/
54
- public func filter( _ predicate: @escaping ( Element ) -> Bool ) -> SharedSequence < SharingStrategy , Element > {
56
+ @preconcurrency @MainActor
57
+ public func filter( _ predicate: @escaping @MainActor ( Element ) -> Bool ) -> SharedSequence < SharingStrategy , Element > {
55
58
let source = self
56
59
. asObservable ( )
57
60
. filter ( predicate)
@@ -92,7 +95,8 @@ extension SharedSequenceConvertibleType {
92
95
- returns: An observable sequence whose elements are the result of invoking the transform function on each element of source producing an
93
96
Observable of Observable sequences and that at any point in time produces the elements of the most recent inner observable sequence that has been received.
94
97
*/
95
- public func flatMapLatest< Sharing, Result> ( _ selector: @escaping ( Element ) -> SharedSequence < Sharing , Result > )
98
+ @preconcurrency @MainActor
99
+ public func flatMapLatest< Sharing, Result> ( _ selector: @escaping @MainActor ( Element ) -> SharedSequence < Sharing , Result > )
96
100
-> SharedSequence < Sharing , Result > {
97
101
let source : Observable < Result > = self
98
102
. asObservable ( )
@@ -111,7 +115,8 @@ extension SharedSequenceConvertibleType {
111
115
- parameter selector: A transform function to apply to element that was observed while no observable is executing in parallel.
112
116
- returns: An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence that was received while no other sequence was being calculated.
113
117
*/
114
- public func flatMapFirst< Sharing, Result> ( _ selector: @escaping ( Element ) -> SharedSequence < Sharing , Result > )
118
+ @preconcurrency @MainActor
119
+ public func flatMapFirst< Sharing, Result> ( _ selector: @escaping @MainActor ( Element ) -> SharedSequence < Sharing , Result > )
115
120
-> SharedSequence < Sharing , Result > {
116
121
let source : Observable < Result > = self
117
122
. asObservable ( )
@@ -134,7 +139,8 @@ extension SharedSequenceConvertibleType {
134
139
- parameter onDispose: Action to invoke after subscription to source observable has been disposed for any reason. It can be either because sequence terminates for some reason or observer subscription being disposed.
135
140
- returns: The source sequence with the side-effecting behavior applied.
136
141
*/
137
- public func `do`( onNext: ( ( Element ) -> Void ) ? = nil , afterNext: ( ( Element ) -> Void ) ? = nil , onCompleted: ( ( ) -> Void ) ? = nil , afterCompleted: ( ( ) -> Void ) ? = nil , onSubscribe: ( ( ) -> Void ) ? = nil , onSubscribed: ( ( ) -> Void ) ? = nil , onDispose: ( ( ) -> Void ) ? = nil )
142
+ @preconcurrency @MainActor
143
+ public func `do`( onNext: ( @MainActor ( Element ) -> Void ) ? = nil , afterNext: ( @MainActor ( Element ) -> Void ) ? = nil , onCompleted: ( @MainActor ( ) -> Void ) ? = nil , afterCompleted: ( @MainActor ( ) -> Void ) ? = nil , onSubscribe: ( @MainActor ( ) -> Void ) ? = nil , onSubscribed: ( @MainActor ( ) -> Void ) ? = nil , onDispose: ( ( ) -> Void ) ? = nil )
138
144
-> SharedSequence < SharingStrategy , Element > {
139
145
let source = self . asObservable ( )
140
146
. do ( onNext: onNext, afterNext: afterNext, onCompleted: onCompleted, afterCompleted: afterCompleted, onSubscribe: onSubscribe, onSubscribed: onSubscribed, onDispose: onDispose)
@@ -184,7 +190,8 @@ extension SharedSequenceConvertibleType {
184
190
- parameter keySelector: A function to compute the comparison key for each element.
185
191
- returns: An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence.
186
192
*/
187
- public func distinctUntilChanged< Key: Equatable > ( _ keySelector: @escaping ( Element ) -> Key ) -> SharedSequence < SharingStrategy , Element > {
193
+ @preconcurrency @MainActor
194
+ public func distinctUntilChanged< Key: Equatable > ( _ keySelector: @escaping @MainActor ( Element ) -> Key ) -> SharedSequence < SharingStrategy , Element > {
188
195
let source = self . asObservable ( )
189
196
. distinctUntilChanged ( keySelector, comparer: { $0 == $1 } )
190
197
return SharedSequence ( source)
@@ -196,7 +203,8 @@ extension SharedSequenceConvertibleType {
196
203
- parameter comparer: Equality comparer for computed key values.
197
204
- returns: An observable sequence only containing the distinct contiguous elements, based on `comparer`, from the source sequence.
198
205
*/
199
- public func distinctUntilChanged( _ comparer: @escaping ( Element , Element ) -> Bool ) -> SharedSequence < SharingStrategy , Element > {
206
+ @preconcurrency @MainActor
207
+ public func distinctUntilChanged( _ comparer: @escaping @MainActor ( Element , Element ) -> Bool ) -> SharedSequence < SharingStrategy , Element > {
200
208
let source = self . asObservable ( )
201
209
. distinctUntilChanged ( { $0 } , comparer: comparer)
202
210
return SharedSequence < SharingStrategy , Element > ( source)
@@ -209,7 +217,8 @@ extension SharedSequenceConvertibleType {
209
217
- parameter comparer: Equality comparer for computed key values.
210
218
- returns: An observable sequence only containing the distinct contiguous elements, based on a computed key value and the comparer, from the source sequence.
211
219
*/
212
- public func distinctUntilChanged< K> ( _ keySelector: @escaping ( Element ) -> K , comparer: @escaping ( K , K ) -> Bool ) -> SharedSequence < SharingStrategy , Element > {
220
+ @preconcurrency @MainActor
221
+ public func distinctUntilChanged< K> ( _ keySelector: @escaping @MainActor ( Element ) -> K , comparer: @escaping ( K , K ) -> Bool ) -> SharedSequence < SharingStrategy , Element > {
213
222
let source = self . asObservable ( )
214
223
. distinctUntilChanged ( keySelector, comparer: comparer)
215
224
return SharedSequence < SharingStrategy , Element > ( source)
@@ -226,7 +235,8 @@ extension SharedSequenceConvertibleType {
226
235
- parameter selector: A transform function to apply to each element.
227
236
- returns: An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence.
228
237
*/
229
- public func flatMap< Sharing, Result> ( _ selector: @escaping ( Element ) -> SharedSequence < Sharing , Result > ) -> SharedSequence < Sharing , Result > {
238
+ @preconcurrency @MainActor
239
+ public func flatMap< Sharing, Result> ( _ selector: @escaping @MainActor ( Element ) -> SharedSequence < Sharing , Result > ) -> SharedSequence < Sharing , Result > {
230
240
let source = self . asObservable ( )
231
241
. flatMap ( selector)
232
242
@@ -355,7 +365,8 @@ extension SharedSequenceConvertibleType {
355
365
- parameter accumulator: An accumulator function to be invoked on each element.
356
366
- returns: An observable sequence containing the accumulated values.
357
367
*/
358
- public func scan< A> ( _ seed: A , accumulator: @escaping ( A , Element ) -> A )
368
+ @preconcurrency @MainActor
369
+ public func scan< A> ( _ seed: A , accumulator: @escaping @MainActor ( A , Element ) -> A )
359
370
-> SharedSequence < SharingStrategy , A > {
360
371
let source = self . asObservable ( )
361
372
. scan ( seed, accumulator: accumulator)
@@ -398,7 +409,8 @@ extension SharedSequence {
398
409
- parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.
399
410
- returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.
400
411
*/
401
- public static func zip< Collection: Swift . Collection , Result> ( _ collection: Collection , resultSelector: @escaping ( [ Element ] ) throws -> Result ) -> SharedSequence < SharingStrategy , Result >
412
+ @preconcurrency @MainActor
413
+ public static func zip< Collection: Swift . Collection , Result> ( _ collection: Collection , resultSelector: @escaping @MainActor ( [ Element] ) throws -> Result ) -> SharedSequence < SharingStrategy , Result >
402
414
where Collection. Element == SharedSequence < SharingStrategy , Element > {
403
415
let source = Observable . zip ( collection. map { $0. asSharedSequence ( ) . asObservable ( ) } , resultSelector: resultSelector)
404
416
return SharedSequence < SharingStrategy , Result > ( source)
@@ -425,7 +437,8 @@ extension SharedSequence {
425
437
- parameter resultSelector: Function to invoke whenever any of the sources produces an element.
426
438
- returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.
427
439
*/
428
- public static func combineLatest< Collection: Swift . Collection , Result> ( _ collection: Collection , resultSelector: @escaping ( [ Element ] ) throws -> Result ) -> SharedSequence < SharingStrategy , Result >
440
+ @preconcurrency @MainActor
441
+ public static func combineLatest< Collection: Swift . Collection , Result> ( _ collection: Collection , resultSelector: @escaping @MainActor ( [ Element] ) throws -> Result ) -> SharedSequence < SharingStrategy , Result >
429
442
where Collection. Element == SharedSequence < SharingStrategy , Element > {
430
443
let source = Observable . combineLatest ( collection. map { $0. asObservable ( ) } , resultSelector: resultSelector)
431
444
return SharedSequence < SharingStrategy , Result > ( source)
@@ -456,9 +469,10 @@ extension SharedSequenceConvertibleType where SharingStrategy == SignalSharingSt
456
469
- parameter resultSelector: A function to combine the unretained referenced on `obj` and the value of the observable sequence.
457
470
- returns: An observable sequence that contains the result of `resultSelector` being called with an unretained reference on `obj` and the values of the original sequence.
458
471
*/
472
+ @preconcurrency @MainActor
459
473
public func withUnretained< Object: AnyObject , Out> (
460
474
_ obj: Object ,
461
- resultSelector: @escaping ( Object , Element ) -> Out
475
+ resultSelector: @escaping @ MainActor ( Object , Element ) -> Out
462
476
) -> SharedSequence < SharingStrategy , Out > {
463
477
SharedSequence ( self . asObservable ( ) . withUnretained ( obj, resultSelector: resultSelector) )
464
478
}
@@ -503,7 +517,8 @@ extension SharedSequenceConvertibleType {
503
517
- parameter resultSelector: Function to invoke for each element from the self combined with the latest element from the second source, if any.
504
518
- returns: An observable sequence containing the result of combining each element of the self with the latest element from the second source, if any, using the specified result selector function.
505
519
*/
506
- public func withLatestFrom< SecondO: SharedSequenceConvertibleType , ResultType> ( _ second: SecondO , resultSelector: @escaping ( Element , SecondO . Element ) -> ResultType ) -> SharedSequence < SharingStrategy , ResultType > where SecondO. SharingStrategy == SharingStrategy {
520
+ @preconcurrency @MainActor
521
+ public func withLatestFrom< SecondO: SharedSequenceConvertibleType , ResultType> ( _ second: SecondO , resultSelector: @escaping @MainActor ( Element , SecondO . Element ) -> ResultType ) -> SharedSequence < SharingStrategy , ResultType > where SecondO. SharingStrategy == SharingStrategy {
507
522
let source = self . asObservable ( )
508
523
. withLatestFrom ( second. asSharedSequence ( ) , resultSelector: resultSelector)
509
524
0 commit comments