{"id":15630716,"url":"https://github.com/robrix/box","last_synced_at":"2025-04-07T12:10:29.667Z","repository":{"id":21727044,"uuid":"25048714","full_name":"robrix/Box","owner":"robrix","description":"Swift µframework of the ubiquitous Box\u003cT\u003e \u0026 MutableBox\u003cT\u003e reference types, for recursive value types \u0026 misc. other purposes.","archived":false,"fork":false,"pushed_at":"2017-01-14T13:31:00.000Z","size":54,"stargazers_count":215,"open_issues_count":3,"forks_count":31,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-06T16:44:47.726Z","etag":null,"topics":[],"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/robrix.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}},"created_at":"2014-10-10T18:49:44.000Z","updated_at":"2024-03-28T04:18:04.000Z","dependencies_parsed_at":"2022-08-17T16:25:28.753Z","dependency_job_id":null,"html_url":"https://github.com/robrix/Box","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robrix%2FBox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robrix%2FBox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robrix%2FBox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robrix%2FBox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robrix","download_url":"https://codeload.github.com/robrix/Box/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247648977,"owners_count":20972945,"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":[],"created_at":"2024-10-03T10:35:44.648Z","updated_at":"2025-04-07T12:10:29.650Z","avatar_url":"https://github.com/robrix.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Box\n\nThis is a Swift microframework which implements `Box\u003cT\u003e` \u0026 `MutableBox\u003cT\u003e`, with implementations of `==`/`!=` where `T`: `Equatable`.\n\n`Box` is typically used to work around limitations of value types:\n\n- recursive `struct`s/`enum`s\n- type-parameterized `enum`s where more than one `case` has a value\n\n## Use\n\nWrapping \u0026 unwrapping a `Box`:\n\n```swift\n// Wrap:\nlet box = Box(1)\n\n// Unwrap:\nlet value = box.value\n```\n\nChanging the value of a `MutableBox`:\n\n```swift\n// Mutation:\nlet mutableBox = MutableBox(1)\nmutableBox.value = 2\n```\n\nBuilding a recursive value type:\n\n```swift\nstruct BinaryTree {\n\tlet value: Int\n\tlet left: Box\u003cBinaryTree\u003e?\n\tlet right: Box\u003cBinaryTree\u003e?\n}\n```\n\nBuilding a parameterized `enum`:\n\n```swift\nenum Result\u003cT\u003e {\n\tcase Success(Box\u003cT\u003e)\n\tcase Failure(NSError)\n}\n```\n\nSee the sources for more details.\n\n## Integration\n\n1. Add this repo as a submodule in e.g. `External/Box`:\n  \n        git submodule add https://github.com/robrix/Box.git External/Box\n2. Drag `Box.xcodeproj` into your `.xcworkspace`/`.xcodeproj`.\n3. Add `Box.framework` to your target’s `Link Binary With Libraries` build phase.\n4. You may also want to add a `Copy Files` phase which copies `Box.framework` (and any other framework dependencies you need) into your bundle’s `Frameworks` directory. If your target is a framework, you may instead want the client app to include `Box.framework`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobrix%2Fbox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobrix%2Fbox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobrix%2Fbox/lists"}