Extendable icon indicating copy to clipboard operation
Extendable copied to clipboard

XPCSession support?

Open reesericci opened this issue 2 months ago • 6 comments

Hello -

I was wondering if it was possible for this library to use the Swift-native XPCSession instead of NSXPCConnection? I'm targeting macOS 26+ and trying to avoid as much legacy code as possible.

reesericci avatar Oct 17 '25 20:10 reesericci

Hello! I actually started working on exactly this. It turned out to be quite hard to do in a way that respects ExtensionKit's existing concurrency set up. But thanks for the reminder, I want to return to it.

I might be able to put something together that has a supportable API but only works for 26+ to start...

mattmassicotte avatar Oct 17 '25 20:10 mattmassicotte

Digging through the specs, ExtensionKit has no support for XPCSession even on 26. It would require a reimplementation of ExtensionKit.

Although there might be a way to abstract away the entirety of ExtensionKit into a new set of APIs where it works with XPCSession and converts back and forth between XPCSession and NSXPCConnection.

However, I did submit a PR with the basics to update the parts of library on ExtensionFoundation.

reesericci avatar Oct 18 '25 05:10 reesericci

I was looking into this API here. What problems did you run into?

https://developer.apple.com/documentation/extensionfoundation/connectionhandler/init(onsessionrequest:)

mattmassicotte avatar Oct 18 '25 09:10 mattmassicotte

I was looking into this API here. What problems did you run into?

The problem is not with any of the ExtensionFoundation side, it's all of ExtensionKit - the methods don't have XPCSession compatible versions.

reesericci avatar Oct 18 '25 14:10 reesericci

Ok, I think I've pinned it down to the fact that PrimitiveAppExtensionScene doesn't have support for XPCSession.

Image

reesericci avatar Oct 19 '25 16:10 reesericci

(sorry for the delay here)

Riiight, yes. A very strange and unfortunate omission...

mattmassicotte avatar Oct 28 '25 13:10 mattmassicotte