Sesame-iOS/Sesame/Common/Extensions/Array+Extensions.swift

15 lines
264 B
Swift
Raw Normal View History

2023-08-14 10:39:29 +02:00
import Foundation
extension Array {
func count(where closure: (Element) -> Bool) -> Int {
var result = 0
forEach { element in
if closure(element) {
result += 1
}
}
return result
}
}