Show Menu
Cheatography

Swift Core Cheat Sheet by

Declar­ations

associatedtype, class, deinit, enum, extension, fileprivate, func, import, init, inout, internal, let, open, operator, private, protocol, public, static, struct, subscript, typealias, and var.

Statements

break, case, continue, default, defer, do, else, fallthrough, for, guard, if, in, repeat, return, switch, where, and while

Expres­sions and types

as, Any, catch, false, is, nil, rethrows, super, self, Self, throw, throws, true, and try.
 

Patterns

 _
 

Begin with a number sign (#)

#available, #colorLiteral, #column, #else, #elseif, #endif, #file, #fileLiteral, #function, #if, #imageLiteral, #line, #selector, and #sourceLocation

Reserved in particular contexts

associativity, convenience, dynamic, didSet, final, get, infix, indirect, lazy, left, mutating, none, nonmutating, optional, override, postfix, precedence, prefix, Protocol, required, right, set, Type, unowned, weak, and willSet.
Outside the context in which they appear in the grammar, they can be used as identi­fiers.

Reserved as punctu­ation

(, ), {, }, [, ], ., ,, :, ;, =, @, #, & (as a prefix operator), ->, `, ?, and ! (as a postfix operator).
These tokens are reserved as punctu­ation and can’t be used as custom operators.
 
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

            Swift Cheat Sheet by Rob Phillips
          RxSwift Operators Cheat Sheet
          Autolayout Constrains Cheat Sheet