0

I've built the custom NSOutlineView with NSTreeController, and I faced with the huge complexity of saving its state. Usage of Core Data is too tedious since I have implemented drag and drop support as well.

So my question is more general. What is the best way to save NSTreeController's state? Is it achievable with NSCoding?

Thanks in advance.

Defari
  • 71
  • 6
  • What do you mean by "custom NSOutlineView" and "state"? Do you want to use `autosaveExpandedItems`? What is the class of the tree controller? – Willeke Feb 19 '18 at 00:35
  • @Willeke, I meant the custom design for it and icons. – Defari Feb 19 '18 at 07:01
  • @Willeke, I have the next class : `class MainCatalogController: NSViewController, NSOutlineViewDelegate, NSOutlineViewDataSource {}`, and `@IBOutlet var treeController: NSTreeController!` inside it. I want to implement saving to multiple storage types as locally, using Core Data, and iCloud syncing. So I am looking for the best way how to save the tree's state. E.g. I did drag and drop, or created a new folder, and closed the app. And next time when I'll open the app there should be exactly the same folders structure. – Defari Feb 19 '18 at 07:09
  • @Willeke, I am trying to achieve the same catalog behavior as Apple Notes app. – Defari Feb 19 '18 at 07:16

0 Answers0