Swift

Basic Class Syntax in Swift

Like most programming languages, Swift comes with the ability to create classes. Here are some examples of basic class syntax in Swift 3.
Definition
To define the class, use the class keyword followed by the name of your class. Classes their entire definition within a pair of curly braces.
class Colour {

}
You …

Add a Navigation Controller in Xcode

Most beginners start learning the components of Xcode by creating a single view application project. At some point, they start to wonder how to add a navigation controller in Xcode so that they can move between different views of the application.
Add a View Controller
So how can this be achieved? Firstly, another view needs …

Stack Views in Xcode

Stack Views in Xcode allow you to lay out a series of views horizontally or vertically and are a trivial solution to create layouts of increasing complexity.
We talked about constraints in the previous article using Auto Layout, however the more elements you add to your view, the more constraints you have to add and …

Using Autolayout in Xcode

When you add an object from the object library in Xcode, the position of the object within your view needs to be in the same position when viewing on different device widths. This article will look at using Autolayout in Xcode 8.
As an example, here is a label that has been centred in the …

Add Swift Assets in Xcode

If you’re starting out creating a Swift project in Xcode one of the first things you’ll want to learn to how to add images, icons and more. Here is how to add Swift assets in Xcode.
If you have Xcode open, locate the Assets.xcassets folder within your project navigator.

Setting your App Icon
Within …

Getting Started with Storyboards

Storyboards are a feature within Xcode that are used to help you visually see your application flow and how your views are connected within an iOS application. This article will assist you in getting started with storyboards in Xcode, and show you to manage your different views.
When you create a new single view application, …

Basic Syntax for Swift

With all programming languages, Swift comes with its own syntax of declaring variables, functions and so on. Here are some code examples representing the basic syntax for Swift 3.
In order to test the code, it is recommended to use the Xcode playground. This can be opened by opening up Xcode, and choosing the ‘Get …

Getting Started with Swift 3

Swift is a programming language for macOS, iOS, watchOS and tvOS. The third version of Swift was released earlier this year, and is available for Xcode 8. This article will help beginners in getting started with Swift 3, and setting up a basic project within Xcode.
To start with, open up Xcode and create a …