C style for statement removed from swift 3.0, successor() is unavailable
问题 Can anyone please help me update this for loop to swift 3.0. help appreciated. Thank you! for var index = trimmedString.startIndex; index < trimmedString.endIndex; index = index.successor().successor() { let byteString = trimmedString.substringWithRange(Range<String.Index>(start: index, end: index.successor().successor())) let num = UInt8(byteString.withCString { strtoul($0, nil, 16) }) data?.appendBytes([num] as [UInt8], length: 1) } 回答1: In Swift 3, "Collections move their index", see A New