I want to make an instance variable that can\'t be accessed from outside. Is something like that possible in objective-c? I remember Apple has private variables and stuff li
You can not make a real private instance variable. Objective-C is a dynamic language and therefore it is possible to access any variable (even @private).
Use it in the implementation block of you .m file. Then it is not visible and block KVC, so that KVC will not work
@implementation ClassName {
// default to @protected
// but the subclasses can't see ivars created in the implementation block
float number;
}
+ (BOOL)accessInstanceVariablesDirectly {
return NO; // no KVC
}
@end