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
Swift 4:
(x/1000).rounded()*1000