trilemma-dev / SecureXPC

A simple and secure XPC framework for Swift
MIT License
75 stars 15 forks source link

Optional completion handler `send` and `sendMessage` without reply #57

Closed jakaplan closed 2 years ago

jakaplan commented 2 years ago

Fixes #17

All send and sendMessage functions now take in a XPCResponseHandler (renamed from XPCReplyHandler). For those that require a reply, the response handler is non-optional. For those that can't have a reply, they can optionally provide a XPCResponseHandler<Void> which will get called upon successful completion or be provided an XPCError on failure.

In all cases, none of the functions now throw - all errors generated are provided to their handlers (or ignored if no handler is provided).

Three existing tests were modified and two new tests have been added.


This has been designed in a way which should make it relatively straightforward to address #19.

jakaplan commented 2 years ago

@amomchilov for your review. The significant changes are all in XPCClient, although a few other files were lightly touched as well.

amomchilov commented 2 years ago

Ah, it's a shame I didn't upstream my work earlier, because I already had all of this implemented. I've been really busy, I'll try to take a look at this tonight, but I'll really dive in this weekend.