Binary operator * cannot be applied to operands of type Int and CGFloat Binary operator * cannot be applied to operands of type Int and CGFloat ios ios

Binary operator * cannot be applied to operands of type Int and CGFloat


Instead of i * self.view.frame.size.width, use CGFloat(i) * self.view.frame.size.width


You need to type cast i into CGFloat, write your line of code as

var frame: CGRect = CGRectMake(CGFloat(i) * self.view.fram.size.width, self.tutorialHolderView.frame.origin.y, 0, self.tutorialHolderView.frame.size.height)


matomo