Swift Closures — Trailing Syntax and Shorthand Magic ✨
In the last article, we built our first closure and passed it into sorted(). The result worked perfectly — but the code looked like this: let heroes = ["Naruto", "Sakura", "Sasuke", "Hinata", "Rock Lee"] let captainFirstHeroes = heroes.sorted(by: { (name1: String, name2: String) -> Bool in if name1




