diff options
| author | Fuwn <[email protected]> | 2025-06-18 04:18:12 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2025-06-18 04:18:12 -0700 |
| commit | d4ab6da2541e2dcb325590c2ed347413384cb802 (patch) | |
| tree | 0f4c574e96cc6ba793b7d244ea4da474eb1f7b23 /Sora/Extensions | |
| parent | feat: Development commit (diff) | |
| download | sora-testing-d4ab6da2541e2dcb325590c2ed347413384cb802.tar.xz sora-testing-d4ab6da2541e2dcb325590c2ed347413384cb802.zip | |
feat: Development commit
Diffstat (limited to 'Sora/Extensions')
| -rw-r--r-- | Sora/Extensions/Array+Chunked.swift | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Sora/Extensions/Array+Chunked.swift b/Sora/Extensions/Array+Chunked.swift new file mode 100644 index 0000000..d6d56e9 --- /dev/null +++ b/Sora/Extensions/Array+Chunked.swift @@ -0,0 +1,7 @@ +extension Array { + func chunked(into size: Int) -> [[Element]] { + stride(from: 0, to: count, by: size).map { index in + Array(self[index..<Swift.min(index + size, count)]) + } + } +} |