Xcode 8 Beta 4 Swift 3 – “round” behaviour changed

This is due to a naming conflict with the new rounding functions on the FloatingPoint protocol, round() and rounded(), which have been added to Swift 3 as of Xcode 8 beta 4.

You therefore either need to disambiguate by specifying that you’re referring to global round() function in the Darwin module:

return Darwin.round(v) * divisor

Or, even better, simply make use of the new rounding functions and call rounded() on v:

return v.rounded() * divisor

Leave a Comment