{"id":16742501,"url":"https://github.com/johnsundell/require","last_synced_at":"2025-04-05T13:09:06.758Z","repository":{"id":62452810,"uuid":"87566717","full_name":"JohnSundell/Require","owner":"JohnSundell","description":"Require optional values to be non-nil, or crash gracefully","archived":false,"fork":false,"pushed_at":"2019-06-18T15:57:33.000Z","size":23,"stargazers_count":415,"open_issues_count":0,"forks_count":17,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-10-14T01:23:55.410Z","etag":null,"topics":["optionals","swift","xcode"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":false,"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/JohnSundell.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-07T16:39:32.000Z","updated_at":"2024-09-13T02:56:35.000Z","dependencies_parsed_at":"2022-11-01T23:46:29.193Z","dependency_job_id":null,"html_url":"https://github.com/JohnSundell/Require","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JohnSundell%2FRequire","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JohnSundell%2FRequire/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JohnSundell%2FRequire/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JohnSundell%2FRequire/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JohnSundell","download_url":"https://codeload.github.com/JohnSundell/Require/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247339158,"owners_count":20923014,"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":["optionals","swift","xcode"],"created_at":"2024-10-13T01:23:56.471Z","updated_at":"2025-04-05T13:09:06.740Z","avatar_url":"https://github.com/JohnSundell.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ✅ Require\n\n[![CocoaPods](https://img.shields.io/cocoapods/v/Require.svg)](https://cocoapods.org/pods/Require)\n[![Carthage](https://img.shields.io/badge/carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![Swift PM](https://img.shields.io/badge/spm-compatible-brightgreen.svg?style=flat)](https://swift.org/package-manager)\n[![Twitter](https://img.shields.io/badge/contact-@johnsundell-blue.svg?style=flat)](https://twitter.com/johnsundell)\n\nRequire lets you easily require `Optional` values to be non-`nil`, or crash gracefully.\n\nSometimes you have optional values in your code that are not really optional, and will cause your\napplication to enter an undefined state if `nil`. Require makes it easy to avoid such states, by\ncausing a crash with rich debug information, to enable you to much easier hunt down \u0026 fix the bug.\n\n## Usage\n\nCall `require()` on any `Optional`, optionally giving a `hint` for debugging purposes:\n\n```swift\nclass ConfigurationLoader {\n    func load() -\u003e Configuration {\n        let data = readJSONFile().require(hint: \"Verify that Config.JSON is valid\")\n        let config: Configuration? = try? unbox(data: data)\n        return config.require()\n    }\n}\n```\n\n## Installation\n\n**Swift Package Manager:**\n\nAdd `.Package(url: \"git@github.com:johnsundell/require.git\", majorVersion: 1)` to your `Package.swift` file.\n\n**CocoaPods:**\n\nAdd `pod \"Require\"` to your `Podfile`.\n\n**Carthage:**\n\nAdd `github \"johnsundell/require\"` to your `Cartfile`.\n\n**Manual:**\n\nClone the repo and drag the file `Require.swift` into your Xcode project.\n\n## Help, feedback or suggestions?\n\n- [Open a PR](https://github.com/JohnSundell/Require/pull/new/master) if you want to make some change to Require.\n- Contact [@johnsundell on Twitter](https://twitter.com/johnsundell) for discussions, news \u0026 announcements about Require.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnsundell%2Frequire","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohnsundell%2Frequire","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnsundell%2Frequire/lists"}