Say I have an NSWindowController
subclass: MyWindowController
.
For this class, I have a singleton instance, sharedWindowController
Inside of my implementation of MyWindowController
, within my methods should I be referencing self
or [MyWindowController sharedWindowController]
?
In a normal subclass the answer would be self
; but I am looking at some legacy code in my codebase, and the previous author has been referencing [MyWindowController sharedWindowController]
. I'm assuming this is because in theory there will only ever be one instance of MyWindowController
, so by referencing sharedWindowController
, we are just being safe?
But is this unnecessary?