[フレーム]
BT

InfoQ Software Architects' Newsletter

A monthly overview of things you need to know as an architect or aspiring architect.

View an example

We protect your privacy.

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Unlock the full InfoQ experience

Unlock the full InfoQ experience by logging in! Stay updated with your favorite authors and topics, engage with content, and download exclusive resources.

Log In
or

Don't have an InfoQ account?

Register
  • Stay updated on topics and peers that matter to youReceive instant alerts on the latest insights and trends.
  • Quickly access free resources for continuous learningMinibooks, videos with transcripts, and training materials.
  • Save articles and read at anytimeBookmark articles to read whenever youre ready.

Topics

Choose your language

InfoQ Homepage News Vapor 5 Materializes the Future of Server-Side Development in Swift

Vapor 5 Materializes the Future of Server-Side Development in Swift

Sep 11, 2024 2 min read

Write for InfoQ

Feed your curiosity. Help 550k+ global
senior developers
each month stay ahead.
Get in touch

Over four years since the launch of its current version, the team behind Swift server-side development framework Vapor is making room for Vapor 5, which aims at leveraging Swift 6 concurrency capabilities and laying the foundations for the framework's future evolution. An initial alpha release is planned to be ready when Swift 6 is officially released.

Among Vapor 5 main goals are native API support for full structured concurrency, the adoption of more modern packages from the Swift ecosystem, and a full rewrite of the WebSocket and the MultipartKit APIs.

Embracing structured concurrency means Vapor 5 is going to ditch the EventLoopFuture which was introduced in Vapor 3 and remains at the foundations of Vapor 4 more recent async/await-based APIs. Instead, Vapor 5 will use structured concurrency from the outset and will not use EventLoopFuture altogether, thus making it easier to reason about code and being friendlier to Xcode's advanced diagnostics for structured concurrency.

Vapor 5 will also take advantage of a few third-party libraries that have become prominent in recent years, including Swift Service Lifecycle, a library to launch and stop services; Swift HTTP Types, a library that provides a common set of representations for HTTP requests and responses; and a new HTTP server based on Hummingbird, which will bring support for gRPC, async body streaming and SSE. Additionally, Vapor 5 will migrate to Swift Foundation, a lightweight base layer that replaces the Foundation API delivered with iOS and macOS. This will provide consistent behaviour across all platforms and reduce confusion for multi-platform developers, says the Vapor team.

As a final note about Vapor 5, it will introduce new implementations for the WebSocket and MultipartKit APIs. The main limitation in the current MultipartKit implementation is the lack of support for streaming multipart bodies, which can make it hard to work with either very large files or with APIs like NIOFileSystem. This will be solved by the new implementation in Vapor 5. Similarly, the current WebSocket APIs are hard to use in the async-await world, and the new release will provide an updated, easier-to-use API.

Vapor comprises four main components, including a core package aimed at handling routes, JSON encoding/decoding, and managing HTTP requests; Fluent, which allows you to create data models using noSQL databases; JWT, used to create sign and verify JSON Web Tokens in Swift; and Leaf, a template engine to generate HTML from a simplified syntax.

With over 24k stars on GitHub and almost 250 contributors, Vapor seems to be the most popular choice for building HTTP web apps or APIs in Swift.

As mentioned, an early release of Vapor 5 will be available along with Swift 6, focusing on providing a fully async stack and removing all the EventLoopFuture APIs.

About the Author

Sergio De Simone

Show moreShow less

Rate this Article

Adoption
Style

This content is in the Mobile topic

Related Topics:

Related Content

The InfoQ Newsletter

A round-up of last week’s content on InfoQ sent out every Tuesday. Join a community of over 250,000 senior developers. View an example

We protect your privacy.

BT

AltStyle によって変換されたページ (->オリジナル) /