I haven’t tried the new betas yet, but I imagine the prevalence of @MainActor in iOS 15 will bring issues to current uses of ReactiveSwift.
Specifically, I imagine you won’t be able to just do this:
producer
.observe(on: UIScheduler())
.start { [label] in label.text = $0 }
Feature request:
for await value in producer.start() {
self.label.text = value
}
Unfortunately for try await would mean we lose error type information, so I would propose this API produces Result<Value, Error>, or a sequence of Value if Error is Never.
I’ll probably work on this throughout the week, but other thoughts are appreciated!
References:
Other ideas:
- Being able to create
SignalProducers using async:
SignalProducer<Int, MyError> { observer, disposable in
observer.send(value: await f1())
guard !disposable.isDisposed else { return }
do {
observer.send(value: try await f2())
} catch {
observer.send(error: error)
}
}
- Or simply just one
async function:
let producer = SignalProducer<Int, Error>(asyncFunction: f)
let values: [Int] = await producer.collect()
let result: Result<[Int], MyError> = try await producer.collect()
I haven’t tried the new betas yet, but I imagine the prevalence of
@MainActoriniOS 15will bring issues to current uses ofReactiveSwift.Specifically, I imagine you won’t be able to just do this:
Feature request:
Unfortunately
for try awaitwould mean we lose error type information, so I would propose this API producesResult<Value, Error>, or a sequence ofValueifErrorisNever.I’ll probably work on this throughout the week, but other thoughts are appreciated!
References:
Other ideas:
SignalProducers usingasync:asyncfunction:collectoverloads: