{"id":16260115,"url":"https://github.com/kautenja/uixibview","last_synced_at":"2025-04-08T13:50:09.697Z","repository":{"id":97116753,"uuid":"97291292","full_name":"Kautenja/UIXibView","owner":"Kautenja","description":"a UIView subclass for easily building IBDesignable views without boilerplate","archived":false,"fork":false,"pushed_at":"2018-06-03T08:43:12.000Z","size":343,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-14T10:18:25.707Z","etag":null,"topics":["boilerplate","carthage","ibdesignable","ios","ios-framework","uiview-subclass","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/Kautenja.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-07-15T04:07:46.000Z","updated_at":"2018-11-18T09:07:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"16a434c1-9fc0-4fb9-8005-20c51b24431d","html_url":"https://github.com/Kautenja/UIXibView","commit_stats":{"total_commits":13,"total_committers":2,"mean_commits":6.5,"dds":0.3846153846153846,"last_synced_commit":"42f2c6dac16c0cb12524b02cd2d60c318724dd17"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kautenja%2FUIXibView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kautenja%2FUIXibView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kautenja%2FUIXibView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kautenja%2FUIXibView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kautenja","download_url":"https://codeload.github.com/Kautenja/UIXibView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247855040,"owners_count":21007481,"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":["boilerplate","carthage","ibdesignable","ios","ios-framework","uiview-subclass","xib"],"created_at":"2024-10-10T16:06:24.950Z","updated_at":"2025-04-08T13:50:09.660Z","avatar_url":"https://github.com/Kautenja.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# UIXibView\n\n![Icon](./img/icon.png)\n\n[![swift-badge][]][swift-link]\n[![carthage-badge][]][carthage-link]\n\n[swift-badge]: https://img.shields.io/badge/swift-4.0-orange.svg\n[swift-link]: https://swift.org/\n[carthage-badge]: https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat\n[carthage-link]: https://github.com/Carthage/Carthage\n\nThis framework aims to simplify the process of building custom IBDesignables by\nreducing boilerplate and hiding the ugly interface builder details from what\nshould be concise, and reusable subclasses of UIView.\n\n## Example\n\nTo run the example project, clone the repo, and run build the project, also check out the storyboard to see the custom view build.\n\n## Requirements\n\n*   iOS10.0\n\n## Installation\n\n### Carthage\n\nTo install it, add the following line to your Cartfile:\n\n```\ngithub \"Kautenja/UIXibView\" \"master\"\n```\n\n## Workflow\n\nThe basic workflow for creating a custom IBDesignable looks like this.\n\n1.  start with stubbing your UIView subclass\n\n```swift\nimport UIXibView\n\n@IBDesignable class DummyView: UIXibView {\n\n}\n```\n\nyou'll notice that instead of subclassing `UIView`, we have subclassed `XibView`\ninstead. What this does is associate this class directly with a xib file of the\nsame name. Don't worry, XibView is a subclass of UIView.\n*   dont forget the `@IBDesignable` flag. without it, the interface builder\n    wont know that this is a view to build.\n\n2.  Create the xib file\n\nNext create the `.xib` file that you will design your custom view in, it's\nimportant that the xib filename match the class that it will be owned by. This\nis how the `XibView` machinery automatically finds its xib file based on the\nsubclass name. In our example case the file would be called `DummyView.xib`\n\n3.  Set the owner of the nib file to the class you stubbed.\n\n![File Owner Navigator](./img/1.png)\n\n![File Owner Class](./img/2.png)\n\n*   **the view inside the xib should not be subclassed by the custom class**\n\n4.  Set up the view dimensions\n\n![Select View](./img/3.png)\n\n![Set Dimensions](./img/4.png)\n\n5.  Design your view\n\n![Design](./img/5.png)\n\n6.  Hookup IBOutlets, IBActions, write IBInspectables, etc.\n\n```swift\nimport UIXibView\n\n/// an example of the XibView subclassing pattern\n@IBDesignable class DummyView: UIXibView {\n\n    /// some segmented control\n    @IBOutlet weak var segmentedControl: UISegmentedControl!\n\n    /// some button\n    @IBOutlet weak var button: UIButton!\n\n    /// the background color of some button, can be changed\n    /// in the interface builder\n    @IBInspectable var buttonBackgroundColor: UIColor? {\n        get {\n            return button.backgroundColor\n        }\n        set {\n            button.backgroundColor = newValue\n        }\n    }\n\n    /// the top switch\n    @IBOutlet weak var switchTop: UISwitch!\n\n    /// the bottom switch\n    @IBOutlet weak var switchBottom: UISwitch!\n\n}\n```\n\n7.  Use your custom view in another view or storyboard or whatever!\n\n![Using View](./img/6.png)\n\n## Author\n\nkautenja, kautencreations@gmail.com\n\n## License\n\nUIXibView is available under the MIT license. See the [LICENSE][] file for more info.\n\n[LICENSE]: ./LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkautenja%2Fuixibview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkautenja%2Fuixibview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkautenja%2Fuixibview/lists"}