Skip to content

0.8.0

Latest
Compare
Choose a tag to compare
@jakaplan jakaplan released this 25 Jul 12:11
· 27 commits to main since this release

This is a big release! Continued thanks to @amomchilov for his contributions and code reviews.

New functionality

  • Adds built-in support for macOS Ventura's new SMAppService's daemons & agents.
    • For simple configurations, just call XPCServer.forMachService() and an auto-configured server will be returned.
  • Experimental support for shared memory has been added. Shared memory is truly shared between processes, no encoding or decoding occurs like with typical XPC communication.
    • A friendly to use, although quite basic, data structure SharedTrivial demonstrates this functionality.
    • The building block pieces available through SharedSemaphore, SharedMemory, and SharedRawMemory should enable you to build your own custom multi-process data structures.
    • This support is experimental and while it remains experimental breaking changes to it will not be considered for SerVer purposes.
  • XPCClient now provides the unforgeable identity of the server it is connected to via its serverIdentity async property (or the equivalent callback function).
  • XPCClient now automatically verifies the identity of the server in common cases and this can be customized with XPCClient.ServerRequirement.
  • XPCServer instances now always have an endpoint property (previously only those also conforming to XPCNonBlockingServer had this property).
  • Send IOSurface instances over XPC connections using the IOSurfaceForXPC property wrapper.
  • Data instances and arrays of trivial types can optionally be more efficiently sent across XPC connections by using the DataOptimizedForXPC and ArrayOptimizedForXPC property wrappers.

Breaking changes

  • XPCServer retrieval has been simplified. There are now just three main entry points:
    • XPCServer.forThisXPCService()
    • XPCServer.forMachService()
    • XPCServer.makeAnonymous()
  • XPCServer retrieval is now more customizable.
    • To customize a Mach service use XPCServer.MachServiceCriteria then call XPCServer.forMachService(withCriteria:)
    • To customize an anonymous server use XPCServer.makeAnonymous(withClientRequirement:)
  • XPCServer's client requirements no longer require using SecRequirement directly (although that's still supported).
    • Requirements are now created using XPCServer.ClientRequirement and declarative in nature: XPCServer.makeAnonymous(withClientRequirement: try .sameTeamIdentifier || try .teamIdentifier("Q55ZG849VX"))
  • XPCClient's factory methods have been tweaked to now optionally take a XPCClient.ServerRequirement instance.
  • XPCFileDescriptorContainer has been replaced by the FileHandleForXPC and FileDescriptorForXPC property wrappers.
  • XPCRequestContext has been renamed to XPCServer.ClientIdentity.
  • Several XPCError cases have been removed and a few have been added.
  • The underlying interprocess communication protocol between the client and server has changed (to support the client's ability to verify the server's identity). This means if you update SecureXPC, you need to do so for both your client and server implementations at the same time.