Use of undeclared type 'UIImage' in Swift
Asked Answered
R

2

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

Raspings answered 30/7, 2014 at 8:18 Comment(0)
P
125

Did you add import UIKit to your file?

Phenice answered 30/7, 2014 at 8:27 Comment(1)
Ohh... it is just silly mistake as not importing "UIkit" Because we don't have to import it manually in Objective C.Raspings
B
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
Burletta answered 6/9, 2019 at 9:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.