In Swift 3 I am getting the following error (which wasn't happening in Swift 2):
No * candidates produce the expected result type FloatingPointRoundingRule
I don't know what I need to do to fix it.
I am trying to convert latitude decimal to degrees/minutes/seconds
extension CLLocationDegrees {
mutating func toLatitudeSeconds() -> String {
var seconds = Int(round(self * 3600)) //error here
// etc ...
}
}
The rounding functions were changed to be called on an instance rather than being global functions. You're basically trying to do self.round(self*3600)
which doesn't work because the round
function takes either no argument or an argument of type FloatingPointRoundingRule
.
You probably want:
var seconds = Int((self*3600).rounded())
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.