compacted() replaces the common compactMap { $0 } pattern, product() eliminates nested for-loops, and uniqued() removes duplicates from any sequence. Apple's Swift Algorithms package is full of small wins like these. Have a look: hackingwithswift.com/articles/

0

If you have a fediverse account, you can quote this note from your own instance. Search https://mastodon.social/users/twostraws/statuses/116256178002410037 on your instance and quote it. (Note that quoting is not supported in Mastodon.)