Types are nice: recursive types, in Swift

Some time ago, I had hopes of completely masking one of my app's services' inner pagination logic. Ideally, that meant my Controllers or ViewModels wouldn't need to know anything about how the service handled pagination. Nothing. Not whether or not there was a next page of results. Not even the parameters needed by the service to retrieve it.

Seems obscure? The gist is quite straightforward:

func getItems() -> (results: [Item], next: (() -> [Item])?)