Rounding is pretty simple in Swift. But as usual there are a few gotchas:
1. Rounding is performed by the rounded() function:
var myNum = 8.09
myNum.rounded() //result = 8 which is stored in myNum
2. If you want to round to a certain number of decimals, try a little arithmetic:
var myNum = 8.09213
myNum = (myNum * 100).rounded() / 100 //gives 8.09
I think that’s all you need!