by @CodingExample

How to concatenate two strings in Swift

Home » swift » How to concatenate two strings in Swift

Swift offers us three different ways to concatenate or joining strings.

First way + operator

We can use the + operator to concatenate two strings in swift.

let first = "yes "
let second = "boss"
let combined = fist + second

Second-way interpolation

let first = "yes"
let second = "boss"
let combined = "\(first) \(second)"

Third way += operator

let name = "john"

name += 'doe'