Skip to content

Auto-inject parameter of primitive data type into Singleton #2

@davidscheutz

Description

@davidscheutz

Feature Request

Currently it's not possible to directly inject parameters such as String, Int etc. using the AutoSetup protocol.

The following code will result in a crash:

/// @Singleton
class ApiClient {
   private let baseUrl: String

   init(baseUrl: String) {
      self.baseUrl = baseUrl
   }
}

Error: DependencyContainer.ResolveError<Swift.String>.notRegistered

Proposed Solution

DependencyContainer does already support injecting and resolving objects using a Key: AnyHashable.

The question is how to integrate that feature using the AutoSetup code generation?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions