SwipeView
SwipeView copied to clipboard
'CGFloat' is not convertible to 'Float'
I got this error message in PileView.swift.
func transformForPosition(position : CGFloat) -> CGAffineTransform {
var transform : CGAffineTransform = CGAffineTransformIdentity
if (self.swipeViews.count > 0) { //Keep transform at identity if first view
let count = self.swipeViews.count
let scale = powf(transformRatio, position) // error message here
transform = CGAffineTransformMakeScale(scale, scale)
transform = CGAffineTransformTranslate(transform, 0, -15 * position)
}
return transform
}
I imported your code into a test project and didn't get any errors. But the error that you're getting is caused by you trying to pass a CGFloat
where a float
is needed. Try using the Float()
initializer to fix this error.
How to do that?
I already told you what to try. Just wrap the error in Float().