Skip to content

Property Injections

apleshkov edited this page Jul 30, 2018 · 2 revisions

Mark a property with the @saber.inject annotation to inject a dependency:

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

    // @saber.inject
    var logger: Logging?

    // @saber.inject
    var fileManager: FileManager!
}

Such property should be mutable and has an explicitly declared type, so Saber can determine which dependency to inject.

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

Clone this wiki locally