Here's my model class LevelInformationModel.
@interface LevelInformationModel : NSObject
@property NSInteger levelCompleted;
+(id)sharedModel;
@end
#import "LevelInformationModel.h"
@implementation LevelInformationModel
@synthesize levelCompleted;
/* Return singleton model */
+ (id)sharedModel {
static LevelInformationModel *sharedModel = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedModel = [[self alloc] init];
});
return sharedModel;
}
- (id)init {
self = [super init];
if (self) {
self.levelCompleted = 0;
}
return self;
}
@end
And here's how I'm using it all (in GameViewController class). I have imported LevelInformationModel.h already.
NSInteger currentLevel = [LevelInformationModel sharedModel].levelCompleted;
But above the levelCompleted property is the error Property 'levelCompleted not found on type 'id'`. Any thoughts would be great.