I made a few gateways / providers to integrate with an API in my API, using RX Swift and I'm trying to handle the pagination in what seems to me like a clean and simple way.
Basically, the function signature would look like that:
func getPlaces(with location: CLLocationCoordinate2D) -> Observable<(value: [Place], next: Observable<(value: [Places], Observable<(value: [Place], next: ... ... >>
This quickly appears impractical, so I tried creating a typealias for that:
typealias Result = Observable<(value: [Place], next: Result?)>
So my function signature would look like this:
func getPlaces(with location: CLLocationCoordinate2D) -> Result
But Xcode wouldn't get fooled so easily and calls me out for referencing my typealias inside itself
So... is it even doable ? How ?