Forward-declare enum in Objective-C

前端 未结 6 2398
陌清茗
陌清茗 2020-11-30 02:06

I\'m having trouble with enum visibility in an Objective-C program. I have two header files, and one defines a typedef enum. Another file needs to use the

6条回答
  •  生来不讨喜
    2020-11-30 02:36

    Go ahead and use #import. The only reason people recommend to use @class when possible is because it makes your code slightly faster to compile. However, there is no issue with #importing one .h file from another. In fact, you need to do this when extending another class.

提交回复
热议问题