Objective-C: Importing headers in .h or .m?

后端 未结 4 1391
我在风中等你
我在风中等你 2021-02-02 09:15

I\'m new to objective-c and would like to know the best practice for importing some external headers that I use in my class.

Should I be storing the #import \"classB.h\"

4条回答
  •  死守一世寂寞
    2021-02-02 09:56

    To avoid circular references, only #import a header file in another class's header file if it's inheriting from that class. Otherwise, use @class ClassName to declare the class type if you need it in your header file, and #import it in the implementation file.

提交回复
热议问题