如何使用“distanceTo"、“advancedBy"在 Xcode7 beta6 中处理字符串 [英] How to use "distanceTo", "advancedBy" to handle String in Xcode7 beta6

查看:31
本文介绍了如何使用“distanceTo"、“advancedBy"在 Xcode7 beta6 中处理字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 String 扩展,它在 Xcode7 beta5 上运行良好.但是,我昨天升级到了 beta 6.Swift 语法似乎有一些变化.编译我的代码时出现一些错误.

===================================================

是的.它显示了我应该使用哪些方法,还可以在苹果网站上找到一些信息.

解决方案

发生的事情是全局函数 distanceadvance 已被实例方法取代 distanceToadvancedBy.

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 中处理字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