ForeverList Update: File loading and saving

As mentioned the other day, I’m working on a new app. I’m calling it ForeverList for now. I’ll be posting updates to this blog as I make progress.

Well, today I added file load and save!

It took about half an hour to add. It was pretty simple to implement. All I do is serialize the tree representing the document into a JSON dictionary.* Just use JSONSerialization to get this done. Easy.

However, I then spent another half hour tracking down a bug caused by a poorly configured storyboard. (I have no idea how it got in that state.) I’d hit an exception at runtime, but other than a call stack into Cocoa, I had no way of determining what was causing the problem.

After pulling my hair out, I decided to delete the old view controller in my storyboard and add a new one, configured exactly the same way. That fixed it. 😩

I’m still seeing another exception in -[SFLList removeItem:], but it looks like another Apple bug. Argh!

Oh yeah, at one point, Xcode crashed in the middle of typing some code. This is one thing I often forget about Mac and iOS development: a lot of time is wasted dealing with issues in Xcode orĀ Cocoa.

* I should note that the JSON format here is temporary. I’m planning on saving a journal of changes as I did with Lil Todo. That way I can allow multiple clients to modify the same document and sync them to a central file share, like Dropbox or OneDrive.