0

I have written different parsers and different NSDocument subclasses for files with different extensions to visualize the data. I would like to intergrate them together into one application. I am using NSDocument architecture. I am not sure how to map files identified by file extensions to its NSdocument object.

I have tried to add document types in the Xcode info session with class and extensions. However, it seems that it always execute the same parser regardless of the file's extension. enter image description here

Emma
  • 57
  • 1
  • 6

1 Answers1

0

1)Subclass NSDocumentController

a)in your XIB with mainmenu put a new object and give it a class of your new NSDocumentController subclass

or

b)create a new instance before appDidFinishLaunching (initialize, load...)

2)override methods as you see on picture (those which determine type and return document instances) to provide new document instances (as per type)

Document

Read more here

Also scan with your eyes NSDocumentController.h (CMD+SHIFT+O and type NSDoc...)

Marek H
  • 5,173
  • 3
  • 31
  • 42