vendredi 3 avril 2015

Create string template in Swift?

I would like to store a string as a constant in Swift so I can reuse it and inject variables into it. For example, I can do this in C#:



var template = "Your name is {0} and your age is {1}."
someLabel.text = string.Format(template, "John", 35)
some2Label.text = string.Format(template, "Jane", 33)


How can I accomplish this in Swift so I can reuse the string template?


Aucun commentaire:

Enregistrer un commentaire