Objective-C static, extern, public variables

后端 未结 5 2187
悲哀的现实
悲哀的现实 2020-12-12 12:14

I want to have a variable that I can access anywhere by importing a header file but I also want it to be static in the sense that there is only one of them created. In my .

5条回答
  •  囚心锁ツ
    2020-12-12 12:37

    Declare it extern BOOL in your header file. Files that #import your header don't know or care if the external symbol is static or not.

提交回复
热议问题