Use of undeclared type 'UIImage' in Swift

Gaurav Pandey picture Gaurav Pandey · Jul 30, 2014 · Viewed 20.2k times · Source

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

Answer

ansible picture ansible · Jul 30, 2014

Did you add import UIKit to your file?