I create a single-view application, I enter several lines, Unknown type name 'CGFloat'
2 answers
The minimum file to import is
#import <CoreGraphics/CGBase.h>
#import <UIKit/UIKit.h>
also works, because UIKit
eventually also imports CoreGraphics
. But if your class is of type NSObject
and you don’t need UI elements in this class, then you don’t need to import the whole UIKit
just to declare a variable of type CGFloat
.
|
Given the modern syntax:
@import UIKit;
If the entire UIKit is not needed:
@import CoreGraphics;
|
#import <UIKit/UIKit.h>
? - VladD