CocoaSpice brings native Cocoa bindings to SPICE GTK and is used to build SPICE clients for macOS and iOS.
libglib-2.0
, libgstreamer-1.0
, libusb-1.0
(optional), libspice-client-glib-2.0
.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
CSMain.shared.spiceStop()
}
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: "127.0.0.1", 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
link |
Stars: 23 |
Last commit: 7 weeks ago |
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics