Swift is currently missing this method. When pitched in Swift Evolution Forums, this method was met with no opposition. This looks like a clear omission without any downsides, that should be easy to add into Swift standard library without the need to go through lengthy Swift Evolution process.
Additional Detail from JIRA
| | | |------------------|-----------------| |Votes | 0 | |Component/s | Standard Library | |Labels | New Feature, LanguageFeatureRequest | |Assignee | None | |Priority | Medium | md5: 3852b2408d69c13546d326891036b911Issue Description:
There is a strong precedent from other programming languages that have optional types to include method named
filter
that conditionally maps the optional tonil
. The implementation is trivial:Swift is currently missing this method. When pitched in Swift Evolution Forums, this method was met with no opposition. This looks like a clear omission without any downsides, that should be easy to add into Swift standard library without the need to go through lengthy Swift Evolution process.