问题描述
我有一个 String 扩展,它在 Xcode7 beta5 上运行良好.但是,我昨天升级到了 beta 6.Swift 语法似乎有一些变化.编译我的代码时出现一些错误.
===================================================
是的.它显示了我应该使用哪些方法,还可以在苹果网站上找到一些信息.
发生的事情是全局函数 distance
和 advance
已被实例方法取代 distanceTo
和 advancedBy
.
I have an extension on String, it works fine on Xcode7 beta5.However, I upgraded to beta 6 yesterday. It seems Swift syntax has some changes. There are some errors while compiling my code.
==================================================
Yes. it shows which methods I should use and also finds some information on apple website. https://developer.apple.com/library/prerelease/ios/releasenotes/General/iOS81APIDiffs/modules/Swift.html
When I change the "distance" => "distanceTo". I got the error "Use of unresolved identifier 'distance to'". Does anyone know how to use "distanceTo", "advancedBy" exactly ??
What's happened is that the global functions distance
and advance
have been replaced by instance methods distanceTo
and advancedBy
.
这篇关于如何使用“distanceTo"、“advancedBy"在 Xcode7 beta6 中处理字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!