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: https://www.hackingwithswift.com/articles/243/write-better-code-with-swift-algorithms
Write better code with Swift Algorithms

Write faster, simpler, safer Swift code with this powerful open-source package.

Hacking with Swift
And yes, there's a video if you prefer! https://www.youtube.com/watch?v=pUYw9D0aq6g
Write Better Code with Swift Algorithms

YouTube