Affiliate Disclosure: By buying the products we recommend, you help keep the site alive. Read more.
If you want to try your hand at creating iPhone apps, there are a few different programming languages you can learn. But only one of them was created specifically for iOS: Swift. Apple built this language from the ground up for making macOS, iOS, watchOS, and tvOS apps. And it includes a number of features that make it great for beginning programmers.
If you want to try learning and coding with Swift, the best way to do it is through a project. You can read specs all day, but actually using the language to build an app is the most effective way to learn. These projects will help you get started and teach you some really useful skills along the way.
Getting Acquainted with Swift
Swift borrows ideas from a wide range of other programming languages, but is most similar to Objective-C. In fact, you can mix Swift and Objective-C in your code, 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’s also 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. You can read Apple’s introduction to Swift if you’d like to get the basics down before you get started. But you can also jump right in and you shouldn’t have much trouble.
What You’ll Need
Apple’s Swift Playgrounds app turns your iPad into a great place to learn to code! No coding knowledge is necessary to get started; even kids can learn to code with this app. Challenges, templates, live code previews, and Quick Type suggestions make this a great way to get up and running fast. The 3D world is a lot more compelling than looking at a text document, too. And it’s free! This is definitely the best place to get started if you have little or no coding experience.
This sounds complicated, but it’s meant to be a beginner-friendly tutorial, and Hacking with Swift is great about including a ton of detail to help you understand what you’re doing. The tutorial leads you through loading images, designing an interface, and everything else you’ll need to know. Because it’s designed for beginners, it starts at the very beginning, with how to open a new project in Xcode.
A stopwatch doesn’t sound very exciting, but this tutorial is great for Swift beginners. It’s also built for iOS 10, so you’ll get to see the latest features of Xcode and Swift. In addition to Swift code, you’ll also get a good dose of using Xcode’s visual tools. These can be invaluable in learning to code and are a huge benefit of using Swift.
Whether you want to built regular apps or games, it’s a good idea to understand how manual interactions with your app will work. This is a very simple tutorial that displays a screen full of colored squares. Each square can be dragged by touching the screen. That’s all there is to it. But you’ll see some of the functions required for this type of action, and that’s going to come in handy when you’re developing your own app.
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 Xcode playgrounds, 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. (Scroll down to the bottom of the linked page to get to the tutorials.)
This is the most complicated tutorial here, but you’ll be glad you went through it. The game uses SpriteKit, a 2D game-building toolkit that’s used for many iOS games. With the kit, you’ll use assets, create actions, and establish win and lose conditions. It’s pretty complicated, but explained well. If you’re feeling confident, go ahead and build your own game!
Identify Your User [No Longer Available]
TouchID is one of the really cool things that comes packed with every new iPhone. Many apps are secured by TouchID (it’s especially useful in mobile banking apps) and learning how to take advantage of it can save your users a lot of time when it comes to entering usernames and passwords. This tutorial shows you how to check for TouchID compatibility, authenticate your user, and offer a password screen if they fail.
3D Touch is another cool feature of iOS devices, and Swift makes it really easy to include it in your apps. This tutorial will walk you through creating a simple digital scale that will display the amount of pressure the user is putting on the screen. The app can also be used to actually weigh things, which is pretty cool!
You may find push notifications annoying, but there are some apps that make great use of them. If you want to learn how to use push notifications in your own app, you’ll have to learn about creating your app ID and enabling those notifications for it. It’s a bit of a roundabout process, but going through this step-by-step tutorial makes it much easier. This is a long tutorial, and a lot of it is administrative stuff that’s not very exciting. But if you’re serious about developing your own app, it’s full of important things you’ll need to know.
Go Learn Some Swift!
These 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? Share your favorites in the comments below!