I have used a few different strategies in the past to provide the best user experience when going through various screens of a REST based iOS app:
- leverage NSURLCache: Although this works fine for certain use cases, I am more interested in an approach that works like this: "display cache immediately while calling API, then update screen with newer data if necessary". NSURLCache seems to only provide me with options such as read form cache OR read from remote depending on various policies, but not read from cache THEN read from remote.
- leverage core data: Either through Restkit, AFIncrementalStore or custom framework, the idea here is to get data from core data while the call is being made. Once the call returns, core data is updated with latest data and interface is refreshed. It can work great, but requires a great deal of configuration and maintenance, adds a high level of complexity. It is a good option when requiring offline mode, but if only caching is required, this looks overkill. -
Does anybody has a different approach to this, or has a lightweight library to recommend that provides advanced caching functionality, without requiring Core Data?