mardi 4 août 2015

String format optional parameter in swift

Ola,

I don't have to much exp with the Swift language. I want to print into a String some variables and some of them are optional.

func onRegPin(timeOut: Int64, pin: String?)->()
{
  String(format: "Timeout: %d  Pin: %@", timeOut, pin!)
}

If the pin is nil at runtime I got some assert or something. There is a way to print this optional parameters using String ?

Thanks,

Aucun commentaire:

Enregistrer un commentaire