I am looking for the documentation for building a screensaver for macOS. I am not able to find it. Please help. Any tuturial or getting stated would be helpful.
Where can I see the documentation for building macOS screensaver
The droid you’re looking for is the ScreenSaver framework.
Some words of warning:
The current screen saver architecture relies on an old plug-in model, one that Apple is working to eliminate across our systems because it has fundamental limitations.
Specifically, it’s only recently become feasible to build a screen saver in Swift. See this thread for details (specifically, my 11 Oct 2017 and 15 Jan 2020 posts).
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"
Hi @eskimo !
If I may jump in, you mentionned this :
"The current screen saver architecture relies on an old plug-in model, one that Apple is working to eliminate across our systems because it has fundamental limitations."
I definitely agree about those issues and will most definitely welcome the new API, but in the meantime we're in a weird space right now with screen savers on Catalina. Apple started moving some (most) of it's own screensavers behind a new .appex format that, to this day, is still unavailable to 3rd parties with no guidance on when (to be honest, I started wondering if it's not an "if" instead of a "when") it will be available. I have to say your message gives me hope that there will be a new API released at some point !
In the meantime, the legacyScreenSaver.appex workaround has many bugs (I filled many radars) like always responding with the preview flag to true on init, or randomly resizing the main screen saver view to the size of the preview. After some time, I've managed to workaround those.
And while many features are now understandably gated by the entitlements inherited from legacyScreenSaver (for example, in Aerial, I had an option allowing users to skip a video by pressing the right arrow key, this is no longer possible) and cause an inconvenience, my biggest concern is that I'm no longer able to provide an auto update mechanism because of the sandboxing restrictions (I used Sparkle, neither the 1.x nor the 2.x branch work, being denied either because of a quarantine issue when copying the auto updater, or an elevation privilege when trying to use xpc in the 2.x branch).
Is there any chance we could get guidance on if we can expect the new api some day ?
Second question if I may, you mention this in the post you refered to :
"Old school plug-ins must use the system’s Swift runtime, meaning they must have a deployment target of macOS 10.14.4 or later."
I currently still do it the old fashion way, as I still support older OSes with Aerial. There are two side effects I know of with Swift screensavers linked this way :
- if you have two of them, you won't be able to switch from one to the other (as they will likely not use the same library) and get this error : "You cannot use the Aerial screen saver with this version of macOS."
- if you try updating a swift screensaver without closing System Preferences first, the new version will get "partially loaded" (my limited understanding, either the code or the nib isn't reloaded, causing a crash).
I would guess using system's Swift fix the first issue, do you happen to know if it would fix the second in a screensaver ?
I want to thank you in general for your posts in this forum that, more than once, provided some great feedback that helped me figure some things out. And while I definitely understand that you may not able to provide any guidance here, any word would be greatly appreciated!
Is there any chance we could get guidance on if we can expect the new api some day?
Not from me. Frankly, I don’t know what Apple’s plans are in this space but, even if I did, I wouldn’t be pre-announcing them here. Apple has official channels for announcing changes like this (typically WWDC but, on occasion, in the release notes that accommodate beta OS seeds).
I would guess using system's Swift fix the first issue, do you happen to know if it would fix the second in a screensaver ?
I do not, but it seems like something that’d be easy for you to test.
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"
Understood on the first point. Some form of communications about the changes that happened with no announcement nor documentation would have been appreciated, though. To this day the changes are still not documented anywhere (and new subtle bugs get reported to me often by users, and I'm not sure what to do about them, except filling radars with no feedback).
I definitely understand screen savers are low priority but it's still a tiny bit frustrating 😉
I'll give it a shot on the second issue when I have a second.
Thanks for your time.