Swift Language Arrays Useful Methods

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

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]


Got any Swift Language Question?