SwiftNIO 2 repository convergence plan

SwiftNIO 2 repository convergence plan

We are very happy to announce that SwiftNIO 2.0 is starting the convergence phase today.

Just to be very clear: This is not the announcement of any final SwiftNIO 2 releases, it's merely the start of the convergence plan towards them.

And just in case you wonder: If you are still on NIO 1, there's no need to take action today. NIO 1 will continue to work on all Swift 4 and Swift 5 versions as it does today. But in case you want to live on the bleeding edge, you can now give the first NIO 2 convergence releases a spin :slight_smile:.

Thank you so much for all the contributions, the swift-nio repository alone is now up to 75 different contributors which we're super thrilled about. That means SwiftNIO gained a new contributor every 5 days in the one year that SwiftNIO has been an open-source project :rocket:.

As soon as the convergence phase for a repository is started we try very hard to no longer break public API before the final release is out. In convergence, we won't remove/change existing public API so that all of our dependents can start migrating their projects to NIO 2 without the risk of their code breaking because of a SwiftNIO change. Because SwiftNIO usually forms the lowest layer in the dependency hierarchy we believe that it is important to give our users a bit of time to migrate their code before the final release is out. We also hope to squeeze out a few more bugs before the release.

What repositories are part of the SwiftNIO project

The SwiftNIO project is formed of a family of repositories which will all converge towards a new major revision. Somewhat confusingly, the major revision is not always 2 because some of the repositories were using the major version 0 in their corresponding NIO 1 branch.

Please find below a full list of the repositories which form the SwiftNIO project and the major versions they will converge towards.

  • swift-nio, which is converging towards the 2.0.0 release as of 8th March 2019, the tag is 2.0.0-convergence.1. To depend on this release, you can use
    .package(url: "https://github.com/apple/swift-nio.git", from: "2.0.0-convergence.1")
  • swift-nio-extras, which is converging towards the 1.0.0 release as of today (8th March 2019), the tag is 1.0.0-convergence.1. To depend on this release, you can use
    .package(url: "https://github.com/apple/swift-nio-extras.git", from: "1.0.0-convergence.1")
  • swift-nio-ssl, which is converging towards the 2.0.0 release as of 13th March 2019, the tag is 2.0.0-convergence.1. To depend on this release, you can use
    .package(url: "https://github.com/apple/swift-nio-ssl.git", from: "2.0.0-convergence.1")
  • swift-nio-transport-services, which is converging towards the 1.0.0 release as of 15th March 2019, the tag is 1.0.0-convergence.1. To depend on this release, you can use
    .package(url: "https://github.com/apple/swift-nio-transport-services.git", from: "1.0.0-convergence.1")
  • swift-nio-http2, which is converging towards the 1.0.0 release as of 15th March 2019, the tag is 1.0.0-convergence.1. To depend on this release, you can use
    .package(url: "https://github.com/apple/swift-nio-http2.git", from: "1.0.0-convergence.1")

What are the main changes from NIO 1 to NIO 2

The biggest change is that all of the NIO 2 repositories will require the upcoming Swift 5. Please find a summary of the changes in the individual repositories below.

swift-nio repository

We maintain a list of public API changes from NIO 1 to NIO 2 as well as a migration guide that will hopefully help you make a smooth transition.

swift-nio-extras repository

Mostly updated to support NIO 2.

swift-nio-transport-services repository

Mostly updated to support NIO 2.

swift-nio-ssl repository

There is a big change here: We no longer depend on the system's Open/LibreSSL version and will vendor a name-spaced copy of BoringSSL instead as previously discussed on the forums. Despite this big change, the impact on your code should be minimal, in many cases the only change required is to add NIOSSLHandler to your ChannelPipeline rather than OpenSSLHandler.

swift-nio-http2 repository

Another really big change here: We no longer depend on the system's libnghttp2 for HTTP/2 but instead have a shiny new pure-Swift implementation of HTTP/2. The same here: Despite this huge change, the impact on your code should be minimal.

Questions / Suggestions

If you have any questions or suggestions, please reach out to us. Either here or via Github issues on the relevant repository.

:purple_heart: Thank you!

16 Likes

@johannesweiss is swift-nio-http2 is going to be part of swift-nio main reposotory ?
where NIOHTTP1 and NIOHTTP2 are in same repo ?

The plan is to leave them in separate repositories. But over time we might change the HTTP types to be more “plain HTTP semantics” rather than HTTP/1 centric as they are today. For example the version number has major/minor which is a HTTP1-ism, in HTTP/2 there's no concept of a minor version so that field might just go. But that will obviously not happen before NIO 3 (which isn’t planned at all yet and will be quite a while out given that NIO 2 isn’t even released yet) as that would be an API breaking change.

I suspect we’ll probably more likely end up adding a translation layer, so that instead of the data types for HTTP/2 being translated into HTTP/1 data types, both H2 and H1 are translated to a common third data type that unifies just the core concepts. That can probably be done as a SemVer minor opt-in feature, so I’m not in any rush to do that: the current data types work fine for now.

1 Like

Ah yes, you’re right, that’s well possible.

swift-nio-ssl is now converging, tag is 2.0.0-convergence.1

3 Likes

swift-nio-http2 is now converging, tag is 1.0.0-convergence.1.

3 Likes

swift-nio-transport-services is now converging, tag is 1.0.0-convergence.1.

3 Likes