Skip to content

Method Injections

apleshkov edited this page Jul 30, 2018 · 2 revisions

Annotate your methods with the @saber.inject annotation to inject dependencies:

// @saber.scope(App)
class StorageManager {

    // ...

    // @saber.inject
    func set(_ env: Env) {
        // ...
    }

    // @saber.inject
    func set(current user: User) {
        // ...
    }

    // @saber.inject
    func set(logger: Logging, fileManager: FileManager) {
        // ...
    }
}

Also it's possible to handle the completion of property/method injections.

Clone this wiki locally