Swift - 从2.2到3.0

2016-09-27  本文已影响30人  Hesse_Huang

这里是一些从2.2到3.0的笔记。
[Swift 3.0 Migration Guide] https://swift.org/migration-guide/

  1. Index有很多方法都被挪去 Collection 类型里的方法,如 Collection.index(index, offsetBy: delta), Collection.index(index, offsetBy: delta, limitedBy: otherIndex), Collection.distance(from: index, to: otherIndex)等;
  1. dispatch_once弃用,现在 lazily initialized 的闭包可以保证一次运行和线程安全;
    6.Closure 现在默认是non-escaping ,因此可能需要用到@escaping
    7.OC 的 id 类型现在是Any 类型
上一篇 下一篇

猜你喜欢

热点阅读