So i've got a nsdocument-based application that can have multiple documents open at a time.And I have a number of different views and data classes for managing everything.
It all works great until I try to create a shared instance that allows the other views to pull data and access the editordocument class
like
And in the main NSDocument class
It all works great until I try to create a shared instance that allows the other views to pull data and access the editordocument class
like
Code:
[[EditorDocument sharedInstance] editingState]
And in the main NSDocument class
Code:
EditorDocument *g_SharedInstance = nil;
+ (EditorDocument*) sharedInstance {
assert (g_SharedInstance != NULL);
if (g_SharedInstance == nil) {
g_SharedInstance = [EditorDocument alloc];
}
return g_SharedInstance;
}