Learn Swift Today

Learn to make iPhone and iPad apps the smart way: my free projects take you from zero to hero even if you've never made an app before.


Get an email when new tutorials are available


How it Works

Hacking with Swift is a complete Swift training course that teaches you app development through 38 hands-on projects. Everything is taught as part of a practical project, so you can immediately apply your knowledge as you learn.

Looking for Swift 2 and iOS 9 changes? All these projects are written for Swift 2, so you're good to go. I also wrote two articles that will interest you: What's New in Swift 2 and What's New in iOS 9. You can find all my free iOS 9 tutorials in one place – there's no faster way to get started!


100% Practical
Everything I teach you is useful, and if you complete this series you'll have over 30 full apps that are yours to extend.


100% iOS 9
This series was written for the latest versions of iOS, so you're guaranteed you're getting the most up to date learning.


100% Swift
All projects were written from scratch using the latest version of Swift, so you can be sure you're learning pure Swift, all the time.

Learn Swift today

Learn Swift the smart way with my hands-on books. Hacking with Swift ($30) gives you 40 hands-on tutorials that teach you Swift while you make real apps, and Pro Swift is a book and video course that gives you the advanced techniques you need to build faster, safer Swift apps.

They are both standalone books, but together form a complete Swift training course suitable for all levels.

If you enjoy Hacking with Swift, please support my work by buying the downloadable e-book. It includes every project in PDF (for desktop), ePub (for iBooks), .mobi (for Amazon Kindle), and HTML, so you can read however you want.

There is no faster way to jumpstart your Swift learning!

Pro Swift is my latest book + video course, covering dozens of advanced tips and techniques that help you write faster, safer Swift in your apps. You get videos, plus PDF, ePub, Mobi, and HTML, for a single price!

Learn all the major new features in iOS 10 using hands-on projects! This new book is written in installments, so you can start learning now – what are you waiting for?

Transfer your Swift knowledge to Objective-C and complete your iOS coding skills – it's easier than you think! Includes PDF, ePub, Mobi, and HTML, plus a 30-minute Swift-to-Objective-C video for a single price!

Beyond Code is a complete book and video course teaching skills such as the Unix command line that powers OS X, regular expressions that help you find and replace complex text, Git source control to share work efficiently, Scrum development to work in agile teams, and more!

Get the Code

The project files for Hacking with Swift are on GitHub, where you can view them, fork them, or download them: click here for the GitHub repo.

View on GitHub

Projects Level 1

There are 30 projects in Level 1 of Hacking with Swift: 10 app projects, 10 game projects, and 10 technique projects that go into depth on specific iOS features. It is strongly recommended that you work through the projects sequentially!

Introduction to Swift

If you're just setting out on your Swift journey, you have a choice to make: would you like to start making apps now, or would you prefer some theory? Start reading here to choose your path.

Tutorial 1: Storm Viewer

Constants and variables, UITableView, UIImageView, NSFileManager, storyboards

Get started coding in Swift by making an image viewer app and learning key concepts.

Tutorial 2: Guess the Flag

Asset catalogs, UIButton, CALayer, UIColor, UIAlertController

Make a game using UIKit, and learn about integers, buttons, colors and actions.

Tutorial 3: Social Media

UIBarButtonItem, UIActivityViewController, NSURL

Let users share to Facebook and Twitter by modifying project 1.

Tutorial 4: Easy Browser

loadView(), WKWebView, NSURLRequest, UIToolbar, UIProgressView, key-value observing

Embed Web Kit and learn about delegation, KVO, classes and UIToolbar.

Tutorial 5: Word Scramble

NSString, closures, method return values, booleans, NSRange

Create an anagram game while learning about closures and booleans.

Tutorial 6: Auto Layout

Get to grips with Auto Layout using practical examples and code.

Tutorial 7: Whitehouse Petitions

JSON, NSData, UITabBarController

Make an app to parse Whitehouse petitions using JSON and a tab bar.

Tutorial 8: 7 Swifty Words

addTarget(), enumerate(), countElements(), find(), join(), property observers, range operators.

Build a word-guessing game and master strings once and for all.

Tutorial 9: Grand Central Dispatch

Learn how to run complex tasks in the background with GCD.

Tutorial 10: Names to Faces

UICollectionView, UIImagePickerController, NSUUID, classes.

Get started with UICollectionView and the photo library.

Tutorial 11: Pachinko

