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
}
}
}
The OrderedDict. fromkeys() method eliminates the duplicates from the list because the dictionary in Python cannot have duplicate keys. This is the fastest method in python to remove duplicates values from a list.
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() {
// ...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With