Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CGRect.offsetBy Not Working

How do I rewrite the code below?

self.view.frame = CGRectOffset(self.view.frame, 0, movement)

'Offset' has been replaced by 'offsetby'

When I replaced it with the so called "solution":

self.view.frame = CGRect.offsetby(self.view.frame, 0, movement)

I receive an error:

"Instance member 'offsetBy' cannot be used on type 'CGRect'; did you mean to use a value of this type instead?"

like image 235
bigkurtdirt49 Avatar asked Dec 12 '17 04:12

bigkurtdirt49


1 Answers

You have to call offsetBy on an instance of a CGRect.

self.view.frame = self.view.frame.offsetBy(dx: 0, dy: movement)
like image 93
rmaddy Avatar answered Oct 21 '22 03:10

rmaddy