How to perform reversing of all words in a sentence.
Example
let str = \"Hello playground\"
Result should be like \"olleH dnuorg
\"olleH dnuorg
Working code!
import UIKit var str = "Hello playground" let result = str.split(separator: " ").map { String($0.reversed())}.joined(separator: " ") print(result) // olleH dnuorgyalp