Skip to content

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

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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