Basic Types in Swift

From the Swift cheat sheet · Getting Started · verified Jul 2026

Basic Types

Swift fundamental data types

swift
// Numbers
let integer: Int = 42
let double: Double = 3.14159
let float: Float = 3.14

// Strings and Characters
let string: String = "Hello, Swift"
let character: Character = "A"
let multiline = """
    This is a
    multiline string
    """

// Booleans
let isTrue: Bool = true
let isFalse = false

// Tuples
let coordinates = (x: 10, y: 20)
let (x, y) = coordinates
💡 Int is 64-bit on 64-bit platforms, 32-bit on 32-bit platforms
⚡ String interpolation with \() is more efficient than concatenation
📌 Tuples are useful for returning multiple values from functions
🟢 Use type aliases to make complex types more readable

Continue with Swift

Save the full cheat sheet or work through every related task.

More Swift tasks

Back to the full Swift cheat sheet