Closed abrpatel closed 5 years ago
The three objects sent to the completion handler of [JotView exportImageTo:andThumbnailTo:andStateTo:withThumbnailScale:onComplete:]
are the same object that are written to disk in the private method [JotView exportImageTo:andThumbnailTo:andStateTo:andJotState:withThumbnailScale:onComplete:]
. You can delete the disk writing operations there, and then save those three objects (UIImage* ink
, UIImage* thumb
, JotViewImmutableState* state
) however you'd like to core data.
Then on load, create a subclass of JotViewStateProxy
and hydrate it from whatever you've loaded from core data. Passing that JotViewStateProxy subclass into [JotView loadState:]
should load in just fine.
You'll need to:
writeToFile:
instead of writing it, then save that result however you'd likeJotViewStateProxy
to load in whatever you just saved and send that to loadState:
Glad you're enjoying JotUI! and glad to hear it's been helpful!
Success!! Get a huge NSData file, but I'm able to save and reload from it. Would you like to create a PR for it?
Glad you got it working!
and Yes that'd be awesome for the PR! As long as it retains backwards compatibility and still adds support for optional NSData saving, that'd be awesome :)
actually not fully working. I'm running into the following issues when I try to reload the data: should be this:
but I'm getting this:
I'll create a PR of what I've got so far in a few minutes, so hopefully you can see the process on your end.
figured it out! Updating the PR in a few. Your initial advice was very helpful. The key was saving the NSData from the dictionary that was created in write to disk function. Unfortunately, I can't seem to make it backwards compatible, as you'll see.
Hi Adam,
I'm trying to save / reload the drawings with core data using NSData. I know that its relying on the documents directory now, but I can't quite figure out how to manage implementation of the NSData Persistence.
As its creator, any tips or advice would be appreciated.
I love what you've created so far. Amazing creativity and generosity.
Thank You!