{"id":18683774,"url":"https://github.com/efprefix/efsafearray","last_synced_at":"2025-04-12T04:31:57.843Z","repository":{"id":56909323,"uuid":"98663984","full_name":"EFPrefix/EFSafeArray","owner":"EFPrefix","description":"EFSafeArray is an extension to make array subscript safe, support iOS, macOS, watchOS and tvOS.","archived":false,"fork":false,"pushed_at":"2025-02-14T19:48:57.000Z","size":170,"stargazers_count":16,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-04T23:43:53.233Z","etag":null,"topics":["array","auto","nil","range","safe","swift"],"latest_commit_sha":null,"homepage":"https://swiftpackageindex.com/EFPrefix/EFSafeArray","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/EFPrefix.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-07-28T15:41:03.000Z","updated_at":"2025-03-29T20:19:48.000Z","dependencies_parsed_at":"2024-01-23T21:36:23.258Z","dependency_job_id":null,"html_url":"https://github.com/EFPrefix/EFSafeArray","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EFPrefix%2FEFSafeArray","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EFPrefix%2FEFSafeArray/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EFPrefix%2FEFSafeArray/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EFPrefix%2FEFSafeArray/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EFPrefix","download_url":"https://codeload.github.com/EFPrefix/EFSafeArray/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248517233,"owners_count":21117419,"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":["array","auto","nil","range","safe","swift"],"created_at":"2024-11-07T10:15:41.783Z","updated_at":"2025-04-12T04:31:57.837Z","avatar_url":"https://github.com/EFPrefix.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"![](https://raw.githubusercontent.com/EFPrefix/EFSafeArray/master/Assets/EFSafeArray.png)\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/Carthage/Carthage/\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://swiftpackageindex.com/EFPrefix/EFSafeArray\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/SPM-ready-orange.svg\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"http://cocoapods.org/pods/EFSafeArray\"\u003e\n    \t\u003cimg src=\"https://img.shields.io/cocoapods/v/EFSafeArray.svg?style=flat\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"http://cocoapods.org/pods/EFSafeArray\"\u003e\n    \t\u003cimg src=\"https://img.shields.io/cocoapods/p/EFSafeArray.svg?style=flat\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/apple/swift\"\u003e\n    \t\u003cimg src=\"https://img.shields.io/badge/language-swift-orange.svg\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://raw.githubusercontent.com/EFPrefix/EFSafeArray/master/LICENSE\"\u003e\n    \t\u003cimg src=\"https://img.shields.io/cocoapods/l/EFSafeArray.svg?style=flat\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\nEFSafeArray is an extension to make array subscript safe, nil will be return instead of crash if index is out of range, it works on `iOS`, `macOS`, `watchOS` and `tvOS`.\n\n## Example\n\nTo run the example project, clone the repo, and run `pod install` from the Example directory first.\n\n## Requirements\n\n- Xcode 16+\n- Swift 6.0+\n\n## Installation\n\n### CocoaPods\n\nEFSafeArray is available through [CocoaPods](http://cocoapods.org). To install it, simply add the following line to your Podfile:\n\n```ruby\npod 'EFSafeArray'\n```\n\n### Swift Package Manager\n\nThe [Swift Package Manager](https://swift.org/package-manager/) is a tool for automating the distribution of Swift code and is integrated into the Swift compiler.\n\nOnce you have your Swift package set up, adding EFSafeArray as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift`.\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/EFPrefix/EFSafeArray.git\", .upToNextMinor(from: \"6.0.0.0\"))\n]\n```\n\n## Use\n\n```swift\nvar list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]\n// Get Index\nlet xxx = list[0]               // xxx: Int = 1\nlet zzz = list[0~]              // zzz: Int? = 1\nlet yyy = list[10~]             // yyy: Int? = nil\n\n// Set Index\nlist[0] = 0                     // list = [0, 2, 3, 4, 5, 6, 7, 8, 9, 0]\nlist[0~] = 1                    // list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]\nlist[10~] = 10                  // list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]\n\n// Get Bounds\nlet iiii = list[(0...5)~]       // iiii: ArraySlice\u003cInt\u003e? = [1, 2, 3, 4, 5, 6]\nlet oooo = list[(-1...12)~]     // oooo: ArraySlice\u003cInt\u003e? = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]\n\n// Set Bounds\nlist[(0...5)~] = [1]            // list = [1, 7, 8, 9, 0]\nlist[(-1...12)~] = [2, 3, 4, 5] // list = [2, 3, 4, 5]\n```\n\n## Author\n\nEyreFree, eyrefree@eyrefree.org\n\n## License\n\n![](https://upload.wikimedia.org/wikipedia/commons/thumb/f/f8/License_icon-mit-88x31-2.svg/128px-License_icon-mit-88x31-2.svg.png)\n\nEFSafeArray is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fefprefix%2Fefsafearray","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fefprefix%2Fefsafearray","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fefprefix%2Fefsafearray/lists"}