Swift — Command Reference
Swift's most used commands and methods — each with an explanation, working example, and real-world usage. The language for iOS/macOS apps.
7 categories · 16 commands
🖥️
Output
Printing to the console and string interpolation.
print()String interpolation \(...)📦
Variables & Types
var, let, and type conversion.
var / letInt() / String()🔢
Numbers & Math
Operators and Foundation mathematical functions.
Math operatorssqrt() / pow() / abs() (Foundation)✍️
String
Length, casing, searching, and replacing.
.count / .uppercased().contains() / .replacingOccurrences() (Foundation).split(separator:)📚
Array & Dictionary
Array and Dictionary.
Array (arr)Dictionary🔀
Condition & Loop
if/else, for-in, and while.
if / elsefor-inwhile🧩
Function
func, return, and default parameters.
func (function)Default parameter