Below is how I would have previously truncated a float to two decimal places
NSLog(@\" %.02f %.02f %.02f\", r, g, b);
I checked the docs an
You can also create an operator in this way
operator infix <- {} func <- (format: String, args:[CVarArg]) -> String { return String(format: format, arguments: args) } let str = "%d %.1f" <- [1453, 1.123]