What are we supposed to use in place of flatMap ?

The Swift compiler keeps flagging my use of flatMap suggesting that I use compactMap instead, the only problem being that I use flatMap to flatten sequences of sequences into a single sequence, something that compactMap does not do ( as far as I am aware ). compactMap is great when one needs to eliminate nils from a sequence but it's useless when one wishes to flatten a sequence of sequences. Can someone tell me if there is a replacement for flatMap that gives one the same behaviour as flatMap, the compiler is irritating me no end with this warning ?

Thanks in advance

flatMap is alive and well. Just make sure your sequence of sequence and its elements are non-optional. If they are then you will trigger the deprecated version of the flatMap function which will then suggest the use of compactMap.

compactMap is great when one needs to eliminate nils from a sequence but it's useless when one wishes to flatten a sequence of sequences. Can someone tell me if there is a replacement for flatMap that gives one the same behaviour as flatMap, the compiler is irritating me no end with this warning

flatMap is not deprecated in all cases. The following explains in detail:

h t t p s : / / useyourloaf.com/blog/replacing-flatmap-with-compactmap/

What are we supposed to use in place of flatMap ?
 
 
Q