Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode: Get rid of forward class warning

In Xcode, I have a forward class declared so as to avoid a circular import e.g.

@class MyClass;

And then I do a method call on that class e.g.

[MyClass myMethod];

But I get a forward class warning e.g.

warning: receiver 'MyClass' is a forward class and corresponding @interface may not exist

How can I hide those across my whole project?

like image 990
Matt Williamson Avatar asked Dec 16 '09 18:12

Matt Williamson


1 Answers

You use forward class declarations in your header file to prevent circular imports.

You must still import the MyClass header in your .m file. The circular import problem doesn't exist with .m files.

like image 120
Darren Avatar answered Oct 05 '22 23:10

Darren