{"id":32109893,"url":"https://github.com/ivlevastef/ditranquillity","last_synced_at":"2025-10-20T13:21:23.161Z","repository":{"id":43946190,"uuid":"60842718","full_name":"ivlevAstef/DITranquillity","owner":"ivlevAstef","description":"Dependency injection for iOS (Swift)","archived":false,"fork":false,"pushed_at":"2024-12-25T07:57:08.000Z","size":4113,"stargazers_count":433,"open_issues_count":5,"forks_count":31,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-10-17T02:11:54.158Z","etag":null,"topics":["dependency-injection","di","di-container","inversion-of-control","ioc","ios","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/ivlevAstef.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2016-06-10T11:20:39.000Z","updated_at":"2025-09-15T16:37:48.000Z","dependencies_parsed_at":"2024-04-24T18:58:40.561Z","dependency_job_id":null,"html_url":"https://github.com/ivlevAstef/DITranquillity","commit_stats":{"total_commits":672,"total_committers":7,"mean_commits":96.0,"dds":"0.14136904761904767","last_synced_commit":"1df9731f7434d706df718322d58f28d669242335"},"previous_names":[],"tags_count":114,"template":false,"template_full_name":null,"purl":"pkg:github/ivlevAstef/DITranquillity","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivlevAstef%2FDITranquillity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivlevAstef%2FDITranquillity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivlevAstef%2FDITranquillity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivlevAstef%2FDITranquillity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ivlevAstef","download_url":"https://codeload.github.com/ivlevAstef/DITranquillity/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivlevAstef%2FDITranquillity/sbom","scorecard":{"id":498510,"data":{"date":"2025-08-11","repo":{"name":"github.com/ivlevAstef/DITranquillity","commit":"b5bd4554995a6067dfab1f5f52482154f81ee7cb"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.5,"checks":[{"name":"Code-Review","score":0,"reason":"Found 2/28 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 5 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-19T21:11:21.984Z","repository_id":43946190,"created_at":"2025-08-19T21:11:21.984Z","updated_at":"2025-08-19T21:11:21.984Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279681544,"owners_count":26209887,"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","status":"online","status_checked_at":"2025-10-19T02:00:07.647Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","di","di-container","inversion-of-control","ioc","ios","swift"],"created_at":"2025-10-20T13:21:22.474Z","updated_at":"2025-10-20T13:21:23.156Z","avatar_url":"https://github.com/ivlevAstef.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\u003cimg src =\"https://habrastorage.org/files/c6d/c89/5d0/c6dc895d02324b96bc679f41228ab6bf.png\" alt=\"Tranquillity\"/\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n\u003ca href=\"http://cocoapods.org/pods/DITranquillity\"\u003e\u003cimg src =\"https://img.shields.io/cocoapods/v/DITranquillity.svg?style=flat\"/\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/Carthage/Carthage\"\u003e\u003cimg src =\"https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat\"/\u003e\u003c/a\u003e\n\u003ca href=\"https://swift.org/package-manager\"\u003e\u003cimg src =\"https://img.shields.io/badge/SwiftPM-compatible-4BC51D.svg?style=flat\"/\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/ivlevAstef/DITranquillity/blob/master/LICENSE\"\u003e\u003cimg src =\"https://img.shields.io/github/license/ivlevAstef/DITranquillity.svg?maxAge=2592000\"/\u003e\u003c/a\u003e\n\u003ca href=\"https://developer.apple.com/swift\"\u003e\u003cimg src =\"https://img.shields.io/badge/Swift-3.0--6.0-F16D39.svg?style=flat\"/\u003e\u003c/a\u003e\n\u003ca href=\"http://cocoapods.org/pods/DITranquillity\"\u003e\u003cimg src =\"https://img.shields.io/badge/platform-iOS%20%7C%20macOS%20%7C%20tvOS%20%7C%20watchOS%20%7C%20Linux-lightgrey.svg\"/\u003e\u003c/a\u003e\n\u003ca href=\"https://codecov.io/gh/ivlevAstef/DITranquillity\"\u003e\u003cimg src =\"https://codecov.io/gh/ivlevAstef/DITranquillity/branch/master/graph/badge.svg\"/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n# DITranquillity\nTranquillity is a lightweight but powerful [dependency injection](https://en.wikipedia.org/wiki/Dependency_injection) library for swift.\n\nThe name \"Tranquillity\" laid the foundation in the basic principles of library: clarity, simplicity and security.\n\nIt says - use the library and you will be calm for your dependencies.\n\n\u003e Language switch: [English](README.md), [Russian](README_ru.md)\n\n## About Dependendy Injection\nDependency Injections is a software design pattern in which someone delivers dependencies to an object.\n\nIs one form of the broader technique of [Inversion Of Control](https://en.wikipedia.org/wiki/Inversion_of_control) and help the [Dependency Inversion Principle](https://en.wikipedia.org/wiki/Dependency_inversion_principle)\n\n[For more details you can read this link](Documentation/en/about_dependency_injection.md)\n\nAlso I recommend you to read [Glossary](Documentation/en/glossary.md) which will help to better understand the terms. \n\n## Features\n#### Core\n- [x] [Registration components and services](Documentation/en/core/registration_and_service.md)\n- [x] [Initializer/Property/Method Injections](Documentation/en/core/injection.md)\n- [x] [Optional and argument, many, by tag Injections](Documentation/en/core/modificated_injection.md)\n- [x] [Delayed injection](Documentation/en/core/delayed_injection.md)\n- [x] [Circular dependency injection](Documentation/en/core/injection.md)\n- [x] [Scope and lifetime](Documentation/en/core/scope_and_lifetime.md)\n- [x] [Modular](Documentation/en/core/modular.md)\n- [x] [Details logs](Documentation/en/core/logs.md)\n- [x] Thread safety\n- [x] Swift Concurrency\n- [x] [Container hierarchy](Documentation/en/core/container_hierarchy.md)\n#### UI\n- [x] [Storyboard and StoryboardReferences](Documentation/en/ui/storyboard.md)\n- [x] [Simple subviews and Cells Injection](Documentation/en/ui/view_injection.md)\n#### Graph API\n- [x] [Get dependency graph](Documentation/en/graph/get_graph.md)\n- [x] [Graph Validation](Documentation/en/graph/graph_validation.md)\n- [ ] [Visualization dependency graph](Documentation/en/graph/visualization_graph.md)\n\n## Installing\nThe library supports three popular package managers: Cocoapods, Carthage, SwiftPM.\n\nCocoapods unsupport from 5.0.0 library version.\n\n#### SwiftPM\nYou can use \"Xcode/File/Swift Packages/Add Package Dependency...\" and write github url:\n```\nhttps://github.com/ivlevAstef/DITranquillity\n```\n\nAlso you can edit your `Package.swift` and the following line into section `dependencies`:\n```Swift\n.package(url: \"https://github.com/ivlevAstef/DITranquillity.git\", from: \"5.0.0\")\n```\nAnd don't forget to specify in your section `target` wrote dependency line:\n```Swift\n.product(name: \"DITranquillity\")\n```\n\n#### CocoaPods\nAdd the following lines to your `Podfile`: \n```\npod 'DITranquillity'\n``` \n\n#### Carthage\nAdd the following lines to your `Cartfile`:\n```\ngithub \"ivlevAstef/DITranquillity\"\n```\n\n## Usage\nThe library uses a declarative style of dependency description, and allows you to separate your application code from dependency description code.\n\nFor a quick entry, let's look at an example code of one simplified VIPER screen:\n```Swift\n.................................................\n/// Dependency description\n\nlet container = DIContainer()\n\ncontainer.register(LoginRouter.init)\n\ncontainer.register(LoginPresenterImpl.init)\n  .as(LoginPresenter.self)\n  .lifetime(.objectGraph)\n\ncontainer.register(LoginViewController.init)\n  .injection(cycle: true, \\.presenter)\n  .as(LoginView.self)\n  .lifetime(.objectGraph)\n\ncontainer.register(AuthInteractorImpl.init)\n  .as(AuthInteractor.self)\n\n.................................................\n/// Application start point\n\nlet router: LoginRouter = container.resolve()\nwindow.rootViewController = router.rootViewController\nrouter.start()\n\n.................................................\n/// Application Code\n\nimport SwiftLazy\n\nclass LoginRouter {\n    let rootViewController = UINavigationController()\n    private let loginPresenterProvider: Provider\u003cLoginPresenter\u003e\n    \n    init(loginPresenterProvider: Provider\u003cLoginPresenter\u003e) {\n        loginPresenterProvider = loginPresenterProvider\n    }\n    \n    func start() {\n        let presenter = loginPresenterProvider.value\n        presenter.loginSuccessCallback = { [weak self] _ in\n            ...\n        }\n        // Your can write code without force cast, it's code simple example\n        rootViewController.push(presenter.view as! UIViewController)\n    }\n}\n\nprotocol LoginPresenter: class {\n    var loginSuccessCallback: ((_ userId: String) -\u003e Void)?\n    func login(name: String, password: String)\n}\n\nprotocol LoginView: class {\n    func showError(text: String)\n}\n\nclass LoginPresenterImpl: LoginPresenter {\n    private weak var view: LoginView?\n    private let authInteractor: AuthInteractor\n    init(view: LoginView, authInteractor: AuthInteractor) {\n        self.view = view\n        self.authInteractor = authInteractor\n    }\n    \n    func login(name: String, password: String) {\n        if name.isEmpty || password.isEmpty {\n            view?.showError(text: \"fill input\")\n            return\n        }\n        \n        authInteractor.login(name: name, password: password, completion: { [weak self] result in\n            switch result {\n            case .failure(let error): \n                self?.view?.showError(text: \"\\(error)\")\n            case .success(let userId):\n                self?.loginSuccessCallback?(userId)\n            }\n        })\n    }\n}\n\nclass LoginViewController: UIViewController, LoginView {\n    var presenter: LoginPresenter!\n    ...\n    func showError(text: String) {\n        showAlert(title: \"Error\", message: text)\n    }\n    \n    private func tapOnLoginButton() {\n        presenter.login(name: nameTextField.text ?? \"\", password: passwordTextField.text ?? \"\")\n    }\n}\n\nprotocol AuthInteractor: class {\n    func login(name: String, password: String, completion: (Result\u003cString, Error\u003e) -\u003e Void)\n}\n\nclass AuthInteractorImpl: AuthInteractor {\n    func login(name: String, password: String, completion: (Result\u003cString, Error\u003e) -\u003e Void) {\n        ...\n    }\n}\n```\nAs you can see, the dependency description code takes a small part, and the application code doen't know about how dependencies are implemented.  \n\nAlso your can show samples:\n* [For habr](Samples/SampleHabr/)\n* [Chaos](Samples/SampleChaos/)\n* [Delegate and observer](Samples/SampleDelegateAndObserver/)\n* [SwiftPM big clean architecture](https://github.com/ivlevAstef/FunCorpSteamApp)\n\nAlso your can read articles:\n* Ru! [https://habr.com/ru/post/457188/](https://habr.com/ru/post/457188/) \n* Ru! Old! [https://habr.com/ru/post/311334/](https://habr.com/ru/post/311334/)\n\n## Requirements\niOS 13.0+,macOS 10.15+,tvOS 13.0+, watchOS 8.0+, Linux; ARC\n\n* Swift 6.0-6.x: Xcode 16; version \u003e= 5.0.0\n* Swift 5.5-5.9: Xcode 13,14,15; version \u003e= 3.6.3\n* Swift 5.0-5.3: Xcode 10.2-12.x; version \u003e= 3.6.3\n* Swift 4.2: Xcode 10; version \u003e= 3.4.3\n* Swift 4.1: Xcode 9.3; version \u003e= 3.2.3\n* Swift 4.0: Xcode 9.0; version \u003e= 3.0.5\n* Swift 3.0-3.2: Xcode 8.0-9.0; 0.9.5 \u003c= version \u003c 3.7.0\n* Swift 2.3: Xcode 7.0; version \u003c 0.9.5\n\n## Changelog\nSee [CHANGELOG](CHANGELOG.md) file or [releases](https://github.com/ivlevAstef/DITranquillity/releases).\n\n## Feedback\n\n### I've found a bug, or have a feature request\nPlease raise a [GitHub issue](https://github.com/ivlevAstef/DITranquillity/issues).\n\n### I've found a defect in documentation, or thought up how to improve it\nPlease help library development and create [pull requests](https://github.com/ivlevAstef/DITranquillity/pulls)\n\n### Plea\nIf you like my library, then support the library by putting star.\n\n### Question?\nYou can feel free to ask the question at e-mail: ivlev.stef@gmail.com.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivlevastef%2Fditranquillity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fivlevastef%2Fditranquillity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivlevastef%2Fditranquillity/lists"}