I'm simply trying to round the CGFloat
return value of CGRectGetWidth
.
override func layoutSubviews() {
let roundedWidth = roundf(CGRectGetWidth(self.bounds))
...
}
The compiler won't let me, giving the error:
'NSNumber' is not a subtype of 'CFloat'
.
I guess there is some basic thing I am missing here. roundf
is taking a CFloat
as argument, so how can I convert my CGFloat
to CFloat
to make the conversion?
Update:
Now using round instead of roundf but I am still getting the same error. I've tried cleaning the project and restarting Xcode.