{"id":30179908,"url":"https://github.com/capturecontext/swift-result-builders","last_synced_at":"2025-08-12T06:51:01.483Z","repository":{"id":307151351,"uuid":"1027781385","full_name":"CaptureContext/swift-result-builders","owner":"CaptureContext","description":"Set of general-purpose result builders","archived":false,"fork":false,"pushed_at":"2025-07-28T14:22:16.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-10T11:51:13.061Z","etag":null,"topics":["array","array-builder","declarative-programming","result-builder","resultbuilder","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/CaptureContext.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}},"created_at":"2025-07-28T14:21:42.000Z","updated_at":"2025-07-28T14:24:02.000Z","dependencies_parsed_at":"2025-07-29T19:48:15.730Z","dependency_job_id":"292c5109-2b8a-44aa-abfa-13710a05c4aa","html_url":"https://github.com/CaptureContext/swift-result-builders","commit_stats":null,"previous_names":["capturecontext/swift-result-builders"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/CaptureContext/swift-result-builders","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CaptureContext%2Fswift-result-builders","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CaptureContext%2Fswift-result-builders/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CaptureContext%2Fswift-result-builders/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CaptureContext%2Fswift-result-builders/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CaptureContext","download_url":"https://codeload.github.com/CaptureContext/swift-result-builders/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CaptureContext%2Fswift-result-builders/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270017356,"owners_count":24512973,"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-08-12T02:00:09.011Z","response_time":80,"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":["array","array-builder","declarative-programming","result-builder","resultbuilder","swift"],"created_at":"2025-08-12T06:50:59.242Z","updated_at":"2025-08-12T06:51:01.473Z","avatar_url":"https://github.com/CaptureContext.png","language":"Swift","readme":"# swift-result-builders\n\n[![SwiftPM 6.2](https://img.shields.io/badge/swiftpm-6.2-ED523F.svg?style=flat)](https://swift.org/download/) ![Platforms](https://img.shields.io/badge/Platforms-iOS_13_|_macOS_10.15_|_Catalyst_|_tvOS_14_|_watchOS_7-ED523F.svg?style=flat) [![@capture_context](https://img.shields.io/badge/contact-@capture__context-1DA1F2.svg?style=flat\u0026logo=twitter)](https://twitter.com/capture_context)\n\n## Products\n\n- **[ArrayBuilder](./Sources/ArrayBuilder)**\n\n\n## Usage\n\n### ArrayBuilder\n\nCreate initializers for your own collections, here is an example of `IdentifiedArray` extension for [`swift-identified-collections`](https://github.com/pointfreeco/swift-identified-collections)\n\n```swift\nimport IdentifiedCollections\nimport ArrayBuilder\n\nextension IdentifiedArray {\n  @inlinable\n  public init(\n    id: KeyPath\u003cElement, ID\u003e,\n    @ArrayBuilder\u003cElement\u003e uniqueElements: () -\u003e [Element]\n  ) {\n    self.init(id: id, uniqueElements: uniqueElements())\n  }\n}\n\nextension IdentifiedArray where Element: Identifiable, ID == Element.ID {\n  @inlinable\n  public init(\n    @ArrayBuilder\u003cElement\u003e uniqueElements: () -\u003e [Element]\n  ) {\n    self.init(uniqueElements: uniqueElements())\n  }\n}\n\nfunc example(all: Bool) {\n  IdentifiedArray(id: \\.self) {\n    if all {\n      \"all\"\n    } else {\n    \t\"some\"\n    }\n    \"values\"\n    \"are\"\n    \"here\"\n  }\n}\n```\n\nArray initializer is provided by default\n\n```swift\n[1,2,3,4,5,6,7] == Array {\n  1\n  2\n  [3, 4]\n  [[5], [6, 7]]\n}\n```\n\nSee more examples in [`Tests`](./Tests/ArrayBuilderTests/ArrayBuilderTests.swift)\n\n## Installation\n\n### Basic\n\nYou can add swift-result-builders to an Xcode project by adding it as a package dependency.\n\n1. From the **File** menu, select **Swift Packages › Add Package Dependency…**\n2. Enter [`\"https://github.com/capturecontext/swift-result-builders\"`](https://github.com/capturecontext/swift-result-builders) into the package repository URL text field\n3. Choose products you need to link them to your project.\n\n### Recommended\n\nIf you use SwiftPM for your project structure, add DeclarativeConfiguration to your package file.\n\n```swift\n.package(\n\turl: \"git@github.com:capturecontext/swift-result-builders.git\",\n\t.upToNextMinor(from: \"0.0.1\")\n)\n```\nor via HTTPS\n\n```swift\n.package(\n\turl: \"https://github.com:capturecontext/swift-result-builders.git\",\n\t.upToNextMinor(from: \"0.0.1\")\n)\n```\n\nDo not forget about target dependencies:\n\n```swift\n.product(\n\tname: \"ArrayBuilder\",\n\tpackage: \"swift-result-builders\"\n)\n```\n\n## License\n\nThis library is released under the MIT license. See [LICENSE](./LICENSE) for details.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcapturecontext%2Fswift-result-builders","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcapturecontext%2Fswift-result-builders","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcapturecontext%2Fswift-result-builders/lists"}