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

后端 未结 4 1382
我在风中等你
我在风中等你 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:53

    It's recommended that you import other header files in your header file. That way you can use the class in both the header and the implementation files (because the implementation file (.m) imports its associated header file).

    If you want to know when to import files and when to use forward-class declaration, you can go here. ;-)

提交回复
热议问题