To initialize an array in Swift, you can use array literals or the Array constructor.
In this example,
numbers
using array literals with integer values.let numbers = [1, 2, 3, 4, 5]
print(numbers)
[1, 2, 3, 4, 5]
In this example,
fruits
using the Array constructor with string values.let fruits = Array(arrayLiteral: "Apple", "Banana", "Orange")
print(fruits)
["Apple", "Banana", "Orange"]
In this tutorial, we learned How to Initialize an Array in Swift language with well detailed examples.