0% found this document useful (0 votes)
238 views1 page

Swift Cheat Sheet (Swift 5)

1. The document provides a Swift cheat sheet that summarizes key concepts like variables, constants, data types, functions, structures, classes, arrays, dictionaries, control flow statements like if/else, switch, for/in loops and while loops. 2. Common data types are listed like Int, Float, Double, Bool and String. Arrays and dictionaries are shown as data structures for storing multiple values. 3. Functions are defined with parameters, return types and code blocks. Structures and classes are defined with properties and methods.

Uploaded by

John Anderson
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
238 views1 page

Swift Cheat Sheet (Swift 5)

1. The document provides a Swift cheat sheet that summarizes key concepts like variables, constants, data types, functions, structures, classes, arrays, dictionaries, control flow statements like if/else, switch, for/in loops and while loops. 2. Common data types are listed like Int, Float, Double, Bool and String. Arrays and dictionaries are shown as data structures for storing multiple values. 3. Functions are defined with parameters, return types and code blocks. Structures and classes are defined with properties and methods.

Uploaded by

John Anderson
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Swift Cheat Sheet

Variables/Constants Functions Data Types


var myVariable = 42  func aFunction(input: Type) ->Type { Int         23 
let myConstant = 12   //Do Something Float 2.3
var typedVariable: Type   return theOutput Double 3.1415926
let typedConstant: Type }  Bool true/false
String "abc"
Structures Classes Array [1,2,3]
struct MyStruct { class myClass: SuperClass { Dictionary
}  } [key: value]

IF Statement Switch Statement Loops


if condition { switch someVariable { for variable in low...high {
    //do X   case 1: }
for fruit in fruitBasket { //do something
} elseif otherCondition {     //do X
for i in 0...4 { //do something else }
for item in array {
    //do Y    case 2: } for i in 0..<4 {//do another thing }
} else {     //do X
    //do Z   default: while condition {
}     //do X }
}
www.appbrewery.co

You might also like