SpriteKit, physics, blend modes, radians, CGFloat, NSKeyedUnarchiver.

Dive into SpriteKit to try your hand at fast 2D games.

Tutorial 12: NSUserDefaults

NSUserDefaults, NSCoding, NSKeyedArchiver.

Learn how to save user settings and data for later use.

Tutorial 13: Instafilter

Core Image, UISlider, writing to the photo library.

Make a photo manipulation program using Core Image filters and a UISlider.

Tutorial 14: Whack-a-Penguin

SKCropNode, SKTexture, dispatch_after()

Build a game using SKCropNode and a sprinkling of Grand Central Dispatch.

Tutorial 15: Animation

Core Animation, CGAffineTransform.

Bring your interfaces to life with animation, and meet switch/case at the same time.

Tutorial 16: JavaScript Injection

Safari extensions, UITextView, NSNotificationCenter.

Extend Safari with a cool feature for JavaScript developers.

Tutorial 17: Swifty Ninja

SKShapeNode, AVAudioPlayer, UIBezierPath, custom enums

Learn to draw shapes in SpriteKit while making a fun and tense slicing game.

Tutorial 18: iAd and Debugging

iAd, println(), assert(), breakpoints.

A double bill of learning teaches you how to place adverts and debug your code.

Tutorial 19: Capital Cities

MKMapView, MKAnnotation, MKPinAnnotationView, CLLocationCoordinate2D.

Teach users about geography while you learn about MKMapView and annotations.

Tutorial 20: Fireworks Night

NSTimer, followPath(), sprite color blending, shake gesture.

Learn about timers and color blends while making things go bang!

Tutorial 21: Local Notifications


Send reminders, prompts and alerts even when your app isn't running.

Tutorial 22: Detect-a-Beacon

CLLocationManager, CLBeaconRegion, CLProximity

Learn to find and range iBeacons using our first project for a physical device.

Tutorial 23: Space Race

Per-pixel collision detection, advancing particle systems, linear and angular damping.

Dodge space debris while you learn about per-pixel collision detection.

Tutorial 24: Swift Extensions

Language extensions, Swift playgrounds.

Try your hand at improving the built-in data types of Swift.

Tutorial 25: Selfie Share

Multipeer Connectivity Framework.

Make a multipeer photo sharing app in just 150 lines of code.

Tutorial 26: Marble Maze

Core Motion, collision bitmasks, array reversing, compiler directives.

Respond to device tilting by steering a ball around a vortex maze.

Tutorial 27: Core Graphics

Core Graphics.

Draw 2D shapes using Apple's high-speed drawing framework.

Tutorial 28: Secret Swift

Touch ID, device keychain.

Save user data securely using the device keychain and Touch ID.

Tutorial 29: Exploding Monkeys

Mixing UIKit and SpriteKit, texture atlases, scene transitions, destructible terrain.

Remake a classic DOS game and learn about destructible terrain and scene transitions.

Tutorial 30: Instruments

Profiling, shadows, image caching

Become a bug detective and track down lost memory, slow drawing and more.

Projects Level 2

Once you have completed all 30 Level 1 projects, you're ready for the all-new Level 2. These projects can be completed in any order you want. New projects are coming soon!

Tutorial 31: Multibrowser

UIStackView, iOS 9 multitasking for iPad, size classes

Get started with UIStackView and see just how easy iPad multitasking is in iOS 9.

Tutorial 32: SwiftSearcher

Core Spotlight, SFSafariViewController, NSAttributedString, Dynamic Type, automatic UITableViewCell sizing

Add your app's content to iOS 9's Spotlight search and take advantage of the new Safari integration.

Tutorial 33: What's that Whistle?

CloudKit, CKRecord, CKQuery, CKSubscription, AVAudioRecorder, and push messages

Build a crowd-sourced song recognition app using Apple's free platform as a service: CloudKit.

Tutorial 34: Four in a Row

GameplayKit, GKMinmaxStrategist, GKGameModel, UIStackView, map().

Let iOS take over the AI in your games using new iOS 9 GameplayKit features.

Tutorial 35: Generating random numbers

GameplayKit, GKRandomSource, GKARC4RandomSource, GKRandomDistribution, GKShuffledDistribution, GKGaussianDistribution.

The new iOS 9 GameplayKit lets you generate random numbers in ways you soon won't be able to live without.

Tutorial 36: Crashy Plane

SKAudioNode, GameplayKit randomization, and the guard keyword.

