Now Open Source: The Swift 4 Cheatsheet

Written by: Reinder de Vries, November 23 2017, in App Development

Swift 4 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?

The Swift 4 Cheatsheet: updated, open source, and pretty Swifty… — https://github.com/reinder42/SwiftCheatsheetClick To Tweet

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
Get 5 of my best practices

Get 5 of my best practices

Learn how to build better iOS apps

I’ll show you exactly how I built a dozen professional iOS apps,
write extensible Swift code, and turn coffee into code.
Wait, what? Yup – into Swift code.

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:

Now open source: The Swift 4 Cheatsheet — https://github.com/reinder42/SwiftCheatsheet Click To Tweet

Reinder de Vries

Reinder de Vries is a professional iOS developer. He teaches app developers how to build their own apps at LearnAppMaking.com. 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.

Comments & Questions

Got a comment or question? Let me know! I read and respond to every one. Thanks!