{"id":20399533,"url":"https://github.com/appsquickly/typhoonswift","last_synced_at":"2025-10-14T11:39:15.529Z","repository":{"id":142346908,"uuid":"74909551","full_name":"appsquickly/TyphoonSwift","owner":"appsquickly","description":"Powerful dependency injection for iOS \u0026 OSX working on a pure Swift","archived":false,"fork":false,"pushed_at":"2016-12-01T07:54:00.000Z","size":1766,"stargazers_count":128,"open_issues_count":6,"forks_count":7,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-10-14T11:39:11.303Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://www.typhoonframework.org/","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/appsquickly.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"publiccode":null,"codemeta":null}},"created_at":"2016-11-27T19:33:39.000Z","updated_at":"2025-08-25T16:36:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"d8ab4564-813b-4cc2-a7fb-3c540eeb540a","html_url":"https://github.com/appsquickly/TyphoonSwift","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/appsquickly/TyphoonSwift","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appsquickly%2FTyphoonSwift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appsquickly%2FTyphoonSwift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appsquickly%2FTyphoonSwift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appsquickly%2FTyphoonSwift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/appsquickly","download_url":"https://codeload.github.com/appsquickly/TyphoonSwift/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appsquickly%2FTyphoonSwift/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279019061,"owners_count":26086517,"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-14T02:00:06.444Z","response_time":60,"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":[],"created_at":"2024-11-15T04:29:45.874Z","updated_at":"2025-10-14T11:39:15.485Z","avatar_url":"https://github.com/appsquickly.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TyphoonSwift\n\nThis is alpha version. Works with Xcode 8.1 and Swift 3.\n\n\n# Installation\n\n```\nbrew install appsquickly/core/typhoon\n```\n\n# Concept\n\nTyphoonSwift uses code generation to build your assembly. It runs as separate process (via terminal) and parses your source files on change. Once you change your assembly file and save, it parses it and generate \"activated assembly\" automatically.\n\n\n# Project setup\n\n- Setup typhoon to run with your Swift project\n\ngo to your project directory and run:\n\n```\ntyphoon setup\n```\n\nthat makes `Typhoon.plist` file with settings.\n\n- Run typhoon monitor\n\n```\ntyphoon run\n```\n\n- Add generated files to your project.\n\nJust drag results directory to your project ( see `resultDirPath` inside `Typhoon.plist` ). It contains activated assemblies built from your assemblies and tiny typhoon runtime.\n\n# How to use\n\nmake sure that typhoon is up and running ( `typhoon run` command), then you can create assemblies inside your assemblies directory.\nAssemblies syntax is very similar to Typhoon Objc:\n\n```swift\nclass CoreComponents : Assembly {\n        \n    func manWith(_ name: String) -\u003e Definition {\n        return Definition(withClass: Man.self) {\n            $0.injectProperty(\"name\", with: name)\n            $0.setScope(Definition.Scope.ObjectGraph)\n            $0.injectProperty(\"brother\", with: self.man())\n        }\n    }\n    \n    func man() -\u003e Definition {\n        return Definition(withClass: Man.self) { configuration in\n            configuration.injectProperty(\"name\", with: \"John\")\n            configuration.injectProperty(\"brother\", with: self.manWith(\"Alex\"))\n        }\n    }\n \n    func manWithInitializer() -\u003e Definition {\n        return Definition(withClass: Man.self) {\n            $0.setScope(Definition.Scope.Prototype)\n            $0.useInitializer(\"init(withName:)\", with: { (m) in\n                m.injectArgument(\"Tom\")\n            })\n            $0.injectMethod(\"setAdultAge\")\n            $0.injectMethod(\"setValues(_:withAge:)\") { (m) in\n                m.injectArgument(\"John\")\n                m.injectArgument(21)\n            }\n        }\n    }\n}\n```\n\nAfter you've done with assemblies, you should activate Typhoon (That instantiates all eager singletones)\n\n```swift\nfunc application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -\u003e Bool {\n        // Override point for customization after application launch.\n        \n        Typhoon.activateAssemblies()\n        return true\n}\n```\n\nThat's all, now you can inject your components anywhere in your project, just like:\n\n```swift\nclass ViewController: UIViewController {\n    let man = CoreComponents.assembly.man()   \n    \n    override func viewDidLoad() {\n        super.viewDidLoad()\n        // Do any additional setup after loading the view, typically from a nib.\n        \n        print(\"man.name=\\(man.name)\")\n    }\n}\n```\n\nYou can resolve all your definition through\n\u003cAssembly-Class\u003e.assembly.\u003cDefinition-Method()\u003e\n\nGenerated assembly has all your definitions methods, plus additional ways to resolve.\nSee examples below:\n\n```swift\n\n// Resovle using definition method\n\nlet man = CoreComponents.assembly.manWithInitializer()\n\n// Get all components matching Type\nlet men = CoreComponents.assembly.allComponentsForType() as [Man]\n\n// Resolve by Key\nlet keyedMen = CoreComponents.assembly.component(forKey: \"man\") as Man?\n\n// Inject using instance type\nvar woman = Woman()\nCoreComponents.assembly.inject(\u0026woman)\n\n// Resolve by Type\nlet byTypeWoman = CoreComponents.assembly.componentForType() as Woman?\n\n```\n\nIf you still have questions how to use it, try Example project (see Example subdirectory)\n\n# Credits\n\n\n- [Aleksey Garbarev](https://github.com/alexgarbarev) - main idea and implementation\n- [Igor Vasilenko](https://github.com/vasilenkoigor) - huge effort and outcome in refactoring\n- [Valeriy Popov](https://github.com/complexityclass) - swift2 -\u003e swift 3 convertation. Moving dependencies to SPM\n- [German Saprykin](https://github.com/mogol) - moving SPM dependencies to separate project to keep main project untouched on SPM updates\n- You are welcome to be here :-)\n\nTyphoonSwift is highly inspired by original Typhoon founded by [Jasper Blues](https://github.com/jasperblues).\n\nSolving circular references solution inspired by FieryCrucible DI framework.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappsquickly%2Ftyphoonswift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fappsquickly%2Ftyphoonswift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappsquickly%2Ftyphoonswift/lists"}