32

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..?

Gaurav Pandey
  • 1,953
  • 3
  • 23
  • 37

2 Answers2

125

Did you add import UIKit to your file?

ansible
  • 3,569
  • 2
  • 18
  • 29
0

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
yoAlex5
  • 29,217
  • 8
  • 193
  • 205