Now Open Source: The Swift Cheatsheet

Written by Reinder de Vries on November 23 2017 in App Development

Now Open Source: The Swift Cheatsheet

Why learn by heart if you can cheat? Grab my open source cheatsheet for Swift 4, including common syntax for primitives, OOP, closures, error handling and more!

Go to the Swift 4 Cheatsheet

Updated for Swift 4

This Swift 4 Cheatsheet Is Now Open Source

Good things happen when you work together! My Swift 4 cheatsheet is now open source. This means you can do with it whatever you want, as long as you keep the open source license intact.

The most successful people I know share their work. As you’re learning how to code iOS apps, making this your practice is essential.

Can you help? Contribute your Swift 4 code examples, tidbits and cheats by creating a Pull Request (PR) on GitHub. If you have an idea or found a bug, please share it by creating an Issue ticket.

Why don’t you give the Swift 4 Cheatsheet a share right now?

In This Cheatsheet

Compared to the previous versions of the cheatsheet, a lot has changed. It’s expanded, made clearer, upgraded and updated. We’ve added explanations alongside the code examples to help beginner iOS developers grasp Swift with a birds-eye view.

This cheatsheet includes:

  • Variables, including primitives and common variable types
  • Functions, including function declaration and usage
  • Classes, including class declaration, protocols, outlets, properties, initializers, lazy properties and class methods
  • Instances, including initialization and using properties
  • Control Flow, including if-else if-else statements and switch
  • Loops, including for, while and Swift range syntax
  • Conditionals, including expressions, boolean logic and operators
  • Strings, including working with strings, converting from String to Int, and string interpolation
  • Optionals, including optional binding, optional chaining and force unwrapping
  • Dictionaries, including initialization and accessing key-value pairs
  • Arrays, including accessing values, adding values and looping over values
  • Closures, including complete closure syntax, capturing and escaping
  • Guard & Defer, including early return with guard and deferred execution with defer
  • Generics, including generic types and function generics
  • Tuples, because while I’m at it I might as well add tuple syntax too…
  • Error Handling, including throwing errors and catching them with do-try-catch

Learn how to build iOS apps

Get started with iOS 12 and Swift 5

Sign up for our iOS development course Zero to App Store and learn how to build professional iOS 12 apps with Swift 5 and Xcode 10.

Further Reading

Save the whales, the trees and the arctic, and don’t print out this cheatsheet! Simply save it on your Desktop and keep it open while you’re coding.

Want to learn more? Check out these resources:

Do you enjoy building apps? Share this Swift 4 cheatsheet with other iOS developers:

Reinder de Vries

Reinder de Vries

Reinder de Vries is a professional iOS developer. He teaches app developers how to build their own apps at Since 2009 he has developed a few dozen apps for iOS, worked for global brands and lead development at several startups. When he’s not coding, he enjoys strong espresso and traveling.