{"id":32311978,"url":"https://github.com/sonmbol/uikitviewbuilder","last_synced_at":"2025-10-23T09:49:35.833Z","repository":{"id":268963852,"uuid":"906001203","full_name":"sonmbol/UIKitViewBuilder","owner":"sonmbol","description":"UIKitViewBuilder: Seamlessly integrate UIView, UITableViewCell, and UICollectionViewCell components into your SwiftUI projects. Elevate your app's UI flexibility with ease!","archived":false,"fork":false,"pushed_at":"2025-03-29T04:06:57.000Z","size":301,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-23T09:49:28.341Z","etag":null,"topics":["framework","integrate-uikit-with-swiftui","ios","open-source","resultbuilder","reusable-components","swift","swiftui","swiftui-uikit-integration","ui-components","uicollectioncell-swiftui","uihostingcontroller","uikit","uikit-for-swiftui","uitableviewcell-swiftui","uiview-swiftui","uiviewrepresentable","user-interface","view-builder","viewbuilder"],"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/sonmbol.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":"2024-12-20T00:29:12.000Z","updated_at":"2025-03-29T04:07:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"fb535c34-1b13-43ef-a6b3-b7c41cb3d6d3","html_url":"https://github.com/sonmbol/UIKitViewBuilder","commit_stats":null,"previous_names":["sonmbol/uikitviewbuilder"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/sonmbol/UIKitViewBuilder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sonmbol%2FUIKitViewBuilder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sonmbol%2FUIKitViewBuilder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sonmbol%2FUIKitViewBuilder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sonmbol%2FUIKitViewBuilder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sonmbol","download_url":"https://codeload.github.com/sonmbol/UIKitViewBuilder/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sonmbol%2FUIKitViewBuilder/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280598934,"owners_count":26357975,"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-23T02:00:06.710Z","response_time":142,"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":["framework","integrate-uikit-with-swiftui","ios","open-source","resultbuilder","reusable-components","swift","swiftui","swiftui-uikit-integration","ui-components","uicollectioncell-swiftui","uihostingcontroller","uikit","uikit-for-swiftui","uitableviewcell-swiftui","uiview-swiftui","uiviewrepresentable","user-interface","view-builder","viewbuilder"],"created_at":"2025-10-23T09:49:34.850Z","updated_at":"2025-10-23T09:49:35.823Z","avatar_url":"https://github.com/sonmbol.png","language":"Swift","readme":"# UIKitViewBuilder\n\n**UIKitViewBuilder** is a versatile Swift framework designed to seamlessly convert any `UIView`, `UITableViewCell`, or `UICollectionViewCell` into a `SwiftUI` view. This enables configuration and responsiveness to `Publisher`, making the integration of existing UI components into SwiftUI a breeze. Enhance your development experience with efficiency, excitement, and a touch of magic!\n\n## Features\n\n- **Seamless Integration**: Effortlessly convert any `UIView`, `UITableViewCell`, or `UICollectionViewCell` to a `SwiftUI` view.\n- **Configurable and Responsive**: Fully compatible with `SwiftUI` and responsive to `Publisher`.\n- **Result Builder**: Simplifies the implementation of `UIView`, `UITableViewCell`, or `UICollectionViewCell` as `SwiftUI` views using `UIKitViewBuilder`.\n\n## Installation\n\n### Swift Package Manager\n\nTo integrate `UIKitViewBuilder` into your project using Swift Package Manager, add the following to your `Package.swift` file:\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/sonmbol/UIKitViewBuilder.git\", from: \"1.0.0\")\n]\n```\n\n\n#### CocoaPods\n\n\nTo integrate `UIKitViewBuilder` using CocoaPods, add the following to your `Podfile`:\n\n```ruby\nsource 'https://github.com/CocoaPods/Specs.git'\nplatform :ios, '14.0'\n\ntarget 'YourAppTargetName' do\n  use_frameworks!\n  pod 'UIKitViewBuilder'\nend\n```\n\n### Usage\n\nThe core idea behind `UIKitViewBuilder` is to convert any `UIView`, `UITableViewCell`, or `UICollectionViewCell` into a `SwiftUI` view, making it configurable and responsive to `Publisher`. Below are some examples to get you started.\n\n### Example Usage\n\n#### Creating a View\n\n```swift\nstruct ContentView: View {\n    var body: some View {\n        List {\n            LabelView.makeView { view in\n                view.label.text = \"make SwiftUI View\"\n            }\n            LabelView()\n                .set(\\.label.text, to: \"make SwiftUI View\")\n                .makeView()\n            buildEmptyLabelView()\n            buildLabelView()\n            buildTableViewCell()\n            buildCollectionViewCell()\n            buildTableViewCells()\n            buildCollectionViewCells()\n        }\n    }\n}\n\nclass LabelView: UIView {\n    lazy var label = addLabel()\n\n    func addLabel() -\u003e UILabel {\n        let label = UILabel()\n        label.numberOfLines = 0\n        label.translatesAutoresizingMaskIntoConstraints = false\n        return label\n    }\n\n    override init(frame: CGRect) {\n        super.init(frame: frame)\n        addSubview(label)\n        NSLayoutConstraint.activate([\n            label.leadingAnchor.constraint(equalTo: leadingAnchor, constant: 16),\n            label.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -16),\n            label.topAnchor.constraint(equalTo: topAnchor, constant: 8),\n            label.bottomAnchor.constraint(equalTo: bottomAnchor, constant: -8)\n        ])\n    }\n\n    required init?(coder: NSCoder) {\n        fatalError(\"init(coder:) has not been implemented\")\n    }\n}\n```\n\n\n#### UIKitViewBuilder for Single Cells\n\n```swift\n@UIKitViewBuilder\nfunc buildLabelView() -\u003e some View {\n    LabelView { view in\n        view.label.text = \"SwiftUI View UIView\"\n    }\n}\n\n@UIKitViewBuilder\nfunc buildEmptyLabelView() -\u003e some View {\n    LabelView()\n        .set(\\.label.text, to: \"Dynamic Content Here\")\n        .set(\\.backgroundColor, to: .red)\n}\n\n@UIKitViewBuilder\nfunc buildTableViewCell() -\u003e some View {\n    LabelTableViewCell { cell in\n        cell.label.text = \"SwiftUI View TableViewCell\"\n    }\n}\n\n@UIKitViewBuilder\nfunc buildCollectionViewCell() -\u003e some View {\n    LabelCollectionViewCell { cell in\n        cell.label.text = \"SwiftUI View CollectionViewCell\"\n    }\n}\n```\n\n\n#### UIKitViewBuilder for Multiple Cells\n\n```swift\n@UIKitViewBuilder\nfunc buildLabelViews() -\u003e some View {\n    LabelView { cell in\n        cell.label.text = \"First UIView\"\n    }\n    LabelView { cell in\n        cell.label.text = \"Second UIView\"\n    }\n    LabelView { cell in\n        cell.label.text = \"Third UIView\"\n    }\n}\n\n@UIKitViewBuilder\nfunc buildTableViewCells() -\u003e some View {\n    LabelTableViewCell { cell in\n        cell.label.text = \"First TableViewCell\"\n    }\n    LabelTableViewCell { cell in\n        cell.label.text = \"Second TableViewCell\"\n    }\n    LabelTableViewCell { cell in\n        cell.label.text = \"Third TableViewCell\"\n    }\n}\n\n@UIKitViewBuilder\nfunc buildCollectionViewCells() -\u003e some View {\n    LabelCollectionViewCell { cell in\n        cell.label.text = \"First CollectionViewCell\"\n    }\n    LabelCollectionViewCell { cell in\n        cell.label.text = \"Second CollectionViewCell\"\n    }\n    LabelCollectionViewCell { cell in\n        cell.label.text = \"Third CollectionViewCell\"\n    }\n}\n```\n\n\n#### UIKitViewBuilder for Multiple Cells\n\n```swift\n@UIKitViewBuilder\nfunc buildLabelViews() -\u003e some View {\n    LabelView { cell in\n        cell.label.text = \"First UIView\"\n    }\n    LabelView { cell in\n        cell.label.text = \"Second UIView\"\n    }\n    LabelView { cell in\n        cell.label.text = \"Third UIView\"\n    }\n}\n\n@UIKitViewBuilder\nfunc buildTableViewCells() -\u003e some View {\n    LabelTableViewCell { cell in\n        cell.label.text = \"First TableViewCell\"\n    }\n    LabelTableViewCell { cell in\n        cell.label.text = \"Second TableViewCell\"\n    }\n    LabelTableViewCell { cell in\n        cell.label.text = \"Third TableViewCell\"\n    }\n}\n\n@UIKitViewBuilder\nfunc buildCollectionViewCells() -\u003e some View {\n    LabelCollectionViewCell { cell in\n        cell.label.text = \"First CollectionViewCell\"\n    }\n    LabelCollectionViewCell { cell in\n        cell.label.text = \"Second CollectionViewCell\"\n    }\n    LabelCollectionViewCell { cell in\n        cell.label.text = \"Third CollectionViewCell\"\n    }\n}\n```\n\n\n### How It Works\n\n\n- **Extraction**: The `UIView`, `UITableViewCell`, or `UICollectionViewCell` is first extracted as a `UIView`.\n- **Container**: A container is added around it to override `intrinsicContentSize` since `SwiftUI` respects the size only, not the constraints.\n- **Content Integration**: The cell content is added inside the container.\n- **Result Builder**: To make the view easy to use in `SwiftUI`, a result builder called `UIKitViewBuilder` is used.\n\nBy following this approach, you can easily integrate your existing `UIView`, `UITableViewCell`, or `UICollectionViewCell` components into `SwiftUI`, making your development process smoother and more efficient.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsonmbol%2Fuikitviewbuilder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsonmbol%2Fuikitviewbuilder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsonmbol%2Fuikitviewbuilder/lists"}