@@ -17,7 +17,8 @@ extension SharedSequenceConvertibleType {
1717 - parameter selector: A transform function to apply to each source element.
1818 - returns: An observable sequence whose elements are the result of invoking the transform function on each element of source.
1919 */
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 > {
2122 let source = self
2223 . asObservable ( )
2324 . map ( selector)
@@ -35,7 +36,8 @@ extension SharedSequenceConvertibleType {
3536 - returns: An observable sequence whose elements are the result of filtering the transform function for each element of the source.
3637
3738 */
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 > {
3941 let source = self
4042 . asObservable ( )
4143 . compactMap ( selector)
@@ -51,7 +53,8 @@ extension SharedSequenceConvertibleType {
5153 - parameter predicate: A function to test each source element for a condition.
5254 - returns: An observable sequence that contains elements from the input sequence that satisfy the condition.
5355 */
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 > {
5558 let source = self
5659 . asObservable ( )
5760 . filter ( predicate)
@@ -92,7 +95,8 @@ extension SharedSequenceConvertibleType {
9295 - returns: An observable sequence whose elements are the result of invoking the transform function on each element of source producing an
9396 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.
9497 */
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 > )
96100 -> SharedSequence < Sharing , Result > {
97101 let source : Observable < Result > = self
98102 . asObservable ( )
@@ -111,7 +115,8 @@ extension SharedSequenceConvertibleType {
111115 - parameter selector: A transform function to apply to element that was observed while no observable is executing in parallel.
112116 - 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.
113117 */
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 > )
115120 -> SharedSequence < Sharing , Result > {
116121 let source : Observable < Result > = self
117122 . asObservable ( )
@@ -134,7 +139,8 @@ extension SharedSequenceConvertibleType {
134139 - 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.
135140 - returns: The source sequence with the side-effecting behavior applied.
136141 */
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 )
138144 -> SharedSequence < SharingStrategy , Element > {
139145 let source = self . asObservable ( )
140146 . do ( onNext: onNext, afterNext: afterNext, onCompleted: onCompleted, afterCompleted: afterCompleted, onSubscribe: onSubscribe, onSubscribed: onSubscribed, onDispose: onDispose)
@@ -184,7 +190,8 @@ extension SharedSequenceConvertibleType {
184190 - parameter keySelector: A function to compute the comparison key for each element.
185191 - returns: An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence.
186192 */
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 > {
188195 let source = self . asObservable ( )
189196 . distinctUntilChanged ( keySelector, comparer: { $0 == $1 } )
190197 return SharedSequence ( source)
@@ -196,7 +203,8 @@ extension SharedSequenceConvertibleType {
196203 - parameter comparer: Equality comparer for computed key values.
197204 - returns: An observable sequence only containing the distinct contiguous elements, based on `comparer`, from the source sequence.
198205 */
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 > {
200208 let source = self . asObservable ( )
201209 . distinctUntilChanged ( { $0 } , comparer: comparer)
202210 return SharedSequence < SharingStrategy , Element > ( source)
@@ -209,7 +217,8 @@ extension SharedSequenceConvertibleType {
209217 - parameter comparer: Equality comparer for computed key values.
210218 - returns: An observable sequence only containing the distinct contiguous elements, based on a computed key value and the comparer, from the source sequence.
211219 */
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 > {
213222 let source = self . asObservable ( )
214223 . distinctUntilChanged ( keySelector, comparer: comparer)
215224 return SharedSequence < SharingStrategy , Element > ( source)
@@ -226,7 +235,8 @@ extension SharedSequenceConvertibleType {
226235 - parameter selector: A transform function to apply to each element.
227236 - returns: An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence.
228237 */
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 > {
230240 let source = self . asObservable ( )
231241 . flatMap ( selector)
232242
@@ -355,7 +365,8 @@ extension SharedSequenceConvertibleType {
355365 - parameter accumulator: An accumulator function to be invoked on each element.
356366 - returns: An observable sequence containing the accumulated values.
357367 */
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 )
359370 -> SharedSequence < SharingStrategy , A > {
360371 let source = self . asObservable ( )
361372 . scan ( seed, accumulator: accumulator)
@@ -398,7 +409,8 @@ extension SharedSequence {
398409 - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.
399410 - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.
400411 */
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 >
402414 where Collection. Element == SharedSequence < SharingStrategy , Element > {
403415 let source = Observable . zip ( collection. map { $0. asSharedSequence ( ) . asObservable ( ) } , resultSelector: resultSelector)
404416 return SharedSequence < SharingStrategy , Result > ( source)
@@ -425,7 +437,8 @@ extension SharedSequence {
425437 - parameter resultSelector: Function to invoke whenever any of the sources produces an element.
426438 - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.
427439 */
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 >
429442 where Collection. Element == SharedSequence < SharingStrategy , Element > {
430443 let source = Observable . combineLatest ( collection. map { $0. asObservable ( ) } , resultSelector: resultSelector)
431444 return SharedSequence < SharingStrategy , Result > ( source)
@@ -456,9 +469,10 @@ extension SharedSequenceConvertibleType where SharingStrategy == SignalSharingSt
456469 - parameter resultSelector: A function to combine the unretained referenced on `obj` and the value of the observable sequence.
457470 - 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.
458471 */
472+ @preconcurrency @MainActor
459473 public func withUnretained< Object: AnyObject , Out> (
460474 _ obj: Object ,
461- resultSelector: @escaping ( Object , Element ) -> Out
475+ resultSelector: @escaping @ MainActor ( Object , Element ) -> Out
462476 ) -> SharedSequence < SharingStrategy , Out > {
463477 SharedSequence ( self . asObservable ( ) . withUnretained ( obj, resultSelector: resultSelector) )
464478 }
@@ -503,7 +517,8 @@ extension SharedSequenceConvertibleType {
503517 - parameter resultSelector: Function to invoke for each element from the self combined with the latest element from the second source, if any.
504518 - 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.
505519 */
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 {
507522 let source = self . asObservable ( )
508523 . withLatestFrom ( second. asSharedSequence ( ) , resultSelector: resultSelector)
509524
0 commit comments