Sample iOS application to get information about countries of the world.
Update submodules to get country flags by executing the following commands:
git submodule init
git submodule update
Supposed to be running on iOS 8 and later.
Information about countries are retrieved from here and stored in the persistent storage driven by CoreData.
Necessary updates are abstracted by RTCountriesDataProvider
and stored in the background context and saved the view context in butch generating corresponding changes needed to refresh UI. The provider uses NSURLSession
to obtain data and process it in the background not to block UI.
NSFetchedResultsController
is used to generate corresponding UI updates in the table view and filter the list of countries.
The UI is not bound to a predefined form factor of device, but the Master-Detail Interface is used to present the list of countries and information about them.
Storyboard is used for defining relationship between UI elements and NSLocalizedString
is used for localisations.
Artificial brand color is used to tint standard controls.
Pull to refresh is used to update information about countries.
- Test Harness: not currently implemented for the sake of simplicity, but network calls can be stubbed using the OHHTTPStubs framework and at lest data provider can be verified
- Information about country names is not localised, so it has to be worked out properly for corresponding internationalisation, moreover current implementation of grouping and filtering has to be adjusted
- Country flags are currently static resources increasing the bundle size, information about countries contains links to corresponding SVG assets. Since it's not possible to render SVG on iOS without external libraries it was decided not to use them, but having them downloaded and rendered is really big win as country flags are formed from simple primitives, so SVG files are lightweight, and their rendered versions could be cached and reused.
- At the moment not all available information about countries is presented, so it has to be expanded
- Cancellation of data updates is to be improved as currently only network requests can be cancelled, but upcoming parsing of JSON data and updates of persistent storage have to be cancellable as well
- Network availability is not tracked, but it makes sense to do to reload the data when the previous reload failed because of no connection