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
//It will more help, by specify how much decimal Point you want. let decimalPoint = 2 let floatAmount = 1.10001 let amountValue = String(format: "%0.*f", decimalPoint, floatAmount)