Applications

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: ", ")

Screen shot 2016 11 28 at 10.13.45 am