官术网_书友最值得收藏!

New in Swift 4.2

This year, we have the release of Swift version 4.2 with Xcode 10. Unlike previous years where we saw a full release of a Swift version, like Swift 3.0 and Swift 4.0, this year, we see the release of Version 4.2. Swift 5.0 has been moved to the sometime early next year in 2019.

Xcode 10 will be the last version to support Swift 3.0 Compatibility Mode. So, if your app uses Xcode version 3, the code needs to be migrated to at least 4.0 by next year.

Further refinements have also been introduced by Apple in Swift 4.2:

  • Speedup Debug Builds: Code builds at least twice as fast compared to previous versions of Xcode. This will depend on the nature of the product and how much Swift code it uses. Compilation is optimized to reduce redundant work.
  • Runtime Optimization: Swift 4.2 introduces a couple of under the hood runtime optimizations. For example, in 4.2, all intermediate retains and releases of objects are removed and the object only gets released once at the end, improving the runtime of the code. This also enables automatic code size optimization.
  • Small String: String is now 16 bites as compared to 24 in the previous version. It also enables a small string memory optimization. If the string is within 15 bites, then the string is represented in the string type without requiring separate allocation to represent the string.
  • Reduction in Code Size: There is a new optimization level which reduces the machine level code size generated from the compilation of the swift code. This optimization enables 10% to 30% reduction in code size with a 5% hit in runtime performance.

Swift has already made tremendous steps forward as a powerful, young language. Now, Apple is working on polishing Swift into a mature, production-ready tool. The overall developer experience improves with Swift 4.2.

With Swift 4.2, we are moving toward binary compatibility and with Swift 5.0 releasing in early 2019, this transition will be complete. With this, Apple will be able to ship the Swift runtime along with the OS itself and doesn't need to be included in the App bundle as it is currently. This will improve startup time and memory usage of the application itself. More information about binary compatibility/ abi-stability is available at swift.org/abi-stability.

Note

For a detailed look at what's new in Swift, I highly recommend watching the WWDC 2018 video:

https://developer.apple.com/videos/play/wwdc2018/401/.

主站蜘蛛池模板: 通渭县| 文山县| 仁寿县| 唐海县| 密山市| 海晏县| 家居| 娱乐| 白水县| 玉林市| 通辽市| 宣威市| 广昌县| 灵台县| 闽清县| 江油市| 恭城| 临湘市| 准格尔旗| 策勒县| 柘城县| 南郑县| 商都县| 闵行区| 康马县| 深圳市| 万荣县| 临泉县| 桐乡市| 阳东县| 揭阳市| 贵阳市| 潮安县| 永嘉县| 辛集市| 天镇县| 昌平区| 错那县| 罗定市| 阿拉善盟| 卫辉市|