Swift 3转换 - 'predecessor()'不可用

时间:2016-09-20 06:38:47

标签: swift swift3 xcode8

我收到了上述错误。那么我们如何将以下代码转换为swift 3兼容?

let charactersAreInCorrectState = { () -> Bool in
            let previousContext = self.textDocumentProxy.documentContextBeforeInput

            if previousContext == nil || (previousContext!).characters.count < 3 {
                return false
            }

var index = previousContext!.endIndex      
            index = index.predecessor()
            if previousContext![index] != " " {
                return false
            }

0 个答案:

没有答案