What is the difference between @class and #import

后端 未结 8 1695
再見小時候
再見小時候 2020-12-05 03:56

When I compile with the following code there are no errors:

@class RootViewController;
//#import \"RootViewController.h\"

When I compile wi

8条回答
  •  有刺的猬
    2020-12-05 04:00

    @class is a forward declaration, a good practice is to put them in the .h instead of #import for avoiding circular #import problem.

提交回复
热议问题