While playing around, I found the round() function in swift. It can be used as below:
round(0.8)
Which will return 1, as expected. Here\'s
You can do:
round(1000 * x) / 1000