Generating UIButtons from a loop

This is a very useful technique and it’s pretty straight forward. Let’s say we have an array of items or heroes and we want to dynamically create buttons that will do something linked to the hero/item selected. One example is if you have an array of saved games and you want to generate buttons to […] Continue reading →

Setting up backgrounds for UIView

There are different ways of setting up backgrounds in Swift, depending on the object, method, background type etc. We will go through some of these here. Setting up a background image for a UIView: Replace “myImage.png” with the name of your image. Note: Make sure you add your images to the Bundle first. To […] Continue reading →

Contacts App / Inventory with Archiving 2.0

Hi, all Here is the updated version of the Contacts app with archiving. It will now let you save and load multiple contacts. I am just going to list some of the new things added. Here are the previous and next buttons on the Load View screen:       Here are the […] Continue reading →

Multiplications Table app

Ok, this app will be just an example of how to create things programmatically, without using the Auto Layout or any of the other fancy things within XCode. It’s a very simple app, but to me it was a very good experience learning to build and troubleshoot things directly in code. The app will look […] Continue reading →

Contacts App / Inventory with Archiving

Here is the latest app. It is supposed to be an contacts inventory app. This is the first version as it is just letting you save/load one contact. Key points here are: creating custom Classes archiving / unarchiving with NSCoding using multiple UIViews with Navigation Controller using multiple, nested ‘if {} else {}’ statements separating […] Continue reading →

Saving and Loading Images, Swift 2.0

This will show you how to save and load images in a way that is very easy and straight forward. Here is the function to save your image first. We’ll assume you already have an UIImageView, containing an image, named ‘image’ : Here is how to use the function later in your code: […] Continue reading →

Creating a Tap Gesture

Hi, here is a basic example of creating and applying a tap gesture. This is one of the simpler gestures and it’s fairly easy to use. First we are going to create the Gesture Recognizer, using the built in UITapGestureRecognizer function provided by Apple. Please make sure the matches the function name below. […] Continue reading →

Task List App

Here is a complete example of a task list app. Originally this was a more simple exercise on which I just decided to build on. I have tested it it multiple times and fixed at least 20-30 bugs with it, but I am sure there are more things. There is almost no verification against correct […] Continue reading →

Tip Calculator App

  Hi, this is another basic app, that seems to be a must for every beginner. Again we are implementing the use of a slider and some basic math operations. Also this will help you understand how to put everything you need to reuse in a function. It makes things much more easy to use, […] Continue reading →

Turkey Baking Calculator App

This is an example code again for an exercise of the same class. The main goal is to create a baking calculator. It teaches you how to use some very important and basic functions like: using a slider how to convert time units and present them properly basic calculations basic user interface Here are a […] Continue reading →