Languages

Swift Cheat Sheet

Print-ready cheat sheet for Swift, organized for fast lookup, study, and desk-side use

Source
Swift Documentation (swift.org)
License
MIT
Updated
2026-03-27

Sample

What's in this cheat sheet

  • Basics
  • Types
  • Control Flow
  • Functions
  • Closures
  • Classes & Structs
  • Protocols
  • Optionals
  • Enums
  • Error Handling

Hello World

import Foundation
print("Hello, World!")

Constants & Variables

let name = "Swift"       // constant (immutable)
var count = 0            // variable (mutable)
count += 1
let pi: Double = 3.14   // explicit type annotation

Comments

// single-line comment
/* multi-line
   comment */
/// documentation comment (Markdown supported)

Download the full cheat sheet for all sections, formatted for print

Download PDF

Downloads

Choose the treatment that matches how you read