Cannot create Struct with CGRect based on super.view.frame

48 Views Asked by At

I'm trying to create a lookup of CGRect objects but I'm hitting a roadblock.

If I were to initialise a CGRect in viewDidLoad() it would look something like:

let myRect = CGRect(x: (view.frame.width / 2) - 50, y: (view.frame.height / 2) - 50, width: 100, height: 100)

but if that is within a Struct it flags:

'mainViewController.Type' does not have a member named 'view'

It would seem that I'm going about this the wrong way, so could someone shed some light on a better way to implement what I'm after?

Thanks very much.

0

There are 0 best solutions below