Best way to move from Singleton to NSDocument.

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

  1. skunkworker macrumors regular

    Joined:
    Sep 9, 2007
    #1
    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

    kainjow

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

    Joined:
    Sep 9, 2007
    #3
    Yup,
    Code:
    [[[self window] windowController] document]
    seemed to do the trick.
     

Share This Page