swift - enumerate is unavailable call the enumerate method on the sequence -


just downloaded xcode 7 beta, , come error on enumerate

error:

enumerate unavailable call enumerate method on sequence

 func layoutspecialkeysrow(row: [key], keywidth: cgfloat, gapwidth: cgfloat, leftsideratio: cgfloat, rightsideratio: cgfloat, micbuttonratio: cgfloat, islandscape: bool, frame: cgrect) -> [cgrect] {     var frames = [cgrect]()      var keysbeforespace = 0     var keysafterspace = 0     var reachedspace = false     _k, key) in enumerate(row) {         if key.type == key.keytype.space {             reachedspace = true         }         else {             if !reachedspace {                 keysbeforespace += 1             }             else {                 keysafterspace += 1             }         }     } 

in swift 2, enumerate not global function anymore, it's extension of sequencetype.

call directly on sequence enumerate this:

for (index, key) in row.enumerate() {     // ... } 

Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -