Use of undeclared type 'UIImage' in Swift
-
21-12-2019 - |
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:
- Use of undeclared type 'UIImage'
- Use of undeclared type 'CGSize'
What's wrong with this..? what can i do to use UIImage in Swift..?
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
) asupstream_framework_target_name
.h
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow