swift array of size code example
Example 1: array length swift
let arr = [1, 2, 3]
print(arr.count) // 3
Example 2: swift initialize array with size
let myArraySize: Int = 42
let myArray: [Int] = [Int](repeating: 0, count: myArraySize)
let arr = [1, 2, 3]
print(arr.count) // 3
let myArraySize: Int = 42
let myArray: [Int] = [Int](repeating: 0, count: myArraySize)