Gun13
Gun13

Reputation: 103

Access NSDocument from ViewController

I've a NSDocument and it saves and read some data. I'd like to use these data in my ViewController. How can I access it? I haven't found any information about doing this in swift, only in obj-c but when I translated it into swift it always fails.
More precisely:
I have a dictionary(my property of Document) which stores all data - I save from this dictionary and read to it. And I'd like to access this property(dictionary) from ViewController.

Upvotes: 2

Views: 577

Answers (1)

Gun13
Gun13

Reputation: 103

I found a solution:

(self.view.window?.windowController?.document as! Document).arch.objectForKey("saved")

And what is important - call it in viewWillAppear!

Upvotes: 2

Related Questions