XKCD

From web-comic to an iOS 8 Swift App

To put the basics of Swift & iOS 8 components I learnt to use, I took the concept of killing time in a unique way from the following XKCD web-comic and implemented it as an iOS app.

The basic premise of the app is that sliding the slider to the right will change the value of P as described in the formula:

T = (Current date) – (e^20.3444p^3+3 – e^3)years

P is the percentage of time elapsed, and adjusting it will give you T, a year backwards in time from the current date.

I then take that date and make a query to the Wikipedia Rest API that returns a JSON object of all the events that occurred that year. This is where I ran into a minor speed bump, as the Wikipedia API returns the entire page HTML in the JSON object, therefore I have to parse the HTML for only the appropriate information and then display that.

XKCD_01

XKCD_02

XKCD_03

You can read more about the web-comic here or download and install the app from the GitHub Repo

Backwards in time


Comments are closed.