The closest equivalent to Python’s any()/all() methods in Swift

any(), all() methods in Python

Equivalent methods in Swift

Predicate: A closure that takes an element of the sequence as its argument and returns a Boolean value that indicates whether the passed element satisfies a condition. — Apple documentation

Advanced idea

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store