I'd like to understand why Swift 4 and Swift 3.2 have different flatMap
behaviors.
Consider the following code:
let myURLArray: ([URL]) = [ URL(string: "https://www.google.fr")! ]
let result = myURLArray.flatMap { $0.absoluteString }
print(result)
With Swift 3.2:
result
is interpreted as a [String]
and the output is:
["https://www.google.fr"]
With Swift 4:
result
is interpreted as a [String.Element]
and the output is:
["h", "t", "t", "p", "s", ":", "/", "/", "w", "w", "w", ".", "g", "o", "o", "g", "l", "e", ".", "f", "r"]
I cannot find the item describing this change of behavior in Swift 4's release notes. Can anybody explain?