Instance Methodswift 6.0.1FoundationEssentials->Swift
filter(_:)
- iOS
- 17+
- macOS
- 14+
- tvOS
- 17+
- watchOS
- 10+
func filter(_ predicate: Predicate<Self.Element>) throws -> [Self.Element]
func filter(_ predicate: Predicate<Self.Element>) throws -> [Self.Element]
sST20FoundationEssentialsE6filterySay7ElementQzGAA9PredicateVyAD_QPGKF
What are these?7HBGE
import FoundationEssentials
import Swift
protocol Sequence<Element>
A type that provides sequential, iterated access to its elements.
struct Predicate<each Input>
associatedtype Element where Self.Element == Self.Iterator.Element
A type representing the sequence’s elements.
func compare<Comparator>(_ lhs: Comparator.Compared, _ rhs: Comparator.Compared) -> ComparisonResult where Comparator : SortComparator, Comparator == Self.Element
If lhs
is ordered before rhs
in the ordering described by the given sequence of SortComparator
s
func sorted<Comparator>(using comparator: Comparator) -> [Self.Element] where Comparator : SortComparator, Self.Element == Comparator.Compared
Returns the elements of the sequence, sorted using the given comparator to compare elements.
func sorted<S, Comparator>(using comparators: S) -> [Self.Element] where S : Sequence, Comparator : SortComparator, Comparator == S.Element, Self.Element == Comparator.Compared
Returns the elements of the sequence, sorted using the given array of SortComparator
s to compare elements.