Daniel
Daniel

Reputation: 303

CGRect unrecognized in subclasses of NSObject

Recently I noticed that I cannot use CGRect in any classes I've made that are subclasses of NSObject. I get an error: "Unknown type name 'CGRect'; did you mean 'Rect'?" If I include <UIKit/UIKit.h>, I am able to use CGRect again. However, I noticed that in the classes of my older projects, I am still able to use CGRect without having to import <UIKit/UIKit.h>. I'm curious as to why this occurs.

Upvotes: 2

Views: 1146

Answers (1)

Lefteris
Lefteris

Reputation: 14667

Because older projects imported UiKit.h in the precompiled prefix header (pch) file.

Upvotes: 10

Related Questions