Floating around - Pet project series - 2/x

Yesterday I got my second shot of a vaccine. Couple weeks more and I will be a functional part of society once again! Looking forward to it.

Talking about society and aging: I bought my first printer / scanner! Dunno why, not sure if I need it. But I was laying in bed at 3 am and like: "Shit! I need to order a printer!" Yeah, a lot of things in my life are decided at mid-night.

Wait... what? You are asking: what about a project? Which project? The project? Oh... yeah... about that.



You know...

When the neighbor above you decides to transform their apartments into a pool, it’s hard to focus on side projects.

IDs needs to go

While writing tests for recipes and the engine, it became clear to me that we are polluting code with meaningless . In almost the whole project we don't really care about Ingredient structure, all we need is just id. So I decided to rename Ingredient to IngredientMetadata and extract to just Ingredient.

Feels a way better, see for yourself:

struct Recipe: CustomDebugStringConvertible {
    var product: Ingredient.ID
    var ingredients: [Ingredient.ID: Int]
    init(_ amount: Int, _ what: Ingredient.ID, ingredients: [Ingredient.ID: Int]) { ... }

struct Recipe: CustomDebugStringConvertible {
    var product: Ingredient
    var ingredients: [Ingredient: Int]
    init(_ amount: Int, _ what: Ingredient, ingredients: [Ingredient: Int]) { ... }

let recipe = Recipe(1,, ingredients: [ 1])

let recipe = Recipe(1, woodenPlank, ingredients: [woodenLog: 1])

Want something done right, do it yourself

I feel that the logic part of the project is in good shape. That means it is time for UI thingies! Yay!

To start super simple, let's just use a bunch of UITableView (or UICollectionView? It's got buffed a lot recently) for now: list of ingredients, list of recipes, list of projects, recipe detail and project detail.

Now I need to decide how I would like to approach the layout:

  • Autolayout is a way to go for the last 8 years
  • Manual, frame based layout is an old-school approach that I haven't tried properly

Not sure about you, but for me it's simple: manual.

If you want to know how it all started, I got you: Starting Pet project series 0/x | ManWithBear

See ya!

Tagged with: