Learning Swift 2 and my second app!

Xcode and Swift

I’ve been developing my basic skills in the programming language Swift and slowly getting my head round the Xcode environment. I’m glad I’ve been learning Python over the last few months as it’s given me a good grounding in coding terminology and techniques which I can apply in a not so vastly different way in Swift. The Xcode playground/Swift and Python IDE are not vastly dissimilar in the sense that both run code “live“. Swift and Python seem to have a fair few similarities in language but also some quite big differences. Both seem (in the scheme of being a newbie to coding!) relatively easy to pick up.

Swift basics

I’ve been exploring the Xcode “Playground” which enables a split view focussed entirely on the code on the left and the output on the right. What I like in particular about the Xcode environment is that when you type code, the software attempts to predict your text and highlights errors quickly.

Swift 2 basics

Swift 2 basics – Types of Variables running in the Playground

I’m really focussing on the basics at the moment, in particular the coding language. I’ve still got lots to learn but I’ve looked at: variables, types of variables and conversion, unwrapping, arrays, dictionaries and IF and ELSE statements. I’ve been trying to practice these skills then integrate them into my previous learning – which has lead to the development of my second app, Fingers.

IF and ELSE statements

IF and ELSE statements running in Xcode Playground


The aim of the Fingers app is simple, guess how many “virtual” fingers are being held up, let the user input a number then let them know if their guess is right or wrong. Based on the knowledge I’ve developed already, I quickly knocked up a UI with a couple of labels, a text input field, a button and some simple graphics. I also created a simple loading screen. I connected the relevant UI interface outputs and actions to the code and then attempted a basic IF and ELSE statement.

Screen Shot 2016-01-24 at 22.20.35

Fingers UI design in Xcode

The first version of the app was a success, until I entered some code to try and hide the keyboard. Lots of errors popped up all over the place and after an hour of exploring, I gave up! I started again from scratch (this time avoiding the extra code) and succeeded in building a working app for an iPhone 5S. Even more fun was to download this directly onto my iPhone and run it immediately. It’s a steep learning curve, but a few days ago I had no idea where to start when building an app, now I’ve made 2! Tonnes more to learn but going to keep practicing!

Fingers app screen shot

Screen shot of Fingers app running on iPhone 5S


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s