nmnir nmnir - 3 months ago 22
Swift Question

Value of type uiview has no member size

I have error:
Value of type uiview has no member size. Here is my code:

if let nv = (AppDelegate.getAppDelegate().window?.rootViewController as? UINavigationController) {

let pushedViewControllers = nv.viewControllers
let presentedViewController:UIViewController = pushedViewControllers[pushedViewControllers.count - 1]
UIGraphicsBeginImageContext(presentedViewController.view.size()) //HERE IS THE ERROR


Checked the h file, UIViewController has public var view: UIView!
Thanks!

Answer

The problem is with size(), not view. It should be view.bounds.size

Value of type uiview has no member size

This is saying that UIView instances have no size method or property. Which is true.