Junior — Middle
What type of indexer is used to access array elements?
sobes.tech AI
Answer from AI
In iOS (for example, in Swift or Objective-C), array elements are accessed using an indexer based on an integer index that starts at 0.
This means that to access the first element of an array, you use index 0, for the second — 1, and so on.
Example in Swift:
let array = ["apple", "banana", "cherry"]
let firstElement = array[0] // "apple"
let secondElement = array[1] // "banana"
Thus, the indexer is an integer index that indicates the position of an element in the array.