{"id":3221,"url":"https://github.com/hiro-nagami/StoryboardBuilder","last_synced_at":"2025-08-03T13:32:13.539Z","repository":{"id":85221410,"uuid":"108200399","full_name":"hiro-nagami/StoryboardBuilder","owner":"hiro-nagami","description":"Simple dependency injection for generating views from storyboard.","archived":false,"fork":false,"pushed_at":"2019-01-14T17:58:36.000Z","size":35,"stargazers_count":5,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-24T09:03:52.411Z","etag":null,"topics":["carthage","ios","mit","mit-license","storyboard","swift","ui","xib"],"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/hiro-nagami.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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-10-25T00:46:52.000Z","updated_at":"2023-11-01T01:39:30.000Z","dependencies_parsed_at":"2023-08-30T16:24:44.450Z","dependency_job_id":null,"html_url":"https://github.com/hiro-nagami/StoryboardBuilder","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiro-nagami%2FStoryboardBuilder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiro-nagami%2FStoryboardBuilder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiro-nagami%2FStoryboardBuilder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiro-nagami%2FStoryboardBuilder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hiro-nagami","download_url":"https://codeload.github.com/hiro-nagami/StoryboardBuilder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228548567,"owners_count":17935221,"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":["carthage","ios","mit","mit-license","storyboard","swift","ui","xib"],"created_at":"2024-01-05T20:16:34.880Z","updated_at":"2024-12-07T01:30:42.720Z","avatar_url":"https://github.com/hiro-nagami.png","language":"Swift","funding_links":[],"categories":["Dependency Injection"],"sub_categories":["Getting Started","Web View"],"readme":"\n# StoryboardBuilder\nSimple dependency injection for generating views from storyboard.\n\n[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n![Swift 4.2](https://img.shields.io/badge/Swift-4.2-orange.svg?style=flat)\n\n## Description\n`StoryboardBuilder` is framework to help simply and easily generating that View and ViewController are defineded in Storyboard and Xib. You can generate instance and parse type of one by using `StoryboardBuilderProtocol` and `XibBuilderProtocol` description.\n\n## Install\n### Carthage\nAdd following.\n```\ngithub \"hiro-nagami/StoryboardBuilder\"\n```\n\n# How ot use\n## Way to get Storyboard Class\n\n1. Create storyboard file in your project.\n\n\u003cimg src=https://raw.githubusercontent.com/hiro-nagami/resource-repo/master/StoryboardBuilder/storyboard.png alt=storyboard width=600px /\u003e\n\n2. Import StoryboardBuilder_iOS.\n3. Your custom view controller extends `StoryboardBuilderProtocol`.\n4. `storyboardName` and `storyboardID` are implemented in that view controller.\n\n```swift\nimport UIKit\nimport Foundation\nimport StoryboardBuilder_iOS\n\nclass CustomViewController: UIViewController, StoryboardBuilderProtocol {\n    static var storyboardName: String = \"Main\"\n    static var storyboardID: String = \"CustomViewController\"\n    ...\n}\n```\n\nYou can use such as following.\n```swift\n/* You can generate CustomViewController just like following.\n    let storyboard = UIStoryboard(name: \"Main\", bundle: nil)\n    let customeVC = storyboard.instantiateViewController(withIdentifier: \"CustomViewController\") as! CustomViewController\n**/\n\nlet customViewController = CustomViewController.getModule()\n```\n\n## Way to get Xib Class\n\n1. Create xib file in your project.\n\n\u003cimg src=https://raw.githubusercontent.com/hiro-nagami/resource-repo/master/StoryboardBuilder/xib.png alt=xib width=600px /\u003e\n\n2. Import StoryboardBuilder_iOS.\n3. Your custom view controller extends `XibBuilderProtocol`.\n4. `xibName`is implemented in that view controller.\n\n```swift\nimport UIKit\nimport Foundation\nimport StoryboardBuilder_iOS\n\nclass CustomView: UIView, XibBuilderProtocol {\n    static var xibName: String = \"CustomView\"\n    ...\n}\n```\n\nYou can use such as following.\n```swift\n/* You can generate CustomView just like following.\n   let identifier = \"CustomView\"\n   let customViewNib = UINib(nibName: identifier, bundle: nil)\n   let customView = customViewNib.instantiate(withOwner: self, options: nil).first as! CustomView\n**/\n\nlet customView: CustomView = CustomView.getModule()\n```\n\nYou can register and use CustomTableViewCell.\n\n```swift\nclass CustomViewCell: UITableViewCell, XibBuilderProtocol {\n    static var xibName: String = \"CustomView\"\n    ...\n}\n\nclass TableViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {\n    @IBOutlet weak var tableView: UITableView!\n\n    override func viewDidLoad() {\n        super.viewDidLoad()\n        \n        self.tableView.delegate = self\n        self.tableView.dataSource = self\n        self.tableView.sb.register(cellClass: CustomViewCell.self)\n        self.tableView.sb.register(cellClasses: [\n            CustomViewACell.self,\n            CustomViewBCell.self,\n            CustomViewCCell.self,\n        ])\n    }\n    \n    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -\u003e UITableViewCell {\n        let cell = tableView.sb.dequeueReusableCell(cellClass: CustomViewBCell.self)\n\n        ...\n        \n        return cell\n    }\n}\n```\n\n## License\nStoryboardBuilder is released under the MIT license. [See LICENSE](https://github.com/hiro-nagami/StoryboardBuilder/blob/master/LICENSE) for details.\n\n## Author\n[@hiro_nagami](https://twitter.com/nagami_hiro)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhiro-nagami%2FStoryboardBuilder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhiro-nagami%2FStoryboardBuilder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhiro-nagami%2FStoryboardBuilder/lists"}