What is a better practice when defining a const NSString object in objective-c?

前端 未结 4 983
故里飘歌
故里飘歌 2021-02-09 21:21

When i read colleagues\' code in my team, i usually found there were two different types of definition for const NSString objects:

static NSString const *

4条回答
  •  一个人的身影
    2021-02-09 22:07

    // Demo.h

    FOUNDATION_EXPORT NSString *const MyFirstConstant;
    FOUNDATION_EXPORT NSString *const MySecondConstant;
    

    // Demo.m

    NSString *const MyFirstConstant = @"FirstConstant";
    NSString *const MySecondConstant = @"SecondConstant";
    

提交回复
热议问题