Weekly Project Update 3: Ripping The Guts Out
I was a bit more productive this week than I was last week. It seems like the balance of two forces acting on my productivity — the anxiety of the current lockdown, and the boredom that comes from running out of things to do at work (I will be changing jobs soon) — have shifted slightly towards the get-stuff-done side. This can only be a good thing, and I hope it will continue into the coming week.
Of course, a rather impact on the progress of an app is the amount of rework that comes from figuring out a better way to do something. That’s the trouble with building something with technologies that you’re learning at the same time. Getting something to a state that it just sorta’ kinda’ work, then realising that due to some limitation (cough sandbox cough), your entire approach is faulty and large chunks of the application will need to be redesigned to accomodate it. Sometimes I wish for nothing less then ripping the guts out completely, and starting over from scratch.
Anyway, here is this week’s update.
Day One Sync
Ok, Core Data is out. I’m sure it’s a great framework but there are too many new things that I need to learn at the same time, and using it will just slow me down. So instead I’ve opted to using SQLite.swift, which provides a nice Swift interface to a Sqlite database. Porting the persistence logic to this new library has made it so much simpler; gone are the DTOs, and the need to keep multiple classes in sync. I’m still unsure as to whether I should use separate Sqlite files for the feed configuration, and to track which feed items were added to Day One. I think for the moment I’ll keep it in a single database file. It will be much simpler and I can rely on the niceties provided by Sqlite like cascading deletes.
The mechanism of fetching items from an RSS feed and adding it to a Day One journal is coming along as well. I have got it to the point where new items from the two test feeds I’m using are being added to the Day One, complete with formatting and attached images. It’s still early days now: the logic needs a great deal of cleanup. Also, my assumptions that I could just import the HTML directly from the feed items proved wrong: doing that resulted in weird journal entries which seemed to destabilise Day One. It looks like Day One prefers entries added as Markdown, so the current work here is to write a HTML to Markdown translator. I’ve made a start to this, but I imagine that this will be a bit of a fiddly job that will require a fair bit of testing.
As for adding the entries using the
dayone2 app, I hit a bit of a brick wall in how I could do this with a sandboxed app. I’m hesitant to bundle the
dayone2 app within my app. It’s not my code and I have no idea if the app would be different for each install of Day One. I tried allowing the user to select the
dayone2 app from a file picker, but that didn’t seem to work. It may work if I granted full file system access to Day One Sync, but I’m not sure how to easily test this from Xcode builds.
So at the moment, Day One Sync is running without a sandbox. This is not ideal, and maybe near the end, when I start creating standalone archives I can test a sandboxed app with full disk access. It seems to me that requesting permission to run apps within
/usr/local/bin, which as far as I know are binaries that should be available to anyone, should be supported as part of the sandbox. As it stands at the moment, it seems quite limited as to what a sandboxed app can do (I guess that’s by design but I know I’m not the only one that thinks this).
Also needing a lot of work is the UI. I realised that I made a mistake when I made the main window out of a ViewController with a splitter view. I realised now that I should have used a SplitViewController. This will give me the master-detail splits in the title bar that seem to be a hallmark of Big Sur apps. So I guess more work will need to go into redoing all that. It’s not much of a problem though: the UI needs a lot of work anyway so it’s good catching this sooner rather than later.
That’s all for this week. Until next week.