Rounding is pretty simple in Swift 3. But as usual there are a few gotchas:

1. Rounding is performed by the rounded() function:

2. If you want to round to a certain number of decimals, try a little arithmetic:

I think that’s all you need!

Where to go Next

This tutorial comes straight out of The Complete iOS Developer Course. Over 40 hours long it contains everything you need to create awe inspiring apps fast!

Click here to check it out!

How to Round a Number in Swift 3

Leave a Reply

Your email address will not be published. Required fields are marked *

Share This

Want this Post in Easy to Understand Video Form?

Then get theĀ Complete iOS Developer Course. Over 50 hours of pure Swift coding goodness designed to turn you into a coding master!

One Time Offer - $9! Click to Get it!

WARNING: Once this box is closed the offer will not be shown again.

Thank you!