From 90dc3329d1973fda691e357cf4523d5c7c67fa1d Mon Sep 17 00:00:00 2001 From: 杨锴 <841720330@qq.com> Date: 星期二, 11 三月 2025 12:23:53 +0800 Subject: [PATCH] fix bug --- Pods/SwifterSwift/Sources/SwifterSwift/SwiftStdlib/CollectionExtensions.swift | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Pods/SwifterSwift/Sources/SwifterSwift/SwiftStdlib/CollectionExtensions.swift b/Pods/SwifterSwift/Sources/SwifterSwift/SwiftStdlib/CollectionExtensions.swift index 9d411f4..fb52aa8 100644 --- a/Pods/SwifterSwift/Sources/SwifterSwift/SwiftStdlib/CollectionExtensions.swift +++ b/Pods/SwifterSwift/Sources/SwifterSwift/SwiftStdlib/CollectionExtensions.swift @@ -13,7 +13,7 @@ // MARK: - Methods -public extension Collection { +public extension Collection where Self: Sendable { #if canImport(Dispatch) /// SwifterSwift: Performs `each` closure for each element of collection in parallel. /// @@ -22,13 +22,15 @@ /// } /// /// - Parameter each: closure to run for each element. - func forEachInParallel(_ each: (Self.Element) -> Void) { + func forEachInParallel(_ each: @Sendable (Self.Element) -> Void) { DispatchQueue.concurrentPerform(iterations: count) { each(self[index(startIndex, offsetBy: $0)]) } } #endif +} +public extension Collection { /// SwifterSwift: Safe protects the array from out of bounds by use of optional. /// /// let arr = [1, 2, 3, 4, 5] @@ -61,6 +63,7 @@ return slices } + #if !os(Linux) /// SwifterSwift: Get all indices where condition is met. /// /// [1, 7, 1, 2, 4, 1, 8].indices(where: { $0 == 1 }) -> [0, 2, 5] @@ -68,9 +71,10 @@ /// - Parameter condition: condition to evaluate each element against. /// - Returns: all indices where the specified condition evaluates to true (optional). func indices(where condition: (Element) throws -> Bool) rethrows -> [Index]? { - let indices = try self.indices.filter { try condition(self[$0]) } + let indices = try indices.filter { try condition(self[$0]) } return indices.isEmpty ? nil : indices } + #endif /// SwifterSwift: Calls the given closure with an array of size of the parameter slice. /// -- Gitblit v1.7.1