Archive for January 17, 2024

Wednesday, January 17, 2024

Swift Protocol Requirement Quirks

Jesse Squires:

A handful of protocol witness mismatches are currently allowed:

  • Non-failable initializers can satisfy failable initializer protocol requirements (as I encountered above)
  • Non-throwing functions can satisfy throwing function protocol requirements
  • Non-escaping closure parameters can satisfy @escaping protocol requirements
  • Generic functions can satisfy non-generic protocol requirements
  • Non-mutating functions can satisfy mutating protocol requirements
  • Enum cases can satisfy static function protocol requirements
  • Synchronous methods can satisfy async protocol requirements

ScreenFloat 2

Matthias Gansrigler (Mastodon):

ScreenFloat powers up your screenshots by allowing you to take screenshots and recordings that float above everything else, keeping certain information always in sight.

I’ve known about this app for a long time, but I’d never used it or thought much about it because the description doesn’t speak to me. I just don’t know why I’d ever want my screenshots to float. But, with the release of version 2, I took a closer look and found that it includes a variety of other features for working with screenshots that are actually quite useful.

John Voorhees (Mastodon):

Share includes some of the same options as the export tool, allowing screenshots to be copied, exported, printed, and shared with other apps. There’s also an option to detect data, including text, faces, and barcodes, which allows text to be copied or redacted and faces and barcodes to be blurred out, a fantastic use of macOS’s built-in data detection technology.

The Edit section provides tools for editing metadata and annotating images in a wide variety of ways by adding text, bulleted lists, shapes, arrows, lines, and more. All of these edits are non-destructive, meaning you can add them for reference purposes but still retrieve an unedited version of the screenshot later. This is an excellent addition for anyone who wants to mark up an image to highlight some aspect of it but preserve the ability to use a clean version in the future.

The Organize section has options for marking screenshots as favorites, rating them, moving them to folders, opening the Shots Browser, and accessing the app’s Settings. Of these options, the Shots Browser is easily my favorite because it extends ScreenFloat from a simple floating screenshot reference tool to a dedicated screenshot organization app.

The organization aspect is neat in that it automatically avoids the clutter of image files on your desktop. But I take most of my screenshots on test Macs, and so it doesn’t make sense to use it for long-term storage or organization there. I’ve been putting them in EagleFiler on my main Mac. The syncing would be great except that it uses iCloud, and my test macOS installations use a different Apple ID than my main Macs.

I can’t believe that the app only costs $7 and that this major upgrade—which is a complete rewrite in Swift and Core Data—is free. I’m not sure whether I’ll end up using it regularly, but there’s a lot other like here.

Update (2024-03-28): See also: Scott Willsey.

Game Mode in Sonoma

Andrew Cunningham:

Sonoma brings two more features that point to Apple’s newfound seriousness about gaming on the Mac. The first is Game Mode. It’s analogous to a Windows 11 feature of the exact same name, and they’re functionally similar in that they both promise to deprioritize background tasks to keep games running smoothly.

Apple’s version of Game Mode also promises to lower Bluetooth latency for connected input devices and wireless headphones.

I tested with a pair of non-AirPod Bluetooth earbuds and a DualShock 4 controller connected to an M2 MacBook Air, mostly playing games downloaded from Steam. Game Mode started reliably when games began and disappeared when they were closed.

I can’t say I noticed a difference in input latency, even in twitchier 2D games where I’m more sensitive to that kind of thing. But I definitely noticed an improvement in audio latency, where normally I’d need to switch to my earbuds’ low-latency Game Mode to get lag-free audio.

John Vorhees:

In typical Apple fashion, Game Mode isn’t something you turn on. It’s enabled as soon as you start a game.

Tim Hardwick:

When you enter full screen in this way, a Game mode menu appears in the menu bar. You can use this menu to confirm that Game mode is turned on for your game.

Howard Oakley:

Apple explains that this “optimizes your gaming experience by giving your game the highest priority access to your CPU and GPU, lowering usage for background tasks. And it doubles the Bluetooth sampling rate, which reduces input latency and audio latency for wireless accessories like game controllers and AirPods.”

[…]

gamepolicyd works with RunningBoard to designate gameconsole and some other services as “Game Mode Critical Services”.

Howard Oakley:

Perhaps the best overview of the effects of Game Mode on the CPU and GPU is this chart showing power consumption for the whole CPU and GPU during a run in Game Mode.

[…]

Assembling these, it’s apparent that during Game Mode, the game was given exclusive use of the two E cores, and threads from other processes fixed at low QoS, which would require them to be run on the E cores, were kept waiting. The game’s threads were run on a combination of E and P cores, with much of their load being concentrated on the E cores. This appears to be energy-efficient, and ideal for use on notebooks running on battery power.

Howard Oakley:

This article looks at another atypical situation, when running a macOS virtual machine (VM) assigned a set number of virtual cores. How does macOS Sonoma handle that?

Previously: