次のように、getter/setter メソッドを使用して、クラスの @interface セクション内で宣言された Objective-C NSMutableDictionary があります。
@interface myClass : NSObject
{
NSMutableDictionary *dict;
}
- (void) setDict: (NSMutableDictionary *) newDict;
- (NSMutableDictionary *) dict;
私の @implementation メソッドのいくつかの中で、dictを変更したいと思います。標準の Obj-C イディオムに固執し、それを「適切に」変更したいと思います。セッターではなくゲッターを使用して、次のように変更しても問題ありませんか。
[[self dict] removeObjectForKey:@"myKey"];
...またはこれを行うより良い方法はありますか?