I'm developing a Cocoa application, and I'm using constant NSString
s as ways to store key names for my preferences.
(我正在开发一个Cocoa应用程序,并且我使用常量NSString
作为存储我的首选项的键名的方法。)
I understand this is a good idea, because it allows easy changing of keys if necessary.
(我知道这是一个好主意,因为它可以在必要时轻松更改密钥。)
Plus, it's the whole 'separate your data from your logic' notion.(此外,它是整个'将您的数据与逻辑分离'的概念。)
Anyway, is there a good way to make these constants defined once for the whole application?
(无论如何,是否有一种很好的方法可以为整个应用程序定义一次这些常量?)
I'm sure that there's an easy and intelligent way, but right now my classes just redefine the ones they use.(我确信这是一种简单而聪明的方式,但是现在我的课程只是重新定义了他们使用的课程。)
ask by Allyn translate from so