I’ve made a calculator using Doubles in Swift. The problem is that when I display the outcome it will display .0 at the end even if it’s a round number. I have tried the round() function but since it’s a double it still seems to always display .0 . In Objective-c i did this by typing:
[NSString stringWithFormat:@”%.0f”, RunningTotal]; //RunningTotal being the outcome
In this case there would be no decimals at all which there would if there stood @”%.3f” for example.
Does anyone know how to do this in swift? I’ve looked around on different forums but couldn’t find it anywhere... Thanks!