Returns an array containing the concatenated results of calling the given transformation with each element of this sequence.
- iOS 7.0+
- macOS 10.9+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
- Xcode 10.2+
A closure that accepts an element of this sequence as its argument and returns a sequence or collection.
The resulting flattened array.
Use this method to receive a single-level collection when your transformation produces a sequence or collection for each element.
In this example, note the difference in the result of using
flat with a transformation that returns an array.
s is equivalent to
Complexity: O(m + n), where n is the length of this sequence and m is the length of the result.