Search code examples
objective-ccompiler-errorscgrect

Unknown Type Name CGRect in function(not method) declaration


I am trying to declare a function in an NSObject type class to be called for some core graphics drawing. How do you properly declare a function in objective c?
I'm not doing anything complicated, something like...

in .h

void drawShape(CGRect rect);

however this throws an unknown type name 'CGRect' error. And I dont know why being that its in the applicationservices.h


Solution

  • CGRect is part of the CoreGraphics framework; therefore, you must ensure to include it in your app.