Vapor, the popular web framework written in Swift has released its next major update. Vapor 3 is a complete rewrite of the existing versions and all of its related packages. The release is centered around three new features.
- Async: Vapor 3 is all ready to handle high levels of concurrency as it is completely non-blocking and runs on Apple’s SwiftNIO.
- Services: With Vapor’s new Dependency Injection framework Services, all JSON configuration files are replaced by Swift.
- Codable: Codable integration throughout all of Vapor brings type safety and better performance to Parsing and serializing content from HTTP messages, creating database models, and rendering views.
The main focus of this release is on building a foundation for developers to work on based on the growth of Vapor and server-side Swift over the past two years.
The release is updated across four major categories.
Vapor 3 offers a couple of new packages this release. Most notable are the MySQL and PostgreSQL packages which are now non-blocking and built on SwiftNIO. Some of these packages include:
- SQLite: SQLite 3 wrapper for Swift.
- PostgreSQL: Non-blocking, event-driven Swift client for PostgreSQL.
- MySQL: Pure Swift MySQL client built on non-blocking, event-driven sockets.
- Fluent: Swift ORM framework (queries, models, and relations) for building NoSQL and SQL database integrations.
- FluentSQLite: Swift ORM (queries, models, relations, etc) built on SQLite 3.
- Auth: Authentication and Authorization layer for Fluent.
- JWT: JSON Web Token signing and verification.
- Leaf: An expressive, performant, and extensible templating language built for Swift.
A complete list of packages is available in the vapor documentation.
Better updated Documentation
A large part of the release focuses on better documentation. Subsequently, Vapor 3 improves API docs with 100% docblock coverage including:
- Helpful code samples where possible.
- Method parameter descriptions.
- MARK and code re-org to help make things readable in API doc form.
Also, the main docs are moving more toward a guide / tutorial feel. These guide docs cover broad use cases and practices, in contrast to the API docs which heavily focus on particular methods and protocols.
Moving to Discord and introducing Books
Vapor’s official team chat is now moved to Discord. The team has also announced two books (Server Side Swift with Vapor and Server-side Swift (Vapor Edition)) written specifically for Vapor 3.
Vapor 3 introduces certain benchmarks for this release available on GitHub. The benchmarks were run on two identical Digital Ocean droplets. One for hosting the frameworks and one for running the benchmark. The benchmarker program is a small script written in Swift that runs wrk and captures the results. It is capable of doing multiple runs and averaging the results. Vapor achieved state-of-the-art results on both the plaintext benchmarks.
To know further updates and other minor changes, be sure to Check out the updated website.
Your First Swift Program [tutorial]
Swift for TensorFlow is now open source [news]
RxSwift Part 1: Where to Start? Beginning with Hot and Cold Observables [tutorial]