Archive for May 26, 2023

Friday, May 26, 2023

Disabling Quick Look In-Icon Previews

Craig Hockenberry:

This is ridiculous.

If you don’t have enough space to show paging arrows, you certainly don’t have enough space to view the content.


Where there’s a will, there’s a way. To disable movie, PDF, and other useless previews, but still maintain the image on the icon, use this from Terminal:

$ defaults write QLInlinePreviewMinimumSupportedSize -int 512

Then relaunch the Finder.

Stop Smooth Scrolling in Safari 16.4

Jeff Johnson:

Smooth scrolling means that when you press the arrow keys to scroll down or up on a web page, the scrolling is animated rather than immediate.


My blog post macOS Containers and defaults explained why Terminal needs Full Disk Access. Next, you need to quit Safari and enter the following command in Terminal:

defaults write IncludeInternalDebugMenu -bool true

Then launch Safari, open the Debug menu at the end of the main menu, select WebKit Internal Features, and uncheck “EventHandler driven smooth keyboard scrolling”.

I see smooth scrolling as an accessibility issue and wish I could turn it off in all apps.

I’d been meaning to post about this and was reminded about it after installing Ivory, which doesn’t follow the NSScrollAnimationEnabled system setting.

See also: Glenn Fleishman.

Wallaroo and SwiftUI on macOS

Craig Hockenberry:

We have a View in the app that uses SceneKit to display a 3D scene with a confetti flourish after a customer starts a subscription. I was expecting stuff like that to take a lot of effort to get working on the Mac. Instead, it ran 100% out of the box with no modifications at all.

And the stuff that I was expecting to be easy, like a settings view, buttons, and menu commands, turned out to be hard. To put that “hard” in context, it took me about a month to go from an app that we were proud of on iOS to one that we were equally proud of on macOS[…]


We also found that many of the issues encountered on macOS were things we had done wrong on iOS. Porting the app to the Mac made both platforms better. We’re also rethinking our View architecture so things that are currently Mac-only can be used to improve the iPad experience.


You’re going to have platform-specific code. More than you realize: certainly more than I expected!


It took me three days to hook up a Save menu item and have it work reliably.

I don’t understand why they had to use a custom button style and a hard-coded radius to get buttons that looked good on both platforms. I thought the point of SwiftUI was that you’re supposed ot just specify that you want a button and it does the right thing on each platform.

Craig Hockenberry:

SwiftUI’s default mechanism for handling URLs on macOS isn’t great. If you’ve used .onOpenURL on a View to handle external events, you’ll be disappointed to learn that a URL scheme on macOS opens a new window (Scene) before it hands the URL to the view modifier. And if you’re using a single Window instead of a WindowGroup, nothing happens at all.


One thing we wanted to do was use the Escape key to pop the NavigationStack. On the Mac, it’s a key that has always represented “go back” and many apps (like Photos) take advantage of that. Unfortunately, to accomplish that in Wallaroo, we had to use an invisible ToolbarItem with a .keyboardShortcut(.escape, modifiers: []).


While you’re struggling with window and sidebar size constraints, you end up with UserDefaults for frames that have “fun” keys like "NSWindow Frame SwiftUI.(unknown context at $1acd3d768).SceneBridgeReader, SwiftUI.ModifiedContent>, SwiftUI._PreferenceWritingModifierSwiftUI.PreferredColorSchemeKey>, SwiftUI._EnvironmentKeyWritingModifier>>>>-1-AppWindow-1".

Craig Hockenberry (Mastodon):

You won’t realize how much you depend on SwiftUI previews until you start working on macOS.

Sometimes they kinda work, but more often than not you’ll get an endless spinner. When they do work, they’re not interactive (you have to use the selectable mode with the arrow icon).


The similarity of the key names makes this a hard lesson to learn. I looked at “aps-environment” and “” for hours before I realized they were different. After you add the one for macOS manually, everything is golden.


We weren’t able to get FileRepresentation working in a Transferable. Other applications can’t access a temporary file that’s created for the export. This feels like a sandbox problem that we couldn’t work around.