Since my last post I’ve mostly gone back to working on The Stack.
It’s reached that fiddly phase where the basic MVP functionality is probably in, but there are lots of little features and tweaks that are vying for inclusion.
Meanwhile the UI is a bit clunky and definitely needs some work, but how much is enough for now? Perfect is the enemy of good and all that…
Luckily I’ve been getting some great feedback from some of my testers, and so that is generating a nice series of small tweaks to aim at.
I spent quite a bit of time towards the end of last week cleaning up labels. There’s more to do, but they’re a lot cleaner than they were.
Toolbars
I’ve also been doing a lot of wrestling with toolbars and toolbar buttons in SwiftUI.
I guess perhaps I just haven’t internalised the knowledge yet, but I find it rather difficult to predict exacly which sequence of ToolbarItem, Menu, Button, Picker and so on I require in order to achieve my desired effect. I’m trying to follow the guidelines, and the common practice (especially that set by Apple’s own apps, which don’t always follow the guidelines 🤔), but it’s not always obvious what to do.
This is complicated by the fact that I’m supported macOS and iOS. I probably do want a different layout and slightly different behaviour for iOS and macOS, but I haven’t entirely worked out where the differences lie. I may build a standalone macOS target eventually, but for now I am using Catalyst. In some ways I think this is a further complication, because there are things that you can do in a macOS target in SwiftUI that you can’t do in a Catalyst target, and the limitations often feel quite arbitrary.
Given the way macOS and the iPad are converging, doing everything in the same target seems to be the right way, which pushes me towards Catalyst. I’m not sure though, and I’m often sad (frustrated?!) when I discover that there’s something I want to do that is macOS-target-only in SwiftUI.
WOT NO ACTION ABSTRACTION?
For the macOS app, I definitely also want to support a menubar. With iOS 26 coming, I probably also want to support one on iPad.
Sidenote: Is it going to be easier or harder if I use Catalyst? I currently have no idea, so am going for Catalyst – the solution which requires supporting one target rather that two in Xcode.
I find it a little surprising that menus seem to require a different approach to toolbars - using Commands, CommandGroup and so on, rather than Toolbar, ToolbarItem etc.
Whilst they aren’t identical, menubars and toolbars both seem to be doing roughly the same job of hosting a set of “actions” that can be applied, either globally or to the current selection.
In both cases these actions can get enabled and disabled, can change their name or behaviour based on context, or can be substituted for other actions. They both require a title, and probably also an icon. They can both be grouped, and sometimes the items in the group are mutually exclusive. They should probably both be able to have a keyboard shortcut assigned. They probably should both support undo.
I wonder if I’m missing something, but I’m surprised that SwiftUI doesn’t appear to support an nice abstraction that can be used for both.
Lead Us Not Into Temptation…
I like a good abstraction. Probably more than is strictly healthy.
I am wary of diving in to make my own action abstraction, but I do think that I will probably need to.
As well as the ability to make a menu item or a toolbar item from an action, I would like to eventually support undo.
I also want to support some form of opt-in anonymous analytics that I can use to work out what people are doing with the app. I don’t want to spy on people unnecessarily, but if I know which features people use, and which ones they miss, then I’ll have a better idea of where to focus my efforts.
Finally, I’m thinking of a payment model based on micro payments, and I like the idea of basing this not just on a crude measure of “did the user open the app today?”, but on something much finer-grained which understands how much someone is using the app.
All of this means that I think I probably should invest the time in some sort of simple abstraction, which allows me to package up operations and attach them to menus, toolbars, standalone buttons, or other events, and have them execute wherever they are invoked.
First though, I’m going to go back and watch a few WWDC videos… just to check that I haven’t missed something that’s already there!
PS
Don’t forget that there’s a Test Flight link available for the Stack. Give it a go!