Swift Language Arrays Useful Methods


Determine whether an array is empty or return its size

var exampleArray = [1,2,3,4,5]
exampleArray.isEmpty //false
exampleArray.count //5

Reverse an Array Note: The result is not performed on the array the method is called on and must be put into its own variable.

exampleArray = exampleArray.reverse()
//exampleArray = [9, 8, 7, 6, 5, 3, 2]