Question

On using this function in swift and i am getting compiler error. Function is:

class func imageWithImage (imageToResize : UIImage, scaledToSize newSize : CGSize) {
    return imageToResize;
}

and the error are:

  1. Use of undeclared type 'UIImage'
  2. Use of undeclared type 'CGSize'

What's wrong with this..? what can i do to use UIImage in Swift..?

Was it helpful?

Solution

Did you add import UIKit to your file?

OTHER TIPS

I have run on this issue when duplicated a framework target on swift. As a result and .h (that is umbrella[About] and is located in Build Phases -> Headers) were different(because it just copied from upstream target). The umbrella file contains #import <UIKit/UIKit.h>

  • Create <new_framework_target_name>.h and add #import <UIKit/UIKit.h>
    or
  • Rename Product Name (Build Settings) as upstream_framework_target_name.h
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top