[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-6787":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":19,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":22,"hasPages":22,"topics":24,"createdAt":10,"pushedAt":10,"updatedAt":28,"readmeContent":29,"aiSummary":30,"trendingCount":16,"starSnapshotCount":16,"syncStatus":31,"lastSyncTime":32,"discoverSource":33},6787,"swift-algorithms","apple\u002Fswift-algorithms","apple","Commonly used sequence and collection algorithms for Swift","",null,"Swift",6316,474,233,34,0,3,6,1,39.03,"Apache License 2.0",false,"main",[25,26,27],"algorithm","iterator","itertools","2026-06-12 02:01:30","# Swift Algorithms\n\n**Swift Algorithms** is an open-source package of sequence and collection algorithms, along with their related types.\n\n## Overview\n\nThe Algorithms package provides a variety of sequence and collection operations, letting you cycle over a collection's elements, find combinations and permutations, create a random sample, and more.\n\nFor example, the package includes a group of \"chunking\" methods, each of which breaks a collection into consecutive subsequences. One version tests adjacent elements to find the breaking point between chunks — you can use it to quickly separate an array into ascending runs:\n\n```swift\nlet numbers = [10, 20, 30, 10, 40, 40, 10, 20]\nlet chunks = numbers.chunked(by: { $0 \u003C= $1 })\n\u002F\u002F [[10, 20, 30], [10, 40, 40], [10, 20]]\n```\n\nAnother version looks for a change in the transformation of each successive value. You can use that to separate a list of names into groups by the first character:\n\n```swift\nlet names = [\"Cassie\", \"Chloe\", \"Jasmine\", \"Jordan\", \"Taylor\"]\nlet chunks = names.chunked(on: \\.first)\n\u002F\u002F [[\"Cassie\", \"Chloe\"], [\"Jasmine\", \"Jordan\"], [\"Taylor\"]]\n```\n\nExplore more chunking methods and the remainder of the `Algorithms` package in the links below.\n\n## Documentation\n\nFor API documentation, see the library's official documentation in Xcode or on the Web.\n\n- [API documentation][docs]\n- [Swift.org announcement][announcement]\n- [API Proposals\u002FGuides][guides]\n\n## Adding Swift Algorithms as a Dependency\n\nTo use the `Algorithms` library in a SwiftPM project, \nadd the following line to the dependencies in your `Package.swift` file:\n\n```swift\n.package(url: \"https:\u002F\u002Fgithub.com\u002Fapple\u002Fswift-algorithms\", from: \"1.2.0\"),\n```\n\nInclude `\"Algorithms\"` as a dependency for your executable target:\n\n```swift\n.target(name: \"\u003Ctarget>\", dependencies: [\n    .product(name: \"Algorithms\", package: \"swift-algorithms\"),\n]),\n```\n\nFinally, add `import Algorithms` to your source code.\n\n## Source Stability\n\nThe Swift Algorithms package is source stable; version numbers follow [Semantic Versioning](https:\u002F\u002Fsemver.org\u002F). Source breaking changes to public API can only land in a new major version.\n\nThe public API of the `swift-algorithms` package consists of non-underscored declarations that are marked `public` in the `Algorithms` module. Interfaces that aren't part of the public API may continue to change in any release, including patch releases.\n\nFuture minor versions of the package may introduce changes to these rules as needed.\n\nWe'd like this package to quickly embrace Swift language and toolchain improvements that are relevant to its mandate. Accordingly, from time to time, we expect that new versions of this package will require clients to upgrade to a more recent Swift toolchain release. Requiring a new Swift release will only require a minor version bump.\n\n[docs]: https:\u002F\u002Fswiftpackageindex.com\u002Fapple\u002Fswift-algorithms\u002Fdocumentation\u002Falgorithms\n[announcement]: https:\u002F\u002Fswift.org\u002Fblog\u002Fswift-algorithms\u002F\n[guides]: https:\u002F\u002Fgithub.com\u002Fapple\u002Fswift-algorithms\u002Ftree\u002Fmain\u002FGuides\n","Swift Algorithms 是一个开源的 Swift 库，提供了常用的序列和集合算法。该项目的核心功能包括循环遍历、查找组合与排列、生成随机样本等操作，并且特别提供了一系列“分块”方法，可以将集合分割成连续子序列，支持基于元素比较或属性变化来划分数据。这些特性使得它非常适合需要对数据进行复杂处理的场景，如数据分析、排序、过滤等任务。采用 Apache License 2.0 许可发布，表明了其开放性和易用性，适用于任何希望利用 Swift 编程语言增强自身项目中数据处理能力的开发者。",2,"2026-06-11 03:08:52","top_language"]