When you’re trying to pick a programming language to learn, it’s easy to gravitate toward the big ones that developers use to create masterpieces of digital content — things like Java, C++, Ruby, and Python. But there are a lot of programming languages out there (including some very weird ones), and they each excel at different things. Why not try learning Swift, the language that will let you create iPhone and iPad apps? These six projects will walk you through it.
Getting Acquainted with Swift
If you’re not familiar with Swift, it’s a language developed by Apple for creating iOS and OS X apps. It borrows ideas from a wide range of other programming languages, but is most similar to Objective-C. In fact, you can mix Swift, C, Objective-C, and C++, and your apps will still work. However, Swift was designed to be concise, making it a bit easier to learn and more efficient to use. It was also designed to be harder to derail with coding mistakes, another factor that makes it good for beginners.
For the tutorials listed below, it’s good to have some basic programming knowledge, but very little is necessary. If you have any experience with C-based languages, you should have no problem. If you’d like to spend some time getting acquainted with Swift before taking on a project, you can check out a wide range of videos and guides, as well as sample code, at Apple’s Swift resources page.
If you think your knowledge is enough to get started, or you’ve taken the time to get a bit more familiar with the basic concepts of Swift, it’s time to move on to some easy projects!
What You’ll Need
The Hello World project is always the first thing a beginning programmer takes on, and Swift is no exception. This Hello World tutorial from AppCoda will show you how to create a very simple app that displays the words “Hello World” on the screen. It’s not super exciting, but it will give you a very basic idea of how Swift works. The entire project will only take you a few minutes, and it’s presented in an easy-to-follow video.
If you want to build something a bit more substantial and useful than a Hello World app, this walkthrough by Jack Watson-Hamblin on airpair is perfect. He takes you through each step required for building a very basic task management app using Swift, and will teach you a lot about the language and development on the way.
The tutorial is presented in three parts, with the first part being an introduction to Swift. Some of the things he talks about will make more sense to those who have some programming experience, but the tutorial can easily be completed by anyone who’s interested.
This walkthrough, created by John Mullins, will show you how to create a very simple “Kamikaze” game in which planes spawn at the top of the screen and the user needs to tap them before they reach the bottom. Once five planes have reached the bottom, the game ends and the user receives a score. Motion and score-keeping are great concepts to be able to institute in an iOS app, so this is a good place to start if you’re interested in developing iPhone games.
If you want to really get into the cool things that Swift can do, you’ll want to try something more complex than the previous tutorials. This tutorial from Bloc will help you use Swift to build a version of Tetris. It’s more involved than the previous projects, and there are a few places where the code isn’t explained quite as clearly as it could be.
However, all of the materials required are given to you in this tutorial, and the inclusion of screenshots and videos makes it easy to follow. And be assured that, although you have to enter your email address to get access, the whole thing is actually free.
Chris Ching has put together a 15-part series that will take you from the very basics, like an introduction to the tools used to create iOS apps, all the way through creating an app that lets you play the card game War. By the end of the series, you’ll understand a lot of programming concepts, some of the unique things you need to know about working with touch interfaces, and how to use images in an iPhone app.
One of the biggest changes brought about by iOS 8 is the ability to use non-system keyboards. Why not create your own keyboard using Swift? This tutorial walks you through the process of creating a calculator keyboard that can be used as an alternative to the standard one included in iOS.
I’d recommend saving this tutorial for last. While it is suitable for beginners, it doesn’t go into as much detail as the others regarding the principles behind the programming that’s going on. Even so, it’ll help you get a better understanding for using Swift and creating app extensions for iOS.
Go Learn Some Swift!
These six tutorials will give you a solid understanding of how to use Swift, and they’ll help you create some real apps along the way. Remember to read the comments for each one if you come across a problem, as others have probably dealt with it, too. And above all, have fun with it! Programming can be tough, but learning through examples like these should be enjoyable.
Swift not your thing? You can learn to develop apps for Android instead.
Have you learned to use Swift? Were there any specific tutorials that you found to be useful?