Ever wanted to make a Flappy Bird clone? Now you can do it in under an hour thanks to SpriteKit.

Tutorial 37: Psychic Tester

CAEmitterLayer, CAGradientLayer, IBDesignable, transitionWithView(), 3D Touch, WatchKit.

Are you psychic? Of course not. But what if we could use our coding skills to make a game to fool your friends into thinking otherwise?

Tutorial 38: GitHub Commits

Core Data, NSFetchRequest, NSSortDescriptor, NSFetchedResultsController, NSDateFormatter.

Get on board with Core Data and learn to read, write and query objects using Apple's object graph and persistence framework.

Tutorial 39: Unit testing with XCTest

XCTest, measureBlock(), filter(), sort(), NSCountedSet.

Learn how to write unit tests and user interface tests using Xcode's built-in testing framework.


Articles are standalone pieces that cover individual concepts, without any sort of project attached.

Get free Swift example code

Search over 300 Swift examples, all updated for Swift 2.2 so you can be guaranteed they work.

Test your Swift skills!

How well do you know Swift? Find out with three graded language tests – good luck!

What's new in iOS 10?

Learn about MSMessagesAppViewController, UIViewPropertyAnimator, SFSpeechRecognizer, UNMutableNotificationContent, SiriKit and much more.

Free iOS 9 tutorials!

This brings together all my iOS 9 tutorials in one place, and it's the perfect way to get started with all the great new features announced by Apple.

What's new in iOS 9?

Learn about Core Spotlight, SFSafariViewController, GameplayKit, app thinning and much more.

What's new in Swift 3?

Learn about the major name changes coming up in Swift 3 with before and after examples.

What's new in Swift 2?

A brief overview of the key changes to Swift introduced at WWDC.

What's new in Swift 2.2?

Learn about the deprecations, additions and improvements in this interim language release.

New features of Swift 2 by example

Try your hand at the new error checking, guard, defer and API availability checking.

Safari Content Blocking in iOS 9: a tutorial by example

How to write a content blocker extension in 10 minutes (and never see the Daily Mail again).


Q: What version of Swift do you use in the series?

A: I used Xcode 7 for all projects, which means Swift 2.2.

Q: Do I need to follow the series in order?

A: Yes, preferably, and definitely so if you're a beginner. Each project builds upon concepts learned in previous projects, so if you skip ahead you might get confused. Some of the technique projects return to earlier apps to fix bugs by teaching a new concept, so if you've finished project 7 (for example) and think, "boy this sucks!" then sit tight: project 9 fixes the problem.

Q: How can I read these tutorials offline / without ads?

A: You can buy the complete Hacking with Swift book set from Gumroad for just $30. It's "pay what you want", so you can contribute more if you want – every penny helps fund me write more great tutorials.

Q: I can already program Swift – will this book teach me new stuff?

A: I wrote a separate book and video course called Pro Swift which teaches advanced Swift coding. It covers functional programming, MVVM, reference and value types, and much more, and includes over 70 videos walking you through the techniques. While Hacking with Swift definitely touches on more advanced topics as you proceed, Pro Swift is all advanced, all the time.

Q: Is knowing Swift enough? Do I also need to know Objective-C?

A: It's true that most iOS jobs want some Objective-C knowledge, because there are over a million apps written in the language. To help you learn, I wrote a book called Objective-C for Swift Developers, which is designed to help you transfer your skills from Swift to Objective-C as quickly as possible.

Q: Can I buy all your books in a bundle?

A: I'm afraid not – Gumroad doesn't support this feature. However, when you buy Hacking with Swift or Pro Swift, you will receive an email from me with a discount code to save money on the other books. So, buy one, wait a couple of hours, then use the discount codes to buy the others.

Q: Can I buy your books on iBooks?

A: Certainly: buy Hacking with Swift on iBooks here or buy Pro Swift on iBooks here. Pro Swift includes over 70 videos as part of the iBooks file.

Q: What are "Pulp Fiction brackets"?

A: Pulp Fiction brackets are < and >, also known as "angle brackets."

Pulp fiction brackets

Q: Why didn't you cover more functional programming?

A: I cover a lot of functional programming in my Pro Swift book, including map, flat map, reduce, and more.

Q: Why don't you distinguish between parameter and argument?

