When I wanted to trunc a floating number for showing in a label in Objective-C I could just use LABEL.text = [NSString stringWithFormat:@"%.3f", FLOAT];
Though I can't find how to do so in Swift.
When I wanted to trunc a floating number for showing in a label in Objective-C I could just use LABEL.text = [NSString stringWithFormat:@"%.3f", FLOAT];
Though I can't find how to do so in Swift.
The old NSString format is still available. You can use that.
let myfloat : Float = 1.23
LABEL.text = NSString(format: "%.3f", myfloat)