Swift: How to Join an Array of Strings into a single String
It is a common task to join an array of strings into a single string in programming. Here’s how you do it in Swift.
Swift 2
let array = ["Matthew", "John", "Paul", "Peter"]
let stringOfNames = array.joinedWithSeparator(", ")
Swift 3
let array = ["Matthew", "John", "Paul", "Peter"]
let stringOfNames = array.joined(separator: ", ")