Coder Social home page Coder Social logo

xpckit's Introduction

XPCKit is a Cocoa library for wrapping the XPC C APIs in a handy object-oriented model. It is merely meant as an object-oriented wrapper for the C library, and does not attempt to layer any additional semantics on top.

XPCKit is still in development and should not be considered production-ready just yet. See the Wish List below.

Features

  • Simplified Objective-C API for interacting with XPC processes
  • Auto-boxing and auto-unboxing of objects from xpc_object_t objects to:
  • NSArray
  • NSDictionary
  • NSData
  • NSString
  • NSNumber for bool, UInt64, Int64, and double types
  • NSFileHandle
  • UUIDs (via a custom XPCUUID class)
  • Block-based callbacks
  • Probably safe to use from multiple threads

Wish List

  • Auto-boxing and auto-unboxing for
  • NSData, backed by shared memory
  • XPCConnection

Authors

Sample Code

Given this sample data, converted to an NSDictionary, you can see how:

  • the client sends this command as a message, and
  • the server receives this command, processes it, and sends the response back

Installation

You can use XPCKit in the client, server, or both; you just have to include the code. You can include XPCKit in one of three ways:

  1. Include the source files yourself (everything in XPCKit)
  2. Make a dependency of XPCKit's framework
  3. Make a dependency of XPCKit's static library (note: you will need to add linker flags -all_load and -ObjC to make this work properly)

Setting up the Client

  1. In your app, add the XPCKit source files, library or framework
  2. Set up an XPCConnection object with the name of your service
  3. Send it a message

Setting up the Server

  1. If you haven't already, create a new "XPC Service" target (located in Mac OS X > Framework & Library)
  2. Add the XPCKit source files, library or framework
  3. Link against the Foundation framework
  4. Rename "main.c" to "main.m"
  5. In your main function, call +[XPCService runServiceWithConnectionHandler:] to start listening for incoming connections.
  6. In the connection handler, set an event handler on the XPCConnection to receive messages.

License

Copyright 2011 XPCKit

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.