Home > AI > IOS > Combine >

allSatisfy(_:)

Example 1:

let sWords = ["Swift", "Seahorse", "Solar"]
let allMatch = sWords
    .allSatisfy { $0.hasPrefix("S") }
print(allMatch) // true

Example 2:


let scores = [85, 88, 95, 92]
let passed = scores.allSatisfy { $0 >= 85 }
print(passed)

Leave a Reply