so i need a NSDocument with a backend instance that all views can access and the objects in the backend can access. At the moment i've got a shared instance, but this limits the document to only one. the code is simply like this:
static id sharedInstance = nil;
+(void)initialize {
if (self == [ApricumBackend class]) {
sharedInstance = [[self alloc] init];
}
}
+ (id)mainBackend {
return sharedInstance;
}
But this doesn't work the way i want it to. So how can i achieve that one NSDocument has one variable every view can access and how can i get every object in the backend to be able access the backend? I've made a little graph:
Important is also that the objects in the backend object need to have access to the backend object while they "init"
Thanks