1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-12-01 01:32:04 +03:00
vimr/SwiftNeoVim/NeoVim.swift

40 lines
920 B
Swift
Raw Normal View History

/**
* 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()
2016-06-07 19:48:59 +03:00
// bring the XPC service to life
self.xpc.probe()
}
deinit {
self.xpcConnection.invalidate()
}
public func vimInput(input: String) {
self.xpc.vimInput(input)
}
}