{"id":13428733,"url":"https://github.com/bemindinteractive/SwiftSortedList","last_synced_at":"2025-03-16T01:33:28.790Z","repository":{"id":62456728,"uuid":"56483608","full_name":"bemindinteractive/SwiftSortedList","owner":"bemindinteractive","description":"Sometimes you need order","archived":false,"fork":false,"pushed_at":"2016-09-16T10:06:12.000Z","size":46,"stargazers_count":5,"open_issues_count":1,"forks_count":2,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-02T03:34:32.081Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/bemindinteractive.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":"2016-04-18T06:43:46.000Z","updated_at":"2021-12-07T08:26:58.000Z","dependencies_parsed_at":"2022-11-01T22:46:08.028Z","dependency_job_id":null,"html_url":"https://github.com/bemindinteractive/SwiftSortedList","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bemindinteractive%2FSwiftSortedList","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bemindinteractive%2FSwiftSortedList/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bemindinteractive%2FSwiftSortedList/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bemindinteractive%2FSwiftSortedList/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bemindinteractive","download_url":"https://codeload.github.com/bemindinteractive/SwiftSortedList/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243814905,"owners_count":20352037,"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-07-31T01:01:03.765Z","updated_at":"2025-03-16T01:33:28.448Z","avatar_url":"https://github.com/bemindinteractive.png","language":"Swift","funding_links":[],"categories":["Data Structures / Algorithms"],"sub_categories":["Other free courses"],"readme":"# SwiftSortedList\n\n[![Version](https://img.shields.io/cocoapods/v/SwiftSortedList.svg?style=flat)](http://cocoapods.org/pods/SwiftSortedList)\n[![License](https://img.shields.io/cocoapods/l/SwiftSortedList.svg?style=flat)](http://cocoapods.org/pods/SwiftSortedList)\n[![Platform](https://img.shields.io/cocoapods/p/SwiftSortedList.svg?style=flat)](http://cocoapods.org/pods/SwiftSortedList)\n\n## Usage\n\nAll you need is a Comparable object:\n\n```\nimport SwiftSortedList\n\nstruct MyObj : Comparable {\n    var id: Int\n}\n\nfunc ==(x: MyObj, y: MyObj) -\u003e Bool {\n    return x.id == y.id\n}\nfunc \u003c(x: MyObj, y: MyObj) -\u003e Bool {\n    return x.id \u003c y.id\n}\n```\n\nThen you can use the SortedList:\n\n```\n// create a new sorted list\n\nvar sl = SortedList\u003cMyObj\u003e()\n\n\n// add an object\n\nlet mo = MyObj(id: 1)\nsl.addElement(mo)\n\n\n// get an object\n\nlet mo2 = sl.getAt(0)\nlet mo2s = sl[0]\nprint(mo2 == mo2s)\n\n\n// helpers functions\n\nlet size: Int = sl.count\nlet elements: [MyObj] = sl.array\n\n\n// remove an object\n\nsl.removeElement(mo)\n\n\n// replace an object\nlet mo3 = MyObj(id: 3)\nsl.replace(at: 0, with: mo3)\nprint(mo2 == sl[0]) // false\nprint(mo3 == sl[0]) // true\n\n// loop\n\nfor el in sl.array {\n    // do something with el\n}\n\n```\n\n### \n\n## Installation\n\nSwiftSortedList is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod \"SwiftSortedList\"\n```\n\n## Author\n\n[Alessandro Miliucci](https://github.com/lifeisfoo)\n\n## License\n\nSwiftSortedList 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%2Fbemindinteractive%2FSwiftSortedList","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbemindinteractive%2FSwiftSortedList","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbemindinteractive%2FSwiftSortedList/lists"}