@@ -39,7 +39,7 @@ import ReactiveSwift
39
39
) -> Self where Error == Never {
40
40
var task : Task < Void , Never > ?
41
41
return . future { callback in
42
- task = Task ( priority: priority) {
42
+ task = Task ( priority: priority) { @ MainActor in
43
43
guard !Task. isCancelled else { return }
44
44
let output = await operation ( )
45
45
guard !Task. isCancelled else { return }
@@ -84,20 +84,20 @@ import ReactiveSwift
84
84
deferred {
85
85
var task : Task < ( ) , Never > ?
86
86
let producer = SignalProducer { observer, lifetime in
87
- task = Task ( priority: priority) {
88
- do {
89
- try Task . checkCancellation ( )
90
- let output = try await operation ( )
91
- try Task . checkCancellation ( )
87
+ task = Task ( priority: priority) { @ MainActor in
88
+ do {
89
+ try Task . checkCancellation ( )
90
+ let output = try await operation ( )
91
+ try Task . checkCancellation ( )
92
92
observer. send ( value: output)
93
93
observer. sendCompleted ( )
94
- } catch is CancellationError {
94
+ } catch is CancellationError {
95
95
observer. sendCompleted ( )
96
- } catch {
96
+ } catch {
97
97
observer. send ( error: error)
98
- }
99
98
}
100
99
}
100
+ }
101
101
102
102
return producer. on ( disposed: task? . cancel)
103
103
}
0 commit comments