Aller au contenu

Combine Collection Operations (ARCH9077)

Ce contenu n’est pas encore disponible dans votre langue.

Key swift.performance.combine-collection-operations · Severity info · Category performance

Flags filter { }.first / filter { }.count / filter { }.isEmpty / map { }.compactMap chains that have a single-pass equivalent.

users.filter { $0.admin }.first
users.first { $0.admin }

Use first(where:), contains(where:), count(where:), compactMap.