Swift Arrays:
Like Objective C arrays Swift arrays are also collection of Objects
The Difference is in swift we don't work directly with addresses.
The declaration of Swift array is as follows
The above declaration says that myArray is of type Array that holds String objects.
The type of Array Objects needs to be declared using <> brackets.
We can also declare an Array that can hold any type of object using AnyObject.
AnyObject in swift is similar to id data type in Objective C.
The sample declaration of array with AnyObject is shown below
Assigning Array in Swift
Iterating through Array Objects
Using For Loop
Using Half Open Range Operator
Note:Use Count method to get the upper bounds of the Array
Adding Objects in Array
Use append method on array object to add an object to the existing array at the end
This method adds an object at the end of the array and increases the bounds of the array.
If you want to add Objects at particular index use insert at index method