Author Topic: Fixing the "enumerate is unavailable" error in Swift 2.0  (Read 5614 times)


  • Administrator
  • *****
  • Posts: 719
    • View Profile
Fixing the "enumerate is unavailable" error in Swift 2.0
« on: September 11, 2015, 09:24:58 PM »
The enumerate free function has been removed in Swift 2.0 and replaced with the enumerate method on collections. To fix the error, replace the reference to the free function with a reference to the new method.

For example, the following code, which uses the enumerate free function:

Code: [Select]
for (cornerMatrixIndex, cornerMatrix) in enumerate(cornerMatrices) {

Can be changed to this:

Code: [Select]
for (forkPositionIndex, forkPosition) in forkPositions.enumerate() {

All the best!
Kevin McNeish
Author of Learn to Code in Swift:
Check out our Robot Tic-Tac-Toe app:
« Last Edit: November 15, 2015, 10:12:30 AM by kjmcneish »