Plan for NIO 2 and Swift 5


(Johannes Weiss) #21

This post is only relevant to library developers who want to depend on NIO’s master branch before the first NIO 2 versions get tagged.

If you’re a user of a library that uses SwiftNIO or the author of a library and you depend on NIO using tagged versions (from: “1.0.0” or similar) you don’t need to worry at all.

For all the packages that track NIO’s master whilst NIO 2 is developed just a small piece of information: we added a module called _NIO1APIShims to NIO’s master branch. Until NIO 2’s API stabilises we’ll keep that module around and will continue to shim NIO 1’s API to make it easier for our users to port their code over to NIO 2.

So if you don’t want to wait for the NIO 2 release and want to track our master branch whilst NIO 2 is taking shape, I’d recommend that where ever you import any NIO modules you’ll also import _NIO1APIShims. That way you get warnings with nice fixits in Xcode rather than compilation errors. But even after fixing those warnings, I’d recommend keeping the import of _NIO1APIShims in just so that we don’t break you again the next day.

As promised we also keep a list of all public API changes we have done: https://github.com/apple/swift-nio/blob/master/docs/public-api-changes-NIO1-to-NIO2.md

I should add that for NIO 2 development you will need a recent Swift 5 snapshot and you’ll need to patch your Xcode to make it properly work with Swift 5 until: How to set Swift version 5 (for recent dev snapshots) in Xcode build settings? . That is only until an Xcode that officially supports Swift 5 comes out of course.

If there’s any questions or suggestions, please let us know. Thank you!


(Johannes Weiss) #22

Just two minor announcements here:

  • with the 10.2 beta, you no longer need to patch your Xcode (but you'll still need a very recent Swift 5.0 development snapshot toolchain from swift.org)
  • we initially thought 1.12.x would be the last NIO 1 minor version, turns out we needed a 1.13.0 but that shouldn't affect anybody.