1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-11-28 02:54:31 +03:00
vimr/SwiftNeoVim/NeoVim.swift
2016-07-05 20:03:14 +02:00

36 lines
846 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()
}
}