目前,我一直在使用了XCode 8和上線'advancedBy' 是不可用在Xcode 8
let range = key.startIndex...key.startIndex.advancedBy(0)
我得到的錯誤:
error: 'advancedBy' is unavailable: To advance an index by n steps call 'index(_:offsetBy:)' on the CharacterView instance that produced the index.
我該如何解決這個問題?
錯誤的截圖如下:
請在問題你的代碼以及截圖。 – Paulw11
您需要使用index offsetBy http://stackoverflow.com/a/38215613/2303865 –
請參閱https://github.com/apple/swift-evolution/blob/master/proposals/0065-collections-move-indices。 MD – HAS