Skip to content
This repository has been archived by the owner on Jan 28, 2024. It is now read-only.

Commit

Permalink
Example projects
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmassicotte committed Sep 21, 2022
1 parent 1990820 commit 8481508
Show file tree
Hide file tree
Showing 13 changed files with 743 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Projects/ProcessService/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>XPCService</key>
<dict>
<key>ServiceType</key>
<string>Application</string>
</dict>
</dict>
</plist>
24 changes: 24 additions & 0 deletions Projects/ProcessService/main.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import Foundation

import ProcessServiceServer

final class ServiceDelegate: NSObject, NSXPCListenerDelegate {
func listener(_ listener: NSXPCListener, shouldAcceptNewConnection newConnection: NSXPCConnection) -> Bool {
do {
try newConnection.configureProcessServiceServer()
} catch {
return false
}

newConnection.activate()

return true
}
}

let delegate = ServiceDelegate()
let listener = NSXPCListener.service()

listener.delegate = delegate
listener.resume()

Loading

0 comments on commit 8481508

Please sign in to comment.