(Wee note: I started writing this as I finished off my lunch today, before I got the 'your app is live!' email)
Thought I'd post a wee quick update today for those interested in the 'how it's built' side of things - this might well be the most boring post ever made, so apologies in advance:
TL;DR: A 'simple' change can take a fair bit of thought...
Firstly, here's a wee view of the Trello board I'm using to track the project, and version backlogs. Essentially the 'to do' list is all the activities I might want to progress - some built from things I'd like, some from comments here and some from feedback via App Store Connect:
The 'version backlog' column is a wee sub-list of things from the backlog that I want to commit to do for the next release - you'll also see a 'version bump' ticket in there - that's to remind me that before releasing I have to update a configuration file to change from 1.0.0 to 1.1.0 (for example). If I fail to do this, the app stores will remind me anyway, as every build submitted needs a unique value, and they should increment.
Tickets move through 'in progress' to 'done' and then I clear down the done column when I do a build/release.
Updating the database model
Something that more than one of you asked for is a 'Reference Number' field, so I spent some time on my lunch break today working on that - it might seem trivial, but there's actually a fair amount of work involved in adding a new field (and if I get it wrong it can add issues that cause apps to crash and that's a
very bad thing! )
First, I quickly add it to my data model - essentially adding a couple of lines of code that say "a watch has a reference number" to give them a place in memory, which looks like this:
Next, I need to delete the TypeAdaptor file in my repository - this is an auto generated file that tells my app how to communicate with the database - whenever I change my model, I need to delete this and generate a new one (by writing a quick command into Terminal and waiting a minute or two).
I love doing things in the command line, as it makes me feel like Ferris Bueller
That gets the app set up to store this value in the database for each watch... but at this point, I've broken existing behaviour, as we now have a field that's not being populated by any of the other code and will cause things to break if left as they are!
Thankfully, the app is architected so that there's only a single point where watches (or rather 'watch objects') are created and added to the database - therefore, to prevent failures I just need to update this method to make sure that for every watch
something is added here - which is as easy as adding a new argument to the method (i.e. a note to 'expect this value') and passing that into the database when the method is called (i.e. someone presses the 'add watch' button.
With that done, we now have a new field and a way to populate it!.... but we've not updated the UI yet to let us add or display the reference number!
There are currently two screens where this might matter - the 'add watch' and 'view watch' screens. Add watch makes sense to do first, and its also the easier one - and nicely, this field is almost identical to the 'serial number' field, so let's just copy that and change a few names...
Next, I do something similar on the 'view watch' page, but this is a bit more complex - as all fields are 'locked' when first shown, so whilst I'm essentially doing the same thing (copying, pasting and modifying the code that generates the 'show serial number' field) I also need to make adjustments to some wee blocks of code that manage if you can currently edit the fields - it's all easy, but needs a bit of focus to make sure nothing is missed - here's a wee sample:
Essentially this is just saying "can we edit this field', if not make it editable when I click the icon - if it is editable, save the update when I click here!" (with a bit of extra code to only actually update it if it's actually changed!)
Finally, I'll run a wee build onto the iOS simulator or my phone and test it out before saving the changes to my code repo... and the end result:
...and at that point my lunch was pretty much over!
Just enough time to start writing this post before realising I really couldn't finish it, so kept it for later - well done if you made it this far without your eyes glazing over!