{"id":13995505,"url":"https://github.com/tarunon/Instantiate","last_synced_at":"2025-07-22T22:31:03.842Z","repository":{"id":56915547,"uuid":"75518032","full_name":"tarunon/Instantiate","owner":"tarunon","description":"Type-safe and constructor injectable InterfaceBuilder protocols.","archived":false,"fork":false,"pushed_at":"2020-12-16T03:14:54.000Z","size":163,"stargazers_count":161,"open_issues_count":0,"forks_count":14,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-16T10:16:19.781Z","etag":null,"topics":["ios","nib","protocol","storyboard","swift"],"latest_commit_sha":null,"homepage":"","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/tarunon.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":"2016-12-04T04:48:02.000Z","updated_at":"2023-09-03T05:01:28.000Z","dependencies_parsed_at":"2022-08-21T03:50:42.800Z","dependency_job_id":null,"html_url":"https://github.com/tarunon/Instantiate","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/tarunon/Instantiate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tarunon%2FInstantiate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tarunon%2FInstantiate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tarunon%2FInstantiate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tarunon%2FInstantiate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tarunon","download_url":"https://codeload.github.com/tarunon/Instantiate/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tarunon%2FInstantiate/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266585668,"owners_count":23952163,"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-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":["ios","nib","protocol","storyboard","swift"],"created_at":"2024-08-09T14:03:27.089Z","updated_at":"2025-07-22T22:31:03.281Z","avatar_url":"https://github.com/tarunon.png","language":"Swift","funding_links":[],"categories":["Swift"],"sub_categories":[],"readme":"# Instantiate\n[![Build Status](https://travis-ci.org/tarunon/Instantiate.svg?branch=master)](https://travis-ci.org/tarunon/Instantiate)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n\nType-safe and constructor injectable InterfaceBuilder protocols.\n\n## Summary\n\nStoryboard and Nib is not type safe, if you use `UIStoryboard` or `UINib`, your code would be get some gloom.\nInstantiate take type-safe protocols for Storyboard and Nib. Lets' improve our code with type-safe protocols!\n\n### as is\n```swift\nlet storyboard = UIStoryboard(name: \"ViewController\", bundle: Bundle.main)\nlet vc = storyboard.instantiateInitialViewController() as! ViewController\nvc.inject([1, 2, 3])\n```\n\n### to be\n```swift\nimport Instantiate\nimport InstantiateStandard\nextension ViewController: StoryboardInstantiatable {}\nlet vc = ViewController(with: [1, 2, 3])\n```\n\n\n## Protocols\n### StoryboardInstantiatable\nSupports using viewController with Storyboard. Implement `StoryboardInstantiatable` at your viewController class, then you can use `ViewController(with: Dependency)`.\n### NibInstantiatable\nSupports using view with Nib. Implement `NibInstantiatable` at your view class, then you can use `View(with: Dependency)`.\n#### NibInstantiatableWrapper\nSupports using view implements NibInstantiatable in other InterfaceBuilder. NibInstantiatableWrapper supports workaround. Make new `UIView` subclass, and implement `NibInstantiatableWrapper`, call `loadView` on `init(coder:)` and `prepareForInterfaceBuilder`. \nhttp://stackoverflow.com/questions/27807951/how-to-embed-a-custom-view-xib-in-a-storyboard-scene\n### Reusable\nSupports `UITableViewCell` / `UICollectionViewCell` reuse features.\nImplement `Reusable`, then you can dequeue cell using `Cell.dequeue(from: Parent, for: IndexPath, with: Dependency)`.\n\n## InstantiateStandard\n`StoryboardType` and `NibType` required `static var storyboard` or `static var nib`. You need to write these values on own class, it is troublesome...\nMany developer define StoryboardName is same of ClassName, and if you are also, you can use `InstantiateStandard`.\nThis libraly add default implementation of `StoryboardType`, `NibType`, and `Reusable`.\n\n## Instalation\n### Carthage\n```ruby\ngithub \"tarunon/Instantiate\"\n```\n\n### Pods\n```ruby\npod 'Instantiate'\n```\n\n### Swift Package Manager\n\nSelect Xcode menu File \u003e Swift Packages \u003e Add Package Dependency... and enter repository URL with GUI.\n\n```\nRepository: https://github.com/tarunon/tarunon/Instantiate\n```\n\n## Requirement\nPlatform | Version\n--- | ---\niOS | 9.0+\nmacOS | 10.11+\ntvOS | 9.0+\nSwift | 4.0+\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftarunon%2FInstantiate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftarunon%2FInstantiate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftarunon%2FInstantiate/lists"}