enumerateobjectsusingblock:Methods that are not arrays are used in Nsarray. If you want to use it, you need an instance of Nsarray instead of an array.
import Foundationvar array: NSArray = ["Some", "strings", "in", "an", "array"]array.enumerateObjectsUsingBlock({ object, index, stop in //your code})
If you have an existing array, use as to make an array into a nsarray
var cocoaArray = swiftArray as NSArray
Or you just import the foundation compiler will automatically bridge the array into Nsarray and then the Nsarray method will become available.
Swift1
You can only use the enumerate features of Swift:
for (index, value) in enumerate(array) { // your code}
Swift2
Swift2,enumerate is no longer a free feature, now it's expanding in a protocol!
for (index, value) in array.enumerate() { // your code}
Swift 3
Renamed to enumerated in Swift3,enumerate
for (index, value) in array.enumerated() { // your code}
The use of Swift-enumerateobjectsusingblock