{"id":32151335,"url":"https://github.com/adobels/uiviewkit","last_synced_at":"2026-02-19T07:01:43.621Z","repository":{"id":194275990,"uuid":"689650927","full_name":"Adobels/UIViewKit","owner":"Adobels","description":"UIViewKit is a Swift framework for writing modern UIKit view hierarchies in a SwiftUI-like style.","archived":false,"fork":false,"pushed_at":"2026-01-30T09:50:18.000Z","size":1698,"stargazers_count":20,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-16T07:19:09.923Z","etag":null,"topics":["dsl","ib","interface-builder","interfacebuilder","ios","resultbuilder","swift","swiftuikit","uikit","uiview","uiviewbuilder","uiviewdsl"],"latest_commit_sha":null,"homepage":"https://adobels.github.io/UIViewKit/","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/Adobels.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-09-10T13:42:09.000Z","updated_at":"2025-11-12T19:31:35.000Z","dependencies_parsed_at":"2024-01-10T19:02:58.617Z","dependency_job_id":"60a93cc6-301f-47d4-94f7-f494c54cefd4","html_url":"https://github.com/Adobels/UIViewKit","commit_stats":{"total_commits":11,"total_committers":2,"mean_commits":5.5,"dds":0.2727272727272727,"last_synced_commit":"beb85d1240bda1135c2ae2a13146b9c24eff446b"},"previous_names":["adobels/swiftuikit","adobels/swiftiboutlet","adobels/uiviewdsl","adobels/uiviewkit"],"tags_count":46,"template":false,"template_full_name":null,"purl":"pkg:github/Adobels/UIViewKit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Adobels%2FUIViewKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Adobels%2FUIViewKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Adobels%2FUIViewKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Adobels%2FUIViewKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Adobels","download_url":"https://codeload.github.com/Adobels/UIViewKit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Adobels%2FUIViewKit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29605799,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T06:47:36.664Z","status":"ssl_error","status_checked_at":"2026-02-19T06:45:47.551Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["dsl","ib","interface-builder","interfacebuilder","ios","resultbuilder","swift","swiftuikit","uikit","uiview","uiviewbuilder","uiviewdsl"],"created_at":"2025-10-21T10:42:14.513Z","updated_at":"2026-02-19T07:01:43.616Z","avatar_url":"https://github.com/Adobels.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2FAdobels%2FUIViewKit%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/Adobels/UIViewKit)\n[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2FAdobels%2FUIViewKit%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/Adobels/UIViewKit)\n\n# UIViewKit\n\nUIViewKit lets you build UIKit views directly in code with a syntax that feels like SwiftUI.\nIt provides a DSL powered by @resultBuilder for both UIView hierarchies and NSLayoutConstraints, so you can create entire UIViewController scenes in strongly typed Swift - without relying on storyboards or XIBs.\n\n## Key Features\n\n- **DSL with @resultBuilder for UIKit** - Build UIView hierarchies in Swift using a declarative, SwiftUI-like syntax. With builders like ibSubviews, ibAttributes, and ibApply, your code becomes compact, expressive, and easy to read.\n\n- **Constraint Generator** - Define AutoLayout with ibConstraints for fast, expressive, and compact constraint definitions.\n\n- **FreeForm Preview** - Instantly preview UIKit views and controllers with live constraint evaluation. Test layouts across multiple device sizes without leaving Xcode.\n\n\n## How to Use\n\n### \"Hello, World!\"\n\n```swift\nimport UIViewKit\n\nclass ViewController: UIViewController {\n        \n    override func viewDidLoad() {\n        super.viewDidLoad()\n        view.ibSubviews {\n            UILabel().ibAttributes {\n                $0.centerXAnchor.constraint(equalTo: view.centerXAnchor)\n                $0.centerYAnchor.constraint(equalTo: view.centerYAnchor)\n                $0.text = \"Hello, world!\"\n            }\n        }\n    }\n}\n```\n\n### Defining ViewController's View, Complex\n\n```swift\nfinal class ViewController: UIViewController {\n\n    private var profileItems: [(title: String, value: String)] = [\n        (\"Framework: \", \"UIViewKit\"),\n        (\"Platform: \", \"iOS\"),\n        (\"Programming Language: \", \"Swift\"),\n        (\"Device:\" , \"Simulator\"),\n        (\"FreeForm Preview:\" , \"UIKit, SwiftUI\"),\n    ]\n\n    private var headerView: UIStackView!\n\n    override func loadView() {\n        super.loadView()\n        view.ibSubviews {\n            UIStackView(axis: .vertical, alignment: .fill).ibOutlet(\u0026headerView).ibSubviews {\n                UIImageView().ibAttributes {\n                    $0.widthAnchor.constraint(equalTo: $0.heightAnchor).ibPriority(.required)\n                    $0.image = .init(systemName: \"person.circle\")\n                    $0.contentMode  = .scaleAspectFit\n                    $0.tintColor = .white\n                    $0.layer.cornerRadius = 20\n                    $0.backgroundColor = .systemBlue\n                }\n            }.ibAttributes {\n                $0.leadingAnchor.constraint(equalTo: view.leadingAnchor)\n                $0.topAnchor.constraint(equalTo: view.topAnchor)\n                $0.trailingAnchor.constraint(equalTo: view.trailingAnchor)\n                $0.backgroundColor = .systemGreen\n                $0.layoutMargins = .init(top: 20, left: 20, bottom: 20, right: 20)\n                $0.isLayoutMarginsRelativeArrangement = true\n            }\n            UIStackView(axis: .vertical).ibSubviews {\n                for item in profileItems {\n                    RowView().ibAttributes {\n                        $0.titleLabel.text = item.title\n                        $0.valueLabel.text = item.value\n                    }\n                }\n                UIView()\n            }.ibAttributes {\n                $0.topAnchor.constraint(equalTo: headerView.bottomAnchor)\n                $0.leadingAnchor.constraint(equalTo: view.leadingAnchor)\n                $0.trailingAnchor.constraint(equalTo: view.trailingAnchor)\n                $0.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor)\n            }\n        }.ibAttributes {\n            $0.backgroundColor = .systemBackground\n        }\n    }\n}\n\nfinal class RowView: UIView {\n\n    var titleLabel: UILabel!\n    var valueLabel: UILabel!\n\n    required init?(coder: NSCoder) {\n        fatalError()\n    }\n\n    override init(frame: CGRect) {\n        super.init(frame: frame)\n        self.ibSubviews {\n            UIStackView(axis: .vertical).ibSubviews {\n                UIStackView(axis: .horizontal, spacing: 10).ibSubviews {\n                    UILabel().ibOutlet(\u0026titleLabel)\n                    UILabel().ibOutlet(\u0026valueLabel).ibAttributes {\n                        $0.textColor = .systemGray\n                        $0.textAlignment = .right\n                    }\n                }\n                UIView().ibAttributes {\n                    $0.heightAnchor.constraint(equalToConstant: 1)\n                    $0.backgroundColor = .separator\n                }\n            }.ibAttributes {\n                $0.leadingAnchor.constraint(equalTo: layoutMarginsGuide.leadingAnchor)\n                $0.topAnchor.constraint(equalTo: topAnchor)\n                $0.trailingAnchor.constraint(equalTo: layoutMarginsGuide.trailingAnchor)\n                $0.bottomAnchor.constraint(equalTo: bottomAnchor)\n                $0.heightAnchor.constraint(equalToConstant: 66)\n            }\n        }\n    }\n}\n```\n\n## IBFreeForm Preview Demo\n\n```swift\nimport SwiftUI\n\n#Preview {\n    IBFreeForm {\n        ViewController()\n    }\n }\n```\n\n![](IBFreeFormPreview.gif)\n\n## 📖  Documentation\n- ibSubviews - Define the hierarchy of views, similar to Interface Builder's Document Outline. When applied to a UIStackView, the DSL uses the `addArrangedSubview` method\n- ibAttributes - Configure attributes and constraints of a view. This corresponds to Interface Builder’s Identity, Attributes, Size, and Connections Inspectors.\n\n⚠️ When defining a constraint, either the first or second item must be the same view to which you are applying ibAttributes.\n\n- ibApply - Similar to ibAttributes, but without a @resultBuilder for constraints — useful for custom configurations, it works with NSObject and UIView\n- IBFreeForm - Wraps a UIView, UIViewController, or even a SwiftUI.View, allowing resizing in the simulator. You can also define a snapFrame to display frames of specific devices (e.g., iPhone SE).\n- IBDebug - Provides showColors, showFrames to help visualize layout frames during debugging. Works only with UIKit.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadobels%2Fuiviewkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadobels%2Fuiviewkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadobels%2Fuiviewkit/lists"}