Closed defagos closed 3 years ago
I implemented Combine support as a new SRGDataProviderCombine
framework. Requests and queues are now available from a corresponding SRGDataProviderNetwork
framework.
I merged my work into the feature/spm-support
branch, as this refactoring heavily relies on the creation of several core modules (for the data model and request construction, mostly).
Proper unit tests are currently missing. Most of the logic has been reused and the rest is mostly Combine stuff. but we should probably have some light UTs as well. This is out of scope for the moment and I want to first validate the new API formalism with our new SwiftUI project (which is the reason I created these Combine helpers in the first place).
Support will be delivered in 9.0.0. It should be pretty good but we are missing proper UTs (the logic is still tested indirectly with SRGDataProviderNetwork
tests).
The support is therefore advertised as being experimental, though I would encourage teams which can afford Combine to use it.
We should add Combine support to SRG Data Provider. While SRG Network works in general, Combine is an even more generic and robust way to perform requests, making it even easier to mix together various kinds of asynchronous tasks (which SRG Network does not allow, as it provides only a formalism for network requests).
If you think about it, the core principles of SRG Network are not very far from those of Combine, though of course Combine is much more refined and generic.
SRGRequest
Combine equivalent is aURLSession
data task publisher, and the equivalent ofSRGRequestQueue
for managing parallel or cascading requests is achieved in Combine withZip
,CombineLatest
,FlatMap
and similar publishers, as well as collections ofAnyCancellable
. So SRG Data Provider SRG Network requests and queues can be replaced with publishers.What SRG Data Provider Combine publishers should still do: