Software Dev

Test your SwiftUI views at rocket speeds 🚀 with ViewInspector 🕵️‍♂️

For years, at least in the iOS world, the idea of automatically testing your UI views was considered out of pocket. After all, the UIKit views lived in non-code files such as a storyboard or a – good lord! – a XIB.

Then came Apple’s XCUI framework, which allows for automatic UI test but takes, more or less, forever to run. I’ve seen XCUI test plans run for 3 hours, 6 hours, even 24 hours. It kind of works for a nightly test on a dedicated server, but not in realtime as you code.

But with SwiftUI, you get concise, clean, cross-platform view-layer code and can now test SwiftUI view as, well, code! This mean you can unit test your views 🤯, thanks in particular to the open source ViewInspector framework.

👉 ViewInspector on GitHib

ViewInspector lets you traverse your view hierarchy at runtime, asserting values as you go in traditional unit-test style.

According to the Inspection Guide, ViewInspector supports dynamic testing of @Binding, @ObservedObject, @State, @Environment and @EnvironmentObject. You can even interact with the interface, such as tapping a button and checking the result.

And it all runs in blazing fast unit test speed 🚀 so your tests don’t have to run all night.

If you still want to do some actual visual testing, consider snapshot testing or mix in some limited XCUI tests for the right balance.

Now you can go write something cool and iterate fast. Thank you, nalexn, for this great tool. 🙏

Quotes · The World

“Ruins, for me, are the beginning. With the debris, you can construct new ideas.”

The artist Anselm Kiefer is new to me but has been around for a long time. I like this quote of his.

Ruins, for me, are the beginning. With the debris, you can construct new ideas.

Anselm Kiefer

This quote is fitting since he was born in Germany at the end of World War 2. This guy is literally the personification of rebirth from ruins.

His art looks amazing. I’ll have to check it out in person next time I’m in New York.

Everyone Stands Under His Own Dome of Heaven
Songs

“I’m on Fire” (first attempt) 🎤

Since I posted about jumping in and trying to sing, I thought I’d post my first attempt. I got inspired to see what I actually sound like now that I’ve had… let’s see… one voice lesson. 😆

I thought Bruce Springsteen’s I’m on Fire would be a good first song since it’s short and simple. And most especially, the vocals (I now know!) are exactly in my natural range, aside from the really high “wooohoo hooo” stuff, which I pushed through and tried anyways.

I wanted to give this song my own sonic touch, with a more modern sound. I think Springsteen was basically trying to do a Johnny Cash song here, so this is me trying to sound like Bruce trying to sound like Johnny. 😆

Here’s Springsteen’s original for comparison.

creativity · Me · Music

“What you don’t know, you can feel it somehow.” 🎤

I always liked the song Beautiful Day for its optimism and presence.

It’s a beautiful day. Don’t let it get away.

Sure, that’s the obvious takeaway and a great reminder that every day counts.

But the last part of the song has been inspiring me even more as I dig into a scary new skill, which I hope is the right kind of difficult for me: playing, singing, and eventually writing my own songs. 😱

I do not have a good track record here so far.

I have spent most of my life as the kind of guy who could play Stairway to Heaven on guitar and be done with it. “I’m a guitarist.” 🤷🏻‍♂️ Then I recorded a cover with a friend and built up some confidence.

What I really want is to do find my own voice. Literally.

Despite never considering myself a singer (and consistently receiving negative feedback whenever I have tried 😆) I am jumping into singing with the help of an expert music teacher who always sees the best possibilities.

And that’s half the journey.

Touch me, take me to that other place
Reach me, I know I’m not a hopeless case

Which brings me to the best part of Beautiful Day: the last bit, the part about forgetting what you don’t have now and feeling your way, somehow, into the new.

What you don’t have, you don’t need it now
What you don’t know, you can feel it somehow

Stay tuned. 🎤

What a beautiful day.