In this section there is the following block of code:
static BNRItemStore *sharedStore = nil;
// Do I need to create a sharedStore?
sharedStore = [[self alloc] initPrivate];
In the explanation it states that only the first time that this method is called will a new instance of the BNRItemStore be created. During the first call, it will set the sharedStore pointer to nil, and then the if statement will execute since the sharedStore pointer is nil, returning a new BNRItemStore pointer.
It states that any subsequent calls to this method will return the same BNRItemStore instance that was already created instead of initializing a new one. How is this possible since on the first line of the method the sharedStore pointer is set to nil? Every time this method is called it appears as if the sharedStore value is set to nil, and since it is nil the if statement will always execute, returning a brand new instance of the BNRItemStore object.
The only explanation I can think of is that since the variable is static, the first line that sets the pointer to nil is ignored on subsequent calls. Is this true?