Quick Start Guide to Swift: Part 4

Welcome to the fourth tutorial in the series. Today we’ll cover many of Swift’s object-oriented features.

What you will learn…

  • Basic object-oriented concepts with Swift

What you should know…

  • A familiarity with object-oriented programming concepts
  • The basics of the Swift programming language from part one, two and three

Swift doesn’t favour one programming paradigm over another. However it does provide excellent object-oriented features, which we’ll explore the basics of.

Many of the topics covered previously, including functions and structures, will be directly applicable to our coverage of Swift’s object-oriented features. Today’s tutorial will walk you through the steps to build and use a class that models a popular weapon from the Star Wars universe.

If you’re comfortable with the topics covered in part three then getting to grips with the basics of object-oriented programming in Swift shouldn’t be too much of a stretch.

Continue Reading

Quick Start Guide to Swift: Part 3

Welcome to the third tutorial in the series. Here we will cover functions and structures. This will put us in good stead for part four where we’ll finally get onto the subject of object-oriented programming.

What you will learn…

  • How to define and call functions
  • How to work with structures

What you should know…

  • The basics of the Swift programming language from part one and two

During this series we’ve used several global functions provided by Swift, such as println and count. Now we’ll see how to write our own custom functions in order to build modular code that can accomplish specific tasks. We’ll also spend considerable time exploring structures, which will effectively let you define your own custom types within Swift.

Functions and structures are both large topics and we certainly won’t cover every aspect of them here. However, both lead very nicely into the subject of object-oriented programming and therefore deserve particular attention before we can begin to work with classes in part four.

Continue Reading

Quick Start Guide to Swift: Part 2

Welcome to the second tutorial in this quick start guide to Swift. We’ll cover some of the concepts from the first part in more detail while also introducing more language features.

What you will learn…

  • More detail regarding strings
  • How to work with arrays and dictionaries
  • Control flow with while loops and the switch statement
  • How to work with enumerations

What you should know…

  • A familiarity with at least one programming language
  • The basics of the Swift programming language from part one

The primary focus of part two will be strings, collection types, control flow, and enumerations. We briefly looked at strings in part one but will spend more time with them here. We’ll also re-visit control flow, taking the time to examine while loops, do-while loops, and Swift’s powerful switch statement. You may have noticed that arrays weren’t covered in part one. We’ll make up for that here and also focus on Swift’s other collection type: dictionaries. Finally we’ll round off part two by covering enumerations.

ECMAScript developers following this series will discover that most of what is covered here isn’t that dissimilar to the features found in languages such as JavaScript and ActionScript. Enumerations being really the only exception for some of you. For those from a C programming background, everything will feel familiar, although you may be surprised at the additional power and flexibility that Swift brings to many of these features.

As stated previously, everything covered in this series of tutorials can also be found in Apple’s own official guide to the Swift programming language. The intention here however is to focus on the elements of the language that are required to get newcomers up and running as quickly as possible. If you have the time and want the full detail then I highly recommend you head straight over to Apple’s Swift Programming Language Guide instead.

Continue Reading

Quick Start Guide to Swift: Part 1

Dive into the Swift programming language with this quick start guide that will have you up and running in no time.

What you will learn…

  • How to work with playgrounds
  • The basics of the Swift programming language
  • Grouping multiple values into a tuple
  • How to work with optionals
  • String fundamentals
  • Control flow

What you should know…

  • A familiarity with at least one programming language

Swift is Apple’s innovative new programming language. If you’ve always wanted to develop iOS or OS X apps but were put off by the seeming complexity of Objective-C then this might be the perfect time to give it a try.

Swift is modern and has been designed to be friendly to new programmers. It’s expressive and is as enjoyable to use as a scripting language. In fact, if you’re coming from a JavaScript or ActionScript background then large parts of Swift will actually feel familiar to you.

This tutorial series however isn’t just for ECMAScript programmers. Those already familiar with Objective-C, or from a Java or C background, will also find this a good resource for transitioning over to Swift.

Everything covered in this series of tutorials can also be found in Apple’s own official guide to the Swift programming language. The intention here however is to focus on the elements of the language that are required to get newcomers up and running as quickly as possible. If you have the time and want the full detail then I highly recommend you head straight over to Apple’s Swift Programming Language Guide instead.

Continue Reading

Hello and Welcome!

Welcome to my new blog, which will focus on tutorials for Apple’s new programming language, Swift. In the short term I’ll aim to provide tutorials for those new to iOS development. If you’re coming from a JavaScript or ActionScript background then you should feel right at home. If you’re already familiar with Objective-C then don’t worry, as there will be plenty on offer for you too.