Arrays are used to store multiple values of same data type. An Array is just like a container which holds multiple data/ values of a data type in an ordered list. When you fetch the data, you will get the elements in the same order as you defined in the array.
An array can store values of any data type e.g. Int, String, class etc.
How to declare array in Swift 4?
Specify the data type inside the square brackets  to create an empty array. You have to specify the type inside the square bracket , otherwise Swift will treat it as a normal data type and you can store only a single value in it.
Declare an empty array
Here, we have declared a constant emptyIntArr that can store array of integer and initialized with 0 values.
Create an array directly
Swift is a type inference language so, we can also create an array directly without specifying the data type but we have to initialise with some values so that compiler can finds out its type.
[1, 2, 3, 4, 5]
Here, we have declared a constant someIntArr that can store array of Integer without specifying the type explicitly. Also, we have initialized array which gives the output as 1, 2, 3, 4, 5.
Declare an array with specified number of single repeated value
We can repeat a value to specific number of times to make an array in Swift. It is done by using the array initializer with repeating and count.
["JavaTpoint", "JavaTpoint", "JavaTpoint", "JavaTpoint", "JavaTpoint"]
Here, we have defined a constant arrWithRepeatingValues that stores an array of string JavaTpoint and repeats the same value for 5 times as specified in the count.
Note: In Swift 4, we cannot create an array of fixed length size as we can do in other programming languages.
How to store values in Array?
Let's take a constant IntArray to store some strings:
The index of an array starts with 0 means the first element is stored in index 0, second element in index (1) and so on.
How to access array elements in Swift?
You have to use index of the value of that array you want to access within square brackets immediately after the name of the array.
Suppose, we declared an array intArray as above. The first element is intArray, second element is intArray and so on. We use them to access the array's values.
10 11 12 13 14
How to modify elements in Array?
We can modify elements of the array by using assignment operator. We have to add the index of the value we want to update within square brackets after the name of the array followed by the assignment operator and new value.
[12, 42, 45, 36, 14]
You can also modify the whole array completely.
[10, 20, 30, 40]
A list of built in Array functions and their properties: