Today we released Vapor 4.50.0 (and an APT version tag!) which adds async APIs to the most popular Vapor APIs and allows you to write async route handlers!
Alongside this we also released updates to FluentKit, Fluent and a number of other packages to make using async/await in Vapor easy.
The docs have been updated (Vapor Docs) so check them out. We've also added a short migration guide to help you migrate an existing project. We strongly encourage you to try the new APIs out and migrate your code to async/await over the coming months as this will provide a better development experience and make upgrading to Vapor 5 much easier. You can run async route handlers alongside EventLoopFuture handlers, though we encourage you to try and not mix and match too much inside an individual route handler.
Note: you must be running macOS Monterey and Xcode 13.1 on macOS or Swift 5.5 on Linux to be able to use the new APIs.
If you run into any issues or find missing APIs either post here in the forums, on GitHub or on Discord.
Thanks for the work guys! This is great! I am curious, what was your approach for supporting this on older OSs? Using the @available syntax or does the new version just only support Swift 5.5 and the new OSs?
I find this interesting. I know there's been discussion of providing async/await compatibility for older macOS and iOS versions, seems like Swift must already support providing the necessary runtime on Linux.
Linux ships with concurrency in the runtime instead of it being part of the OS so there's no restriction there.
In terms of Vapor supporting concurrency on older OSes we're dependent on NIO. Their future/async bridge is marked with a macOS 12 availability (because it had to be) so until NIO makes their Concurrency stuff available we can't. As soon as they do we can copy their availabilities