Swift Tip - Printing multiple variables at once?

Wanna print multiple variables?

Problem

1
2
3
4
5
let name = "Tony"
let lastName: "Stark"
print(name)
print(lastName)

Better solution

Wrap them on a tuple.

1
2
3
4
let name = "Tony"
let lastName: "Stark"
print((name, lastName))

Awh, syntactic sugar ☺️

Partager Commentaires