{"id":20308218,"url":"https://github.com/viniciusaro/swiftresolver","last_synced_at":"2025-07-21T07:32:49.409Z","repository":{"id":22217826,"uuid":"94450400","full_name":"viniciusaro/SwiftResolver","owner":"viniciusaro","description":"Dependency injection framework for Swift","archived":false,"fork":false,"pushed_at":"2022-07-22T00:58:22.000Z","size":79,"stargazers_count":25,"open_issues_count":3,"forks_count":3,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-06-24T01:49:47.128Z","etag":null,"topics":["dependency-injection","swift"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/viniciusaro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-15T14:58:03.000Z","updated_at":"2025-01-31T10:01:20.000Z","dependencies_parsed_at":"2022-08-07T10:15:22.364Z","dependency_job_id":null,"html_url":"https://github.com/viniciusaro/SwiftResolver","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/viniciusaro/SwiftResolver","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viniciusaro%2FSwiftResolver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viniciusaro%2FSwiftResolver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viniciusaro%2FSwiftResolver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viniciusaro%2FSwiftResolver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/viniciusaro","download_url":"https://codeload.github.com/viniciusaro/SwiftResolver/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viniciusaro%2FSwiftResolver/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266261188,"owners_count":23901287,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dependency-injection","swift"],"created_at":"2024-11-14T17:21:08.018Z","updated_at":"2025-07-21T07:32:49.389Z","avatar_url":"https://github.com/viniciusaro.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SwiftResolver\nDependency injection framework for Swift.\n\n## Usage\n```swift\ncontainer.register { MyService() as Service }\n...\nlet service: Service = container.resolve()\n```\n\nYou can find more detailed use cases in the [wiki](https://github.com/viniciusaro/SwiftResolver/wiki) page\n\n## Instalation\n```ruby\npod 'SwiftResolver'\n```\n\n## Multiple Implementations of same Protocol\n\nYou can register multiple implementations of the same protocol in the same container.\nLater, when resolving, the specific type of the implementation can be passed as parameter to obtain the correct implementation type.\n\n```swift\ncontainer.register(MyService.init).as(ServiceProtocol.self)\ncontainer.register(OtherService.init).as(ServiceProtocol.self)\n...\nlet service: ServiceProtocol = container.resolve(MyService.self) // instance of MyService is returned here\n```\n\n## Multiple Configurations\n\nYou can register multiple implementations of the same object with different configurations.\nLater, when resolving, an identifier of the implementation can be passed as parameter to obtain the instance with the correct configuration.\n\n```swift\nenum MyServices: String {\n    case mock\n    case live\n}\n\ncontainer.register { MyService(requestProvider: liveRequestProvider) as Service }.tag(MyServices.live)\ncontainer.register { MyService(requestProvider: mockRequestProvider) as Service }.tag(MyServices.mock)\n...\nlet service: Service = container.resolve(MyServices.live)\n```\n\n## Thread Safety\n\nSwiftResolver is thread safe. This means you can register/resolve in different threads. \n\nHowever, this is not a good practice since resolving instances that are not registered yet results in a `fatalError`.\n\nIt is recommended to use an AppContainer as described in the [wiki](https://github.com/viniciusaro/SwiftResolver/wiki/Project-Setup) page for a one time registration process.\n\n## References\n* [Dependency Injection](https://en.wikipedia.org/wiki/Dependency_injection)\n* [Dip](https://github.com/AliSoftware/Dip)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fviniciusaro%2Fswiftresolver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fviniciusaro%2Fswiftresolver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fviniciusaro%2Fswiftresolver/lists"}