mirror of
https://github.com/qvacua/vimr.git
synced 2024-12-27 15:53:31 +03:00
40 lines
920 B
Swift
40 lines
920 B
Swift
/**
|
|
* Tae Won Ha - http://taewon.de - @hataewon
|
|
* See LICENSE
|
|
*/
|
|
|
|
import Foundation
|
|
|
|
public class NeoVim {
|
|
|
|
private static let qXpcName = "com.qvacua.nvox.xpc"
|
|
|
|
private let xpcConnection: NSXPCConnection = NSXPCConnection(serviceName: NeoVim.qXpcName)
|
|
|
|
public let xpc: NeoVimXpc
|
|
public let view: NeoVimView
|
|
|
|
public init() {
|
|
self.xpcConnection.remoteObjectInterface = NSXPCInterface(withProtocol: NeoVimXpc.self)
|
|
|
|
self.xpc = self.xpcConnection.remoteObjectProxy as! NeoVimXpc
|
|
self.view = NeoVimView(xpc: self.xpc)
|
|
|
|
self.xpcConnection.exportedInterface = NSXPCInterface(withProtocol: NeoVimUiBridgeProtocol.self)
|
|
self.xpcConnection.exportedObject = self.view
|
|
|
|
self.xpcConnection.resume()
|
|
|
|
// bring the XPC service to life
|
|
self.xpc.probe()
|
|
}
|
|
|
|
deinit {
|
|
self.xpcConnection.invalidate()
|
|
}
|
|
|
|
public func vimInput(input: String) {
|
|
self.xpc.vimInput(input)
|
|
}
|
|
}
|