cast an integer array to swift array in swift

To cast an integer array to Swift array in Swift, you can do the following:

main.swift
let integerArray = [1, 2, 3, 4, 5]
let swiftArray = Array(integerArray)
72 chars
3 lines

In this example, we declare an integer array integerArray with 5 elements. To cast this to a Swift array, we use the built-in Array constructor and pass in the integer array as an argument. The resulting variable swiftArray is now a Swift array.

gistlibby LogSnag