xcode - Xcode7 beta6中如何使用 "distanceTo"、 "advancedBy"处理String

标签 xcode string swift

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

enter image description here

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

是的。它显示了我应该使用哪些方法,还可以在苹果网站上找到一些信息。 https://developer.apple.com/library/prerelease/ios/releasenotes/General/iOS81APIDiffs/modules/Swift.html

当我更改“distance”=>“distanceTo”时。我收到错误“使用未解析的标识符‘distance to’”。有谁知道如何准确使用“distanceTo”、“advancedBy”? enter image description here

最佳答案

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

关于xcode - Xcode7 beta6中如何使用 "distanceTo"、 "advancedBy"处理String,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32216817/

相关文章:

c# - 在 C# 中创建动态字符串

swift - 使用按钮在 swift 中切换语句

swift - 创建可重用 View 时如何分配 TextField 委托(delegate)和方法

python - 将字符串转换为 int、float 或将其保留为字符串,具体取决于最佳选择

swift - 拆分 AVMutableComposition 并导出为多个较小的组合

ios - Swift 十六进制到字节 (iOS)

ios - 在显示转场时隐藏 UITabbar 并显示工具栏

swift - 如何使用 NSImage 在 Xcode Playground 中显示图像

ios - 隐藏状态栏并增加UINavigationBar的高度

php - 将带破折号的字符串转换为 camelCase