1
我使用的字符串+扩展舱,我想我的项目迁移到Xcode的9 +斯威夫特4及以下的功能开始给错误暧昧参考构件 '.. <'。暧昧参考成员“.. <” - 斯威夫特4
func times(_ n: Int) -> String {
return (0..<n).reduce("") { $0.0 + self }
}
如何解决?
我使用的字符串+扩展舱,我想我的项目迁移到Xcode的9 +斯威夫特4及以下的功能开始给错误暧昧参考构件 '.. <'。暧昧参考成员“.. <” - 斯威夫特4
func times(_ n: Int) -> String {
return (0..<n).reduce("") { $0.0 + self }
}
如何解决?
请检查:
func times(_ n: Int) -> String {
return (0..<n).reduce("") { (str1, str2) in str1 + self }
}
不是每个人都知道的字符串+扩展荚是什么。 – Abizern