如你所知,xcode 7和swift 2中的变化很少。我在下面显示了2个错误,我该如何修复它们? 感谢
sharmi-PC/MSSQL2012
答案 0 :(得分:0)
'(String) -> _' is not identical to 'Int'
是因为String不再符合SequenceType,而是必须获取characters
属性,然后在其上调用count
方法:
if self.characters.count < 4 {
return self
}
答案 1 :(得分:0)
截至Swift 2 String
不再是CollectionType
和Sliceable
,因此您应该CharacterView
.characters
对var scrambleMiddle: String {
if self.characters.count < 4 {
return self
}
return first + String(Array(dropLast(dropFirst(self.characters))).shuffled) + last
}
执行以下操作:< / p>
manager.saveOntology(ontology);