Chunk stateless feed requests to support more than 500 subscriptions (#967)

This commit is contained in:
Phil-Bastian Berndt
2026-08-23 12:22:07 +02:00
committed by GitHub
parent c41016185c
commit d46002e99a
4 changed files with 238 additions and 18 deletions

View File

@@ -0,0 +1,17 @@
//
// Array+Chunked.swift
// Yattee
//
// Splitting arrays into fixed-size chunks.
//
import Foundation
extension Array {
/// Splits the array into chunks of the specified size.
func chunked(into size: Int) -> [[Element]] {
stride(from: 0, to: count, by: size).map {
Array(self[$0..<Swift.min($0 + size, count)])
}
}
}