Mac OS: Swift UI

Another round for a short stint. 40 mins today. I took my daily walk, came back and worked in Xcode.

This time around: if statements.

I have done boolean comparisons thousands of times. What coder hasn’t? Yet, I could probably count on my hands the times I have worked in UI. All my other coding sessions, when I was sick, targeted the command line. My involvement was trying to figure out my @State bugs. And a bit of tuples.

I set up a framework project. Had a standard hello world label. A button at the bottom. It switched between three states. When tapped or clicked, the button’s text changes. Or at least that was the idea. Learned more about @State to figure out the problem. Yet the button did not update.

In a separate swift file I had a function called “switch_to_unknown()” that changes the string the button depends on for its state. The string was supposed to have variations of calling the user unknown. Until their name is brought back in a complete circular cycle. A little random function that suppose to give me feedback on my coding.

Turns out that I named the variable wrong. Spent 30 mins playing around with if statements. Then around thirty more minutes to find the bug. The button was depending on the initialized name and not the current_name variable. So of course no @State was being used. Worth the hunt though.

Fixed the bug and sort of pumped my fist. 

Got to live big. Small moments deserve most of the spotlight. There are too many of these opportunities to feel happy, and not feel regret later down the line. It is what drives the next moment. The little guy is the driver. And they are what you think of when the coding session are done in these small skips of joy. I think that is when you know you enjoy something. When the small moments are the biggest reason to come back, and it is what you dream of at night.

If statements - check.

What is next? I don’t know. Whatever train is connecting in the next station. I just like traveling down the tracks. Leaving records that mean something to me. 

It’s my history. I am going forward, steady and here. And maybe there. Yep. There too. The train will drive upon the dark tunnels. The whistles screams and pierces my senses. It does indeed sting at times. Maybe I will hurt and can't see. Be shocked by unexpected events. Despite the struggles, I will pursue this. Worth the small joys in every clunk. Each wood plank rattling. Metal clanging, screeching and the pistons moving. Smoke or steam? Electric or coal? There is adventure here. Claim the bounty.

Loot. Don't forget that.

Comments

Popular posts from this blog

Where It All Goes

Details to the Journey

Code - What Do You See (Part 1)