I’ve started to build out the app and it’s already grown a bit. Here is part of the diagram of the app flow I created using Figma. Partly just to check out Figma.

So I’ve started stepping into Swift a little more. Working with NavigationStacks and Lists. I’ve got most of my initial views laid out and started building the preliminary models. I’m trying to get into the MVVM pattern, working with SwiftUI, etc.

$Binding

Can’t say I’m entirely a fan of how binding is implemented in Swift. Between @State, @StateObject, @ObservedObject, @Environment, @ObservableObject, @Identifiable, etc. there are a lot of nuances to what is bound in what manner. I had some issues adding items to a list from one View and having it show up when dropping back to a previous View. Mostly an issue of “where does this object belong”?

Pop Up Modals

This was a little annoying. There are a few different variations of modal views and getting it to dismiss from inside the modal isn’t obvious.

Need to actually VM my MVVM

I’m doing the thing again. Where I think about a thing by doing the thing. Or more accurately, I throw together some poorly thought out “temporary” code in order to explore another thing I actually want to do. And as we all know, “temporary” code often isn’t.

There’s a couple of places where I can see moving the work to a VM that then works with the View and Model to coordinate things better.

It’s Views all the way down

SwiftUI is kind of simple when you get down to it. Build a view. That’s the key take away. Most things take a view builder closure as a content parameter. And the things that don’t, actually do, but they have a default you can access by passing it something else, usually text. For instance, you could create a button where then button face was custom content or just pass text, and it will create a Text view for you. You don’t really have to worry about Making a UITableViewCell or UIScrollView or UIPickerView or the specific ways to define the contents of each. The SwiftUI equivalents take Views. Just make more Views. Make it its own little struct in its own little file and use it as a TableCell, Picker option, whatever. It’s a view, use it where you use views.

13,000 is a lot, right?

Not necessarily Swift related, but this is what I’m dealing with right now. I pulled down all of the current pieces from Lego’s Pick A Brick site and I want to be able select one. But there’s over 13,000 elements. This includes every color available of any given brick. I threw it all in a Picker and you can imagine how well that went. Not well at all.

My first task to clean this up is to aggregate all of the same shapes and have each element be a color variation of that element. Hopefully, I will reduce 13,000+ elements to about 2,000 – 4,000. Then I might see what that does to the Picker. If it’s fine, I might just leave it. Other than that, I’ll have to do some sort of look up instead of a picker.

By toast