Reputation: 4728
I have a working document based project with both iOS and macOS targets. The document is a bundle and I have each target able to open files from the other. I was looking at some online tutorials on UIDocument (and particularly this one from Ray Wenderlich ) and they are keeping a variable for the (NS)FileWrapper in the document class. I currently have my model create a FileWrapper lazily each time one is needed. I am also discarding the fileWrapper when i unpack a model object in read(from fileWrapper: FileWrapper, ofType typeName: String)
on NSDocument or load(fromContents contents: Any, ofType typeName: String?)
on UIDocument. Is there any good reason for keeping the FileWrapper while the document is open, or is the approach I've adopted just as functional? thanks.
Upvotes: 0
Views: 286
Reputation: 176
Keeping a reference to the FileWrapper is recommended in Session 218 of WWDC2012 See: https://developer.apple.com/videos/play/wwdc2012/218/
Upvotes: 0