Skip to content

Containerized

Josh Wright edited this page Jan 14, 2021 · 4 revisions

Containerized

Conform a class to Containerized lets the @Inject property wrapper know that there is a custom container from which services should be resolved.

public protocol Containerized: class

If the enclosing type of the property wrapper is not Containerized, injected services will be resolved from Container.global.

Usage:

final class UsersController: Containerized {
    let container = Container()

    // Will be resolved from `self.container` instead of
    // `Container.global`
    @Inject var database: Database
}

Inheritance

class

Requirements

container

The container from which @Injected services on this type should be resolved.

var container: Container
Alchemy
Types
Protocols
Global Typealiases
Global Variables
Global Functions
Fusion
Types
Protocols
Papyrus
Types
Protocols
Clone this wiki locally