A: Technically, "argument" is the data you pass into a function, and "parameter" is the data you receive, but in the books I use "parameter" exclusively. There are two reasons. First: the difference doesn't really matter, and I've never met someone who found it confusing to refer to parameters as meaning things passed in or received. Second, "argument" is A Very Silly Word, and most people new to programming will associate it with "fight" not "data being sent to a function."

Q: Your description of X is incomplete. Why don't you fix it?

A: As you climb up Wittgenstein's ladder, you'll start to realise that some of my explanations – such as optionals – have been simplified to help you get moving. This isn't me trying to deceive you! Instead, I'm just trying to build a broad cognitive framework that gives you the least you need to know to get results. Sometimes I expand on explanations in later projects, and sometimes you'll need to do extra learning yourself. But in the latter case, I do recommend you complete the series first.

Q: Why do you insist on teaching using projects?

A: My teaching method skips out a lot of theory. It skips out the smart techniques that transform 20 lines of easy-to-understand code into 1 line of near-magic. It ignores coding conventions by the dozen. And perhaps later on, once you've finished, you'll want to go back and learn all the theory I so blithely walked past. But let me tell you this: the problem with learning theory by itself is that your brain doesn't really have any interest in remembering stuff just for the sake of it.

You see, here you'll be learning to code on a Need To Know basis. Nearly everything you learn from me will have a direct, practical application to something we're working on. That way, your brain can see exactly why a certain technique is helpful and you can start using it straight away.

This series has been built on the back of my personal motto: "Programming is an art. Don't spend all your time sharpening your pencil when you should be drawing." We'll be doing some "sharpening" but a heck of a lot more "drawing" – if that doesn't suit your way of learning, Hacking with Swift isn't for you.

Q: Why did you make another tutorial series when there are lots of good ones already?

A: There are some great tutorials out there right now, for example I'm a huge fan of the RayWenderlich.com work. But there's always room for more: the Hacking with Swift approach teaches you Swift with 30 hands-on projects, it's accessible even to beginners, and you can buy only the parts you need.

But there's another, more personal reason. Shortly after Apple released its WatchKit SDK for the first time, a chap called Nick Walter produced a free one-hour video teaching people how to make Apple Watch apps. He didn't make anything exciting, but it was helpful and well made, and it was completely free. When I was reading a news story about the video, I came across this quote: "One developer we spoke to, though, did say that the approaches taken in the video don’t always represent best practice and that if you want to develop an in-depth knowledge, you might be better off keeping an eye out on iTunes U."

That struck me as an unhelpful thing to say. Partly because the developer didn't have their name attached to the quote, partly because it's easy to snipe at someone else who is trying their best, but mainly because I don't know any developer who writes code that always represents best practice. Heck, developers struggle even to agree where to place braces, never mind agreeing on best coding practices!

So, I decided to make Hacking with Swift. I don't claim I always teach coding best practices, I don't claim to give you an in-depth knowledge on every topic, but I can promise that you're going to make a lot of awesome stuff and hopefully have fun at the same time.

Haters gonna hate

Q: What should I do if I spot a mistake?

A: If it's a typo or a coding error, please do email me or find me on Twitter. However, please keep in mind that these projects were designed to be simple and digestible learning examples, not fool-proof, App Store-ready perfections. That means sometimes there are bugs that exist because some longer or more difficult code has been removed or simplified – you're welcome to fix these in your own projects, but I think it would just confuse learners to fix them here.

Q: Does Hacking with Swift have any Firefly references? I want Firefly references. Where are the Firefly references?

A: They are, quite literally, all in the official Swift reference from Apple. Shiny!

Q: What do you have against penguins?

A: Because I'm actually Dr Octavius Brine, and I was adored in Central Park until those pesky penguins stole the show! Actually, wait a minute, that's the plot from Penguins of Madagascar – I just used penguins because they had a good cartoon image that was available in the public domain. And I would have gotten away with it too if it weren't for you meddling kids…

About Me

My name is Paul Hudson, and my apps are used by the likes of UBS, Fender, Tesco, Virgin, Jamie Oliver, Odeon, MacLife magazine, and more. I've also released many apps in my spare time, of which the most recent is View Source.

I'm an author in my spare time, having written PHP in a Nutshell, Ubuntu Unleashed and Fedora Unleashed. Previously I was the editor of Linux Format magazine, but my writing has also appeared in MacFormat magazine, Net magazine and TechRadar.

If you enjoyed Hacking with Swift, you might also want to try my free React + ES6 book, Hacking with React and Hacking with PHP.

Follow me on Twitter