Best way to move from Singleton to NSDocument.

Discussion in 'Mac Programming' started by skunkworker, Sep 17, 2009.

  1. skunkworker macrumors regular

    Sep 9, 2007
    Hello, I have a editor that I am working on, previously it was singleton shared instance based, but now that I am wanting to have multiple windows open at a time, I need to convert it over to NSDocument.
    The document has multiple views all in the same window, and those views need to some how get data from the document regarding certain variables. Whats the best way of doing this?
  2. kainjow Moderator emeritus


    Jun 15, 2000
    I would suggest reading the docs on NSDocument and NSDocumentController to get a feel for how they work.
  3. skunkworker thread starter macrumors regular

    Sep 9, 2007
    [[[self window] windowController] document]
    seemed to do the trick.

Share This Page