Swiftpack.co - utmapp/CocoaSpice as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by utmapp.
utmapp/CocoaSpice v1.3.2
Cocoa bindings for SPICE client GTK
⭐️ 22
🕓 29 weeks ago
iOS macOS
.package(url: "https://github.com/utmapp/CocoaSpice.git", from: "v1.3.2")


CocoaSpice brings native Cocoa bindings to SPICE GTK and is used to build SPICE clients for macOS and iOS.


  • Renders displays and cursor into Metal textures
  • Support copy/paste through custom pasteboard binding
  • TCP socket connections and Unix socket file
  • Cursor and scroll-wheel channel
  • Take screenshot of current display
  • USB sharing and enumeration


  1. Add this repository to your project through Xcode: File -> Add Packages...
  2. Link your target with: libglib-2.0, libgstreamer-1.0, libusb-1.0 (optional), libspice-client-glib-2.0.
  3. Either add target CocoaSpiceNoUsb or CocoaSpice to your dependencies.


You must do this before using any other API. This starts a worker thread for SPICE GTK.

import CocoaSwift

guard CSMain.shared.spiceStart() else {
    // handle worker failed to start

defer {
    // use this to stop and clean up worker 

Open a connection

CSConnection is the main interface to CocoaSpice. You can create a connection from TCP (shown below) or with a Unix socket file.

import CocoaSwift

let connection = CSConnection(host: "", port: "4444")
connection.delegate = yourConnectionDelegate;
guard connection.connect() else {
    // handle connection failed to be created

CocoaSpice follows the delegate model so connection events are handled through delegate methods. Implement the CSConnectionDelegate to be informed to SPICE client events.


TODO: Implement testing


Stars: 22
Last commit: 1 week ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

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