How I started programming my first iOS App.
Why did I want to program an App?
Back in July 2016, I had the idea of a device that at some point was called the Bell-O. This device is supposed to work as a plug-and-play, kind of desktop walkie-talkie, that runs on wifi and/or 4G connection.
The operating system on the Bell-O was Debian, and I the software that I was „customizing“ was written in C. Having to both deal with a Command Line Interface (CLI: the black matrix like window that you see when „hackers“ work in the movies“).
As it always happens, I realized that I don’t really know how any of those things work. So I „decided“ to learn a bit of programming. Looking through Quora, the advise oftentimes is such: „Learn one object-oriented language and one functional programming language“.
Python and C, for example. But classical C was not something that I was particularly drawn to. At some point I realized that Swift might be an interesting language to learn, you could do „Apps“ with that.
I never too much believed in Apps, something that most likely has something to do with my experience at GamePix in Rome, a game aggregator for HTML 5 games. The guys always said: one day, we won’t have Apps anymore, because anything will be browser based. But wanting to exploit the hardware features of the phones as well, Native Apps are the way to go.
In October 2017, I spent a month in Berlin. Since I have been interested in history my whole life, and at the same time not knowing the city too well, I fairly often asked myself: Am I former East or West-Berlin. Now that I have been seriously living in Berlin for a couple of months I slowly developed a feeling for East and West. There are obviously other things that tell you whether you are in the east or the west (Ampelmännchen, the Tram etc.), but that’s a whole different story. I googled a bit and found some maps that depicted the old runnings of the map, that came in very helpful.
So now I had a project with which I could learn the skills and bring them to life. I decided to start an Online-Course on Udemy, and pretty quickly found an iOS Course by Angela Yu, who has amazing teaching skills and is a pleasure to listen to. The course quickly gives you the basics in programming in Swift and quickly lets you load your own app on your iPhone. Amazeballs.
I started the course and arrived at maybe 50% of the content until I just wanted to try things out and start building the App. While still working full-time, I tried to program a bit around in the evenings, still living in Rome at the time.
Breaking down the fundamental problems was pretty straight-forward:
- Get the location of the user
- Check if the location is in the East / West
- Return result to the user
But how do I know what is East and what is West? I started to look for maps showing which part is which. But thinking more about it, it was even easier: The West was encircled by the wall. So having the coordinates of the wall you can draw the polygon (or Fläche that represents former West-Berlin).
If you now check whether one point (the coordinates where the user is right now) is within the polygon, you know if someone is in the West. If he’s not in the West, he must be in the East. This is very oversimplified and does not take any edge cases into account, but it works in 99% of all usage cases in the real world.
By using if statements, I got this covered. Now I just had to figure out how to implement a polygon into the App. And that’s when I turned back to Quora to ask for some help. I had understood that checking whether a point lies inside of a polygon is kind of a geometrical problem and not that easily realized.