Swiftpack.co -  Package - Alkenso/sXPC
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
Use power of Swift to make NSXPCConnection type-bound
.package(url: "https://github.com/Alkenso/sXPC.git", from: "0.1.0")

sXPC - Swift-typed wrapper around NSXPCConneciton.

sXPC allows you to

  • make NSXPCConnection to produce typed remoteObject / set typed exportedObject
  • pass Swift-only structs/enums over XPC connection (with very little additional code)
  • have NSXPCIntegrace description in the single place
  • hide objective-c details, using pure Swift in the App

XPC service example

Note: full sample code resides in Sample folder

Assume protocol you are going to use over XPC connection

public struct Request: Equatable, Codable {
    public var processUID: uid_t
    public var processPID: pid_t
    public var processPath: URL

public struct Response: Equatable, Codable {
    public var allow: Bool
    public var cache: Bool

public protocol Service {
    func perform(_ request: Request, reply: @escaping (Response) -> Void)

Create connection & call

let connection = CreateServiceXPCConnection(connection: NSXPCConnection(serviceName: "com.example.XPCService"))

let proxy = connection.remoteObjectProxy { error in

let request = Request(...)
proxy.perform(request) { response in print(response) }

Setup listener

let listener = CreateServiceXPCListener(listener: listener)
listener.newConnectionHandler = {
    $0.exportedObject = DummyService()
    return true


Stars: 0
Last commit: 1 week ago

Release Notes

sXPC released!
1 week ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco