【发布时间】:2017-09-02 07:17:34
【问题描述】:
我正在尝试将 Swift 3 代码转换为 Swift 4。但此错误显示:
"substring(from:)' 已弃用:请使用字符串切片下标 使用 'partial range from' 运算符。”
我的代码是:
extension String {
func substring(_ from: Int) -> String {
return self.substring(from: self.characters.index(self.startIndex, offsetBy: from))
}
}
【问题讨论】:
-
我已经检查过了....但还是不明白...你能解释一下...@algrid
-
你能解释一下@MoeAbdul-Hameed
-
@UdayBabariya 阅读此内容,您会没事的。如果您需要更多详细信息,请告诉我。 developer.apple.com/library/content/documentation/Swift/…