Write a component for iOS that implements an advert system as follows:
1. Component downloads data in JSON format from URL
2. This data is stored locally
3. Ads are rotated randomly
4. If a user clicks on a Advert, then advert text is displayed
5. Click data is sent back to server.
1. This is designed to be a component of another project, so the code should be packaged so
it can be "dropped in" to existing code, ideally as one class or package, with no dependencies.
Only the following properties should be public
- PublisherId : A numeric identifier of the publisher *
- ElementId: The visual element used to display adverts on the app *
- RotationInterval : Time between ads being displayed, default to 10 seconds
- AdvertRenderer: A delegate accepting a string that can be overridden by the developer to change how advert text is displayed
Only Properties marked (*) are mandatory
2. The system is designed to work offline - with no internet connection; this means
- If the download of JSON data fails, then the most recent cached data should be used.
- If the click data cannot be sent back to the server, then it should be stored locally, until the device is online, then reported.
3. A readme file should be provided allowing a non-expert developer include this component in their iOS project.