Basics: Integers
- Are either signed (positive, zero, or negative) or unsigned (positive or zero).
- Swift provides signed and unsigned integers in 8, 16, 32, and 64 bit forms.
- These follow a naming convention similar to C, in that an 8-bit unsigned integer is of type UInt8, and a 32-bit signed integer is of type Int32.
Additional information
Integer Bounds
Let minValue = UInt8.min // minValue is equal to 0, and is of type UInt8
let maxValue = UInt8.max // maxValue is equal to 255, and is of type UInt8
You can access the minimum and maximum values of each integer type with its min and max properties.
Additional information
Int
Swift provides an additional integer type, Int, which has the same size as the current platform’s native word size.