Enable SwiftUI Button Click-Through for Inactive Windows on macOS

On macOS, there’s 1 active window that receives your key input. Then there’s all the other windows, which are potentially invisible or obstructed by other windows. These inactive windows can be brought to the front and made active with a click. Then you can interact with these windows like normal. With inactive but visible winsows, you cannot select items from lists, for example. The UI reflects this with a greyed-out or dimmed representation. You need to click once to activate the window (on the surface of the window, so to speak), then another time to interact with the control.

Continue reading …

SwiftUI Field Guide

Chris Eidhof and team launched the SwiftUI Field Guide website today.

I noticed that Chris fiddled with JavaScript animations and layout representations to mimick SwiftUI as close as possible and wondered what kind of e-book could be upcoming, but it turns out it’s a website!

Change the alignment or the alignment guide offset interactively and check out the result. There is so much detail!

As a resource to learn, the approximations are more than good enough. They are excellent and by virtue of being interactive, they are also much better to get a feeling for everything than the SwiftUI documentation’s images can ever be. There’s only so much an API documentation can teach you before you need to observe how it really behaves.

Since it’s in a browser, the preview is of course even faster than Xcode Previews would be, and without the crashes. (Oh, the crashes …)

I wish the SwiftUI Field Guide had been available a year ago when I had to figure out so many things through trial and error!

Some sections apparently aren’t finished yet (they’re greyed-out), but you can learn a lot about the reverse-engineered layout system’s inner workings.

Not Quite 100% SwiftUI – Time Makes Perfect

Marin’s Swift Heroes 2023 talk was just uploaded yesterday. It’s called “A 100% SwiftUI App”, and I believe you should watch it, because it’s not actually about what it says on the tin!

Marin Todorov: “A 100% SwiftUI App”, Swift Heroes 2023 talk

Marin’s a charismatic presenter and excellent storyteller. (He also later admits it’s his 65th tech talk, wow!)

There are a couple of gems:

One is the use of the (ficticious) AppKit property leftShiftPressed­InCombination­WithTouchBar­WhereAvailable­RepresentsMouseEvent = 6 to illustrate that over the past 35 years, AppKit has become quite weird, actually.

Another is Marin’s summary of the whole situation right afterward:

Time makes perfect;
but also adds a hundred properties to every class.
– Marin Todorov, 2023

So I’ll spoil one more detail: “A 100% SwiftUI App” is not actually a hard sell to do all of your apps with 100% SwiftUI. Quite the opposite.

I won’t spoil why, though.

SwiftUI Requires Platform Knowledge On Top. Case Study: Fonts

SwiftUI very likely is the future of app development. But it cannot, on its own replace UIKit or AppKit. Not yet, maybe not next year, either. Eventually you will have to drop down a level to implement a custom view, custom navigation, animation, window, or what have you. So for the time being, the two worlds of UIKit and SwiftUI co-exist and complement each other.

Continue reading …

Uberabout Makes Your App's About Window More Sexy

Teaser image

Martin Lexow created a sexier alternative to the default AppKit “About” window called Uberabout

You know, these things:

Default About window that comes with any AppKit/macOS app

The info available to be displayed there is:

  • app icon
  • app name
  • version number
  • build number

Now Martin came up with a drop-in replacement for the same info but with less ugliness:

Uberabout window that your app could have, too

Check out the GIF in the project’s readme to see its 3D transition effects in action!

Sadly it’s only for macOS 11.0+, so for projects pre-Big Sur, you have bad luck. But it’s written with SwiftUI, so you may still learn one thing or another, or adapt the code to your project if you want!