Vapor: 4.63.0 Release

Release date:
July 21, 2022
Previous version:
4.62.2 (released July 20, 2022)
Magnitude:
34 Diff Delta
Contributors:
1 total committer
Data confidence:
Commits:

Top Contributors in 4.63.0

gwynne

Directory Browser for 4.63.0

We haven't yet finished calculating and confirming the files and directories changed in this release. Please check back soon.

Release Notes Published

This patch was authored and released by @gwynne.

The new subscript simplifies "provider" implementations that extend Application and use its Storage instance without complex initialization requirements:

extension Application {
    public struct Foo {
        final class Storage { /* content which needs no special initialization */ }
        struct Key: StorageKey { typealias Value = Storage }
        let application: Application

        // Before:
        var storage: Storage {
            if self.application.storage[Key.self] == nil { self.initialize() }
            return self.application.storage[Key.self]!
        }

        func initialize() { self.application.storage[Key.self] = .init() }

        // After:
        var storage: Storage { self.application.storage[Key.self, default: .init()] }