This question already has an answer here:
Just downloaded Xcode 7 Beta, and come up with this error on enumerate
error:
enumerate is unavailable call the enumerate method on the 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
for _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 is not a global function anymore, it's an extension of SequenceType.
Call it directly on the sequence to enumerate like this:
for (index, key) in row.enumerate() {
// ...
}
来源:https://stackoverflow.com/questions/31230761/enumerate-is-unavailable-call-the-enumerate-method-on-the-sequence