swift initialize array with size

Swift
let myArraySize: Int = 42
let myArray: [Int] = [Int](repeating: 0, count: myArraySize)
Source

Also in Swift: