Using a constant NSString as the key for NSUserDefaults

前端 未结 4 1060
借酒劲吻你
借酒劲吻你 2021-01-29 18:27

I\'m using NSUSerDefaults to store user preferences. I remember reading somewhere that setting the keys as constants is a good idea - and I agree. The following code is what I c

4条回答
  •  一整个雨季
    2021-01-29 18:59

    I would suggest even making the constant more descriptive. A constant for the number of sides of a polygon could come from anywhere. As a suggestion, how about:

    kDefaultsPolygonNumberOfSides;
    

    instead.

提交回复
热议问题