mirror of
https://github.com/qvacua/vimr.git
synced 2024-12-26 07:13:24 +03:00
Merge branch 'develop' into update-neovim
Conflicts: RxPack/Sources/RxPack/RxNeovimApi.generated.swift
This commit is contained in:
commit
356712b837
@ -51,18 +51,6 @@ class UrlCommonsTest: XCTestCase {
|
||||
expect(URL(fileURLWithPath: "/").parent).to(equal(URL(fileURLWithPath: "/")))
|
||||
}
|
||||
|
||||
func testIsDir() {
|
||||
let resourceUrl = Bundle.module.url(
|
||||
forResource: "UrlCommonsTest",
|
||||
withExtension: "",
|
||||
subdirectory: "Resources"
|
||||
)!
|
||||
let hidden = resourceUrl.appendingPathComponent(".dot-hidden-file")
|
||||
|
||||
expect(resourceUrl.isDir).to(beTrue())
|
||||
expect(hidden.isDir).to(beFalse())
|
||||
}
|
||||
|
||||
func testIsHidden() {
|
||||
let resourceUrl = Bundle.module.url(
|
||||
forResource: "UrlCommonsTest",
|
||||
|
@ -1,9 +0,0 @@
|
||||
import XCTest
|
||||
|
||||
#if !canImport(ObjectiveC)
|
||||
public func allTests() -> [XCTestCaseEntry] {
|
||||
[
|
||||
testCase(CommonsTests.allTests),
|
||||
]
|
||||
}
|
||||
#endif
|
@ -1,7 +0,0 @@
|
||||
import XCTest
|
||||
|
||||
import CommonsTests
|
||||
|
||||
var tests = [XCTestCaseEntry]()
|
||||
tests += CommonsTests.allTests()
|
||||
XCTMain(tests)
|
@ -7,7 +7,7 @@ public class Ignore {
|
||||
public static let defaultIgnoreFileNames = [".ignore", ".gitignore"]
|
||||
public static let vcsFolderPattern = [".svn/", ".hg/", ".git/"]
|
||||
|
||||
public static func globalGitignoreCollection(base: URL) -> Ignore? {
|
||||
public static func globalGitignore(base: URL) -> Ignore? {
|
||||
let gitRoot = GitUtils.gitRootUrl(base: base)
|
||||
let urls = [
|
||||
GitUtils.gitDirInfoExcludeUrl(base: base, gitRoot: gitRoot),
|
||||
@ -25,7 +25,21 @@ public class Ignore {
|
||||
return Ignore(base: base, parent: nil, ignoreFileUrls: urls, prepend: vcsFolderFilters)
|
||||
}
|
||||
|
||||
public let ignores: [Filter]
|
||||
public static func parentOrIgnore(
|
||||
for base: URL,
|
||||
withParent parent: Ignore?,
|
||||
ignoreFileNames: [String] = defaultIgnoreFileNames
|
||||
) -> Ignore? {
|
||||
let urls = ignoreFileNames
|
||||
.map { base.appendingPathComponent($0) }
|
||||
.filter { fm.fileExists(atPath: $0.path) }
|
||||
.reversed()
|
||||
|
||||
if urls.isEmpty { return parent }
|
||||
return Ignore(base: base, parent: parent, ignoreFileUrls: Array(urls))
|
||||
}
|
||||
|
||||
public let filters: [Filter]
|
||||
|
||||
/// `ignoreFileUrls[n]` overrides `ignoreFileUrls[n + 1]`.
|
||||
/// `Ignore`s of `parent` are overridden, if applicable, by the `Ignore`s found in `base`.
|
||||
@ -39,7 +53,7 @@ public class Ignore {
|
||||
if ignoreFileUrls.isEmpty { return nil }
|
||||
let urls = ignoreFileUrls.filter { fm.fileExists(atPath: $0.path) }.reversed()
|
||||
|
||||
self.ignores = (parent?.ignores ?? [])
|
||||
self.filters = (parent?.filters ?? [])
|
||||
+ prepend.reversed()
|
||||
+ urls.flatMap {
|
||||
FileLineReader(url: $0, encoding: .utf8)
|
||||
@ -49,19 +63,19 @@ public class Ignore {
|
||||
}
|
||||
+ append.reversed()
|
||||
|
||||
if self.ignores.isEmpty { return nil }
|
||||
if self.filters.isEmpty { return nil }
|
||||
|
||||
if let lastAllowIndex = self.ignores
|
||||
if let lastAllowIndex = self.filters
|
||||
.enumerated()
|
||||
.filter({ _, ignore in ignore.isAllow })
|
||||
.map(\.offset)
|
||||
.max()
|
||||
{
|
||||
self.mixedIgnores = self.ignores[0...lastAllowIndex]
|
||||
self.remainingDisallowIgnores = self.ignores[(lastAllowIndex + 1)...]
|
||||
self.mixedIgnores = self.filters[0...lastAllowIndex]
|
||||
self.remainingDisallowIgnores = self.filters[(lastAllowIndex + 1)...]
|
||||
} else {
|
||||
self.mixedIgnores = ArraySlice()
|
||||
self.remainingDisallowIgnores = self.ignores[0...]
|
||||
self.remainingDisallowIgnores = self.filters[0...]
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,11 +9,11 @@ let package = Package(
|
||||
.library(name: "NvimView", targets: ["NvimView"]),
|
||||
],
|
||||
dependencies: [
|
||||
.package(url: "https://github.com/qvacua/RxPack.swift", from: "0.1.0"),
|
||||
.package(url: "https://github.com/a2/MessagePack.swift", from: "4.0.0"),
|
||||
.package(url: "https://github.com/ReactiveX/RxSwift", from: "6.5.0"),
|
||||
.package(url: "https://github.com/Quick/Nimble", from: "10.0.0"),
|
||||
.package(name: "NvimServer", path: "../NvimServer"),
|
||||
.package(name: "RxPack", path: "../RxPack"),
|
||||
.package(name: "Commons", path: "../Commons"),
|
||||
.package(name: "Tabs", path: "../Tabs"),
|
||||
],
|
||||
@ -21,9 +21,10 @@ let package = Package(
|
||||
.target(
|
||||
name: "NvimView",
|
||||
dependencies: [
|
||||
"RxSwift",
|
||||
"RxPack",
|
||||
.product(name: "RxSwift", package: "RxSwift"),
|
||||
.product(name: "RxPack", package: "RxPack.swift"),
|
||||
"Tabs",
|
||||
.product(name: "RxNeovim", package: "NvimServer"),
|
||||
.product(name: "NvimServerTypes", package: "NvimServer"),
|
||||
.product(name: "MessagePack", package: "MessagePack.swift"),
|
||||
"Commons",
|
||||
|
@ -1,98 +0,0 @@
|
||||
/**
|
||||
* Tae Won Ha - http://taewon.de - @hataewon
|
||||
* See LICENSE
|
||||
*/
|
||||
|
||||
import Foundation
|
||||
import RxPack
|
||||
import RxSwift
|
||||
|
||||
public extension RxNeovimApi {
|
||||
func getDirtyStatus(
|
||||
errWhenBlocked: Bool = true
|
||||
) -> Single<Bool> {
|
||||
let params: [RxNeovimApi.Value] = []
|
||||
|
||||
func transform(_ value: Value) throws -> Bool {
|
||||
guard let result = value.boolValue else {
|
||||
throw RxNeovimApi.Error.conversion(type: Bool.self)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
if errWhenBlocked {
|
||||
return self
|
||||
.checkBlocked(
|
||||
self.rpc(method: "nvim_get_dirty_status", params: params, expectsReturnValue: true)
|
||||
)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
return self
|
||||
.rpc(method: "nvim_get_dirty_status", params: params, expectsReturnValue: true)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
func bufGetInfo(
|
||||
buffer: RxNeovimApi.Buffer,
|
||||
errWhenBlocked: Bool = true
|
||||
) -> Single<[String: RxNeovimApi.Value]> {
|
||||
let params: [RxNeovimApi.Value] = [.int(Int64(buffer.handle))]
|
||||
|
||||
func transform(_ value: Value) throws -> [String: RxNeovimApi.Value] {
|
||||
guard let result = msgPackDictToSwift(value.dictionaryValue) else {
|
||||
throw RxNeovimApi.Error.conversion(type: [String: RxNeovimApi.Value].self)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
if errWhenBlocked {
|
||||
return self
|
||||
.checkBlocked(self.rpc(method: "nvim_buf_get_info", params: params))
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
return self
|
||||
.rpc(method: "nvim_buf_get_info", params: params)
|
||||
.map(transform)
|
||||
}
|
||||
}
|
||||
|
||||
private func msgPackDictToSwift(
|
||||
_ dict: [RxNeovimApi.Value: RxNeovimApi.Value]?
|
||||
) -> [String: RxNeovimApi.Value]? {
|
||||
dict?.flatMapToDict { k, v in
|
||||
guard let strKey = k.stringValue else { return nil }
|
||||
|
||||
return (strKey, v)
|
||||
}
|
||||
}
|
||||
|
||||
private func msgPackArrayDictToSwift(
|
||||
_ array: [RxNeovimApi.Value]?
|
||||
) -> [[String: RxNeovimApi.Value]]? {
|
||||
array?
|
||||
.compactMap { v in v.dictionaryValue }
|
||||
.compactMap { d in msgPackDictToSwift(d) }
|
||||
}
|
||||
|
||||
private extension Dictionary {
|
||||
func flatMapToDict<K, V>(
|
||||
_ transform: ((key: Key, value: Value)) throws -> (K, V)?
|
||||
) rethrows -> [K: V] {
|
||||
let array = try self.compactMap(transform)
|
||||
return self.tuplesToDict(array)
|
||||
}
|
||||
|
||||
func tuplesToDict<K: Hashable, V, S: Sequence>(
|
||||
_ sequence: S
|
||||
) -> [K: V] where S.Iterator.Element == (K, V) {
|
||||
var result = [K: V](minimumCapacity: sequence.underestimatedCount)
|
||||
|
||||
for (key, value) in sequence { result[key] = value }
|
||||
|
||||
return result
|
||||
}
|
||||
}
|
@ -8,6 +8,7 @@ import MessagePack
|
||||
import PureLayout
|
||||
import RxPack
|
||||
import RxSwift
|
||||
import RxNeovim
|
||||
import SpriteKit
|
||||
|
||||
public extension NvimView {
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
import Foundation
|
||||
import RxPack
|
||||
import RxNeovim
|
||||
|
||||
public extension NvimView {
|
||||
struct Buffer: Equatable {
|
||||
|
@ -7,6 +7,7 @@
|
||||
import Cocoa
|
||||
import RxPack
|
||||
import RxSwift
|
||||
import RxNeovim
|
||||
|
||||
extension NvimView: NSTouchBarDelegate, NSScrubberDataSource, NSScrubberDelegate {
|
||||
override public func makeTouchBar() -> NSTouchBar? {
|
||||
|
@ -7,6 +7,7 @@ import Cocoa
|
||||
import MessagePack
|
||||
import PureLayout
|
||||
import RxPack
|
||||
import RxNeovim
|
||||
import Tabs
|
||||
|
||||
public extension NvimView {
|
||||
|
@ -11,6 +11,7 @@ import NvimServerTypes
|
||||
import os
|
||||
import RxPack
|
||||
import RxSwift
|
||||
import RxNeovim
|
||||
|
||||
extension NvimView {
|
||||
final func initVimError() {
|
||||
|
@ -9,6 +9,7 @@ import Commons
|
||||
import MessagePack
|
||||
import os
|
||||
import RxPack
|
||||
import RxNeovim
|
||||
import RxSwift
|
||||
import Tabs
|
||||
import SpriteKit
|
||||
|
@ -22,7 +22,7 @@ class Document: NSDocument, NSWindowDelegate {
|
||||
|
||||
self.nvimView
|
||||
.events
|
||||
.observeOn(MainScheduler.instance)
|
||||
.observe(on: MainScheduler.instance)
|
||||
.subscribe(onNext: { event in
|
||||
switch event {
|
||||
case .neoVimStopped: self.close()
|
||||
|
@ -478,11 +478,9 @@
|
||||
4B022600224AAE270052362B /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/../Carthage/Build/Mac";
|
||||
INFOPLIST_FILE = MinimalNvimViewDemo/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
@ -499,11 +497,9 @@
|
||||
4B022601224AAE270052362B /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/../Carthage/Build/Mac";
|
||||
INFOPLIST_FILE = MinimalNvimViewDemo/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
@ -689,7 +685,6 @@
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/../Carthage/Build/Mac";
|
||||
INFOPLIST_FILE = DrawerDev/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
@ -707,7 +702,6 @@
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/../Carthage/Build/Mac";
|
||||
INFOPLIST_FILE = DrawerDev/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
|
@ -1,7 +0,0 @@
|
||||
import XCTest
|
||||
|
||||
import NvimViewTests
|
||||
|
||||
var tests = [XCTestCaseEntry]()
|
||||
tests += NvimViewTests.allTests()
|
||||
XCTMain(tests)
|
@ -1,9 +0,0 @@
|
||||
import XCTest
|
||||
|
||||
#if !canImport(ObjectiveC)
|
||||
public func allTests() -> [XCTestCaseEntry] {
|
||||
[
|
||||
testCase(NvimViewTests.allTests),
|
||||
]
|
||||
}
|
||||
#endif
|
5
RxPack/.gitignore
vendored
5
RxPack/.gitignore
vendored
@ -1,5 +0,0 @@
|
||||
.DS_Store
|
||||
/.build
|
||||
/Packages
|
||||
/*.xcodeproj
|
||||
xcuserdata/
|
@ -1,77 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1340"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "RxPack"
|
||||
BuildableName = "RxPack"
|
||||
BlueprintName = "RxPack"
|
||||
ReferencedContainer = "container:">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "RxPackTests"
|
||||
BuildableName = "RxPackTests"
|
||||
BlueprintName = "RxPackTests"
|
||||
ReferencedContainer = "container:">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "RxPack"
|
||||
BuildableName = "RxPack"
|
||||
BlueprintName = "RxPack"
|
||||
ReferencedContainer = "container:">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
@ -1,25 +0,0 @@
|
||||
// swift-tools-version:5.6
|
||||
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "RxPack",
|
||||
platforms: [.macOS(.v10_13)],
|
||||
products: [
|
||||
.library(name: "RxPack", targets: ["RxPack"]),
|
||||
],
|
||||
dependencies: [
|
||||
.package(url: "https://github.com/ReactiveX/RxSwift", .upToNextMinor(from: "6.5.0")),
|
||||
.package(url: "https://github.com/a2/MessagePack.swift", from: "4.0.0"),
|
||||
.package(url: "https://github.com/IBM-Swift/BlueSocket", from: "2.0.2"),
|
||||
.package(url: "https://github.com/Quick/Nimble", from: "10.0.0"),
|
||||
],
|
||||
targets: [
|
||||
.target(name: "RxPack", dependencies: [
|
||||
"RxSwift",
|
||||
.product(name: "MessagePack", package: "MessagePack.swift"),
|
||||
.product(name: "Socket", package: "BlueSocket"),
|
||||
]),
|
||||
.testTarget(name: "RxPackTests", dependencies: ["RxPack", "Nimble"]),
|
||||
]
|
||||
)
|
@ -1,3 +0,0 @@
|
||||
# RxPack
|
||||
|
||||
A description of this package.
|
@ -1,269 +0,0 @@
|
||||
/**
|
||||
* Tae Won Ha - http://taewon.de - @hataewon
|
||||
* See LICENSE
|
||||
*/
|
||||
|
||||
import Foundation
|
||||
import RxSwift
|
||||
|
||||
public final class RxMessagePortClient {
|
||||
public enum ResponseCode {
|
||||
// Unfortunately, case success = kCFMessagePortSuccess is not possible.
|
||||
case success
|
||||
case sendTimeout
|
||||
case receiveTimeout
|
||||
case isInvalid
|
||||
case transportError
|
||||
case becameInvalidError
|
||||
case unknown
|
||||
|
||||
fileprivate init(rawResponseCode code: Int32) {
|
||||
switch code {
|
||||
case kCFMessagePortSuccess: self = .success
|
||||
case kCFMessagePortSendTimeout: self = .sendTimeout
|
||||
case kCFMessagePortReceiveTimeout: self = .receiveTimeout
|
||||
case kCFMessagePortIsInvalid: self = .isInvalid
|
||||
case kCFMessagePortTransportError: self = .transportError
|
||||
case kCFMessagePortBecameInvalidError: self = .becameInvalidError
|
||||
default: self = .unknown
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum Error: Swift.Error {
|
||||
case serverInit
|
||||
case clientInit
|
||||
case portInvalid
|
||||
case send(msgid: Int32, response: ResponseCode)
|
||||
}
|
||||
|
||||
public static let defaultTimeout = CFTimeInterval(5)
|
||||
|
||||
public let uuid = UUID()
|
||||
public var timeout = RxMessagePortClient.defaultTimeout
|
||||
|
||||
public init(queueQos: DispatchQoS) {
|
||||
self.queue = DispatchQueue(
|
||||
label: "\(String(reflecting: RxMessagePortClient.self))-\(self.uuid.uuidString)",
|
||||
qos: queueQos,
|
||||
target: .global(qos: queueQos.qosClass)
|
||||
)
|
||||
}
|
||||
|
||||
public func send(msgid: Int32, data: Data?, expectsReply: Bool) -> Single<Data?> {
|
||||
Single.create { single in
|
||||
self.queue.async {
|
||||
guard CFMessagePortIsValid(self.port) else {
|
||||
single(.failure(Error.portInvalid))
|
||||
return
|
||||
}
|
||||
|
||||
let returnDataPtr = UnsafeMutablePointer<Unmanaged<CFData>?>.allocate(capacity: 1)
|
||||
defer { returnDataPtr.deallocate() }
|
||||
|
||||
let responseCode = CFMessagePortSendRequest(
|
||||
self.port,
|
||||
msgid,
|
||||
data?.cfdata,
|
||||
self.timeout,
|
||||
self.timeout,
|
||||
expectsReply ? CFRunLoopMode.defaultMode.rawValue : nil,
|
||||
expectsReply ? returnDataPtr : nil
|
||||
)
|
||||
|
||||
guard responseCode == kCFMessagePortSuccess else {
|
||||
single(.failure(
|
||||
Error.send(msgid: msgid, response: ResponseCode(rawResponseCode: responseCode))
|
||||
))
|
||||
return
|
||||
}
|
||||
|
||||
guard expectsReply else {
|
||||
single(.success(nil))
|
||||
return
|
||||
}
|
||||
|
||||
// Upon return, [returnData] contains a CFData object
|
||||
// containing the reply data. Ownership follows the The Create Rule.
|
||||
// From: https://developer.apple.com/documentation/corefoundation/1543076-cfmessageportsendrequest
|
||||
// This means that we have to release the returned CFData.
|
||||
// Thus, we have to use Unmanaged.takeRetainedValue()
|
||||
// See also https://www.mikeash.com/pyblog/friday-qa-2017-08-11-swiftunmanaged.html
|
||||
let data: Data? = returnDataPtr.pointee?.takeRetainedValue().data
|
||||
single(.success(data))
|
||||
}
|
||||
|
||||
return Disposables.create()
|
||||
}
|
||||
}
|
||||
|
||||
public func connect(to name: String) -> Completable {
|
||||
Completable.create { completable in
|
||||
self.queue.async {
|
||||
self.port = CFMessagePortCreateRemote(kCFAllocatorDefault, name.cfstr)
|
||||
|
||||
if self.port == nil {
|
||||
completable(.error(Error.clientInit))
|
||||
return
|
||||
}
|
||||
|
||||
completable(.completed)
|
||||
}
|
||||
|
||||
return Disposables.create()
|
||||
}
|
||||
}
|
||||
|
||||
public func stop() -> Completable {
|
||||
Completable.create { completable in
|
||||
self.queue.async {
|
||||
if self.port != nil && CFMessagePortIsValid(self.port) {
|
||||
CFMessagePortInvalidate(self.port)
|
||||
}
|
||||
completable(.completed)
|
||||
}
|
||||
|
||||
return Disposables.create()
|
||||
}
|
||||
}
|
||||
|
||||
private var port: CFMessagePort?
|
||||
|
||||
private let queue: DispatchQueue
|
||||
}
|
||||
|
||||
public final class RxMessagePortServer {
|
||||
public typealias SyncReplyBody = (Int32, Data?) -> Data?
|
||||
|
||||
public struct Message {
|
||||
public var msgid: Int32
|
||||
public var data: Data?
|
||||
}
|
||||
|
||||
public let uuid = UUID()
|
||||
|
||||
public var syncReplyBody: SyncReplyBody? {
|
||||
get { self.messageHandler.syncReplyBody }
|
||||
set { self.messageHandler.syncReplyBody = newValue }
|
||||
}
|
||||
|
||||
public var stream: Observable<Message> { self.streamSubject.asObservable() }
|
||||
|
||||
public init(queueQos: DispatchQoS) {
|
||||
self.queue = DispatchQueue(
|
||||
label: "\(String(reflecting: RxMessagePortClient.self))-\(self.uuid.uuidString)",
|
||||
qos: queueQos,
|
||||
target: .global(qos: queueQos.qosClass)
|
||||
)
|
||||
self.messageHandler = MessageHandler(subject: self.streamSubject)
|
||||
}
|
||||
|
||||
public func run(as name: String) -> Completable {
|
||||
Completable.create { completable in
|
||||
self.queue.async {
|
||||
var localCtx = CFMessagePortContext(
|
||||
version: 0,
|
||||
info: Unmanaged.passUnretained(self.messageHandler).toOpaque(),
|
||||
retain: nil,
|
||||
release: nil,
|
||||
copyDescription: nil
|
||||
)
|
||||
|
||||
self.port = CFMessagePortCreateLocal(
|
||||
kCFAllocatorDefault,
|
||||
name.cfstr,
|
||||
{ _, msgid, data, info in
|
||||
guard let infoPtr = UnsafeRawPointer(info) else { return nil }
|
||||
|
||||
let handler = Unmanaged<MessageHandler>.fromOpaque(infoPtr).takeUnretainedValue()
|
||||
return handler.handleMessage(msgId: msgid, cfdata: data)
|
||||
},
|
||||
&localCtx,
|
||||
nil
|
||||
)
|
||||
|
||||
if self.port == nil {
|
||||
self.streamSubject.onError(RxMessagePortClient.Error.serverInit)
|
||||
completable(.error(RxMessagePortClient.Error.serverInit))
|
||||
}
|
||||
|
||||
self.portThread = Thread { self.runServer() }
|
||||
self.portThread?.name
|
||||
= "\(String(reflecting: RxMessagePortServer.self))-\(self.uuid.uuidString)"
|
||||
self.portThread?.start()
|
||||
|
||||
completable(.completed)
|
||||
}
|
||||
|
||||
return Disposables.create()
|
||||
}
|
||||
}
|
||||
|
||||
public func stop() -> Completable {
|
||||
Completable.create { completable in
|
||||
self.queue.async {
|
||||
self.messageHandler.syncReplyBody = nil
|
||||
self.streamSubject.onCompleted()
|
||||
|
||||
if let portRunLoop = self.portRunLoop { CFRunLoopStop(portRunLoop) }
|
||||
|
||||
if self.port != nil && CFMessagePortIsValid(self.port) {
|
||||
CFMessagePortInvalidate(self.port)
|
||||
}
|
||||
|
||||
completable(.completed)
|
||||
}
|
||||
|
||||
return Disposables.create()
|
||||
}
|
||||
}
|
||||
|
||||
private var port: CFMessagePort?
|
||||
private var portThread: Thread?
|
||||
private var portRunLoop: CFRunLoop?
|
||||
|
||||
private let queue: DispatchQueue
|
||||
|
||||
private var messageHandler: MessageHandler
|
||||
private let streamSubject = PublishSubject<Message>()
|
||||
|
||||
private func runServer() {
|
||||
self.portRunLoop = CFRunLoopGetCurrent()
|
||||
let runLoopSrc = CFMessagePortCreateRunLoopSource(kCFAllocatorDefault, self.port, 0)
|
||||
CFRunLoopAddSource(self.portRunLoop, runLoopSrc, .defaultMode)
|
||||
CFRunLoopRun()
|
||||
}
|
||||
}
|
||||
|
||||
private class MessageHandler {
|
||||
fileprivate var syncReplyBody: RxMessagePortServer.SyncReplyBody?
|
||||
|
||||
fileprivate init(subject: PublishSubject<RxMessagePortServer.Message>) { self.subject = subject }
|
||||
|
||||
fileprivate func handleMessage(msgId: Int32, cfdata: CFData?) -> Unmanaged<CFData>? {
|
||||
let d = cfdata?.data
|
||||
|
||||
self.subject.onNext(RxMessagePortServer.Message(msgid: msgId, data: d))
|
||||
|
||||
guard let reply = self.syncReplyBody?(msgId, d) else { return nil }
|
||||
|
||||
// The system releases the returned CFData object.
|
||||
// From https://developer.apple.com/documentation/corefoundation/cfmessageportcallback
|
||||
// See also https://www.mikeash.com/pyblog/friday-qa-2017-08-11-swiftunmanaged.html
|
||||
return Unmanaged.passRetained(reply.cfdata)
|
||||
}
|
||||
|
||||
private let subject: PublishSubject<RxMessagePortServer.Message>
|
||||
}
|
||||
|
||||
private extension Data {
|
||||
var cfdata: CFData { self as NSData }
|
||||
}
|
||||
|
||||
private extension CFData {
|
||||
var data: Data { self as NSData as Data }
|
||||
}
|
||||
|
||||
private extension String {
|
||||
var cfstr: CFString { self as NSString }
|
||||
}
|
@ -1,297 +0,0 @@
|
||||
/**
|
||||
* Tae Won Ha - http://taewon.de - @hataewon
|
||||
* See LICENSE
|
||||
*/
|
||||
|
||||
import Foundation
|
||||
import MessagePack
|
||||
import RxSwift
|
||||
import Socket
|
||||
|
||||
public final class RxMsgpackRpc {
|
||||
public typealias Value = MessagePackValue
|
||||
|
||||
enum MessageType: UInt64 {
|
||||
case request = 0
|
||||
case response = 1
|
||||
case notification = 2
|
||||
}
|
||||
|
||||
public enum Message {
|
||||
case response(msgid: UInt32, error: Value, result: Value)
|
||||
case notification(method: String, params: [Value])
|
||||
case error(value: Value, msg: String)
|
||||
}
|
||||
|
||||
public struct Response {
|
||||
public let msgid: UInt32
|
||||
public let error: Value
|
||||
public let result: Value
|
||||
}
|
||||
|
||||
public struct Error: Swift.Error {
|
||||
var msg: String
|
||||
var cause: Swift.Error?
|
||||
|
||||
init(msg: String, cause: Swift.Error? = nil) {
|
||||
self.msg = msg
|
||||
self.cause = cause
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Streams `Message.notification`s and `Message.error`s by default.
|
||||
When `streamResponses` is set to `true`, then also `Message.response`s.
|
||||
*/
|
||||
public var stream: Observable<Message> { self.streamSubject.asObservable() }
|
||||
|
||||
/**
|
||||
When `true`, all messages of type `MessageType.response` are also streamed
|
||||
to `stream` as `Message.response`. When `false`, only the `Single`s
|
||||
you get from `request(msgid, method, params, expectsReturnValue)` will
|
||||
get the response as `Response`.
|
||||
*/
|
||||
public var streamResponses = false
|
||||
|
||||
public let uuid = UUID()
|
||||
|
||||
public init(queueQos: DispatchQoS) {
|
||||
self.queue = DispatchQueue(
|
||||
label: "\(String(reflecting: RxMsgpackRpc.self))-\(self.uuid.uuidString)",
|
||||
qos: queueQos,
|
||||
target: .global(qos: queueQos.qosClass)
|
||||
)
|
||||
}
|
||||
|
||||
public func run(at path: String) -> Completable {
|
||||
Completable.create { completable in
|
||||
self.queue.async {
|
||||
do {
|
||||
try self.socket = Socket.create(family: .unix, type: .stream, proto: .unix)
|
||||
try self.socket?.connect(to: path)
|
||||
self.setUpThreadAndStartReading()
|
||||
} catch {
|
||||
self.streamSubject.onError(Error(msg: "Could not get socket", cause: error))
|
||||
completable(.error(Error(msg: "Could not get socket at \(path)", cause: error)))
|
||||
}
|
||||
|
||||
completable(.completed)
|
||||
}
|
||||
|
||||
return Disposables.create()
|
||||
}
|
||||
}
|
||||
|
||||
public func stop() -> Completable {
|
||||
Completable.create { completable in
|
||||
self.queue.async {
|
||||
self.cleanUpAndCloseSocket()
|
||||
completable(.completed)
|
||||
}
|
||||
|
||||
return Disposables.create()
|
||||
}
|
||||
}
|
||||
|
||||
public func request(
|
||||
method: String,
|
||||
params: [Value],
|
||||
expectsReturnValue: Bool
|
||||
) -> Single<Response> {
|
||||
Single.create { single in
|
||||
self.queue.async {
|
||||
let msgid = self.nextMsgid
|
||||
self.nextMsgid += 1
|
||||
|
||||
let packed = pack(
|
||||
[
|
||||
.uint(MessageType.request.rawValue),
|
||||
.uint(UInt64(msgid)),
|
||||
.string(method),
|
||||
.array(params),
|
||||
]
|
||||
)
|
||||
|
||||
if self.socket?.remoteConnectionClosed == true {
|
||||
single(.failure(Error(
|
||||
msg: "Connection stopped, but trying to send a request with msg id \(msgid)"
|
||||
)))
|
||||
return
|
||||
}
|
||||
|
||||
guard let socket = self.socket else {
|
||||
single(.failure(Error(
|
||||
msg: "Socket is invalid, but trying to send a request with " +
|
||||
"msg id \(msgid): \(method) with \(params)"
|
||||
)))
|
||||
return
|
||||
}
|
||||
|
||||
if expectsReturnValue { self.singles[msgid] = single }
|
||||
|
||||
do {
|
||||
let writtenBytes = try socket.write(from: packed)
|
||||
if writtenBytes < packed.count {
|
||||
single(.failure(Error(
|
||||
msg: "(Written) = \(writtenBytes) < \(packed.count) = " +
|
||||
"(requested) for msg id: \(msgid)"
|
||||
)))
|
||||
|
||||
return
|
||||
}
|
||||
} catch {
|
||||
self.streamSubject.onError(Error(
|
||||
msg: "Could not write to socket for msg id: \(msgid)", cause: error
|
||||
))
|
||||
|
||||
single(.failure(Error(
|
||||
msg: "Could not write to socket for msg id: \(msgid)", cause: error
|
||||
)))
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
if !expectsReturnValue { single(.success(self.nilResponse(with: msgid))) }
|
||||
}
|
||||
|
||||
return Disposables.create()
|
||||
}
|
||||
}
|
||||
|
||||
private var nextMsgid: UInt32 = 0
|
||||
|
||||
private var socket: Socket?
|
||||
private var thread: Thread?
|
||||
private let queue: DispatchQueue
|
||||
|
||||
private var singles: [UInt32: SingleResponseObserver] = [:]
|
||||
|
||||
private let streamSubject = PublishSubject<Message>()
|
||||
|
||||
private func nilResponse(with msgid: UInt32) -> Response {
|
||||
Response(msgid: msgid, error: .nil, result: .nil)
|
||||
}
|
||||
|
||||
private func cleanUpAndCloseSocket() {
|
||||
self.streamSubject.onCompleted()
|
||||
|
||||
self.singles.forEach { msgid, single in single(.success(self.nilResponse(with: msgid))) }
|
||||
self.singles.removeAll()
|
||||
|
||||
self.socket?.close()
|
||||
}
|
||||
|
||||
private func setUpThreadAndStartReading() {
|
||||
self.thread = Thread {
|
||||
guard let socket = self.socket else { return }
|
||||
|
||||
var readData = Data(capacity: 10240)
|
||||
repeat {
|
||||
do {
|
||||
let readBytes = try socket.read(into: &readData)
|
||||
defer { readData.count = 0 }
|
||||
if readBytes > 0 {
|
||||
let values = try unpackAll(readData)
|
||||
values.forEach(self.processMessage)
|
||||
} else if readBytes == 0 {
|
||||
if socket.remoteConnectionClosed {
|
||||
self.queue.async { self.cleanUpAndCloseSocket() }
|
||||
return
|
||||
}
|
||||
|
||||
continue
|
||||
}
|
||||
} catch let error as Socket.Error {
|
||||
self.streamSubject.onError(Error(msg: "Could not read from socket", cause: error))
|
||||
self.queue.async { self.cleanUpAndCloseSocket() }
|
||||
return
|
||||
} catch {
|
||||
self.streamSubject.onNext(
|
||||
.error(value: .nil, msg: "Data from socket could not be unpacked")
|
||||
)
|
||||
self.queue.async { self.cleanUpAndCloseSocket() }
|
||||
return
|
||||
}
|
||||
} while self.socket?.remoteConnectionClosed == false
|
||||
}
|
||||
|
||||
self.thread?.start()
|
||||
}
|
||||
|
||||
private func processMessage(_ unpacked: Value) {
|
||||
guard let array = unpacked.arrayValue else {
|
||||
self.streamSubject.onNext(.error(
|
||||
value: unpacked,
|
||||
msg: "Could not get the array from the message"
|
||||
))
|
||||
return
|
||||
}
|
||||
|
||||
guard let rawType = array[0].uint64Value, let type = MessageType(rawValue: rawType) else {
|
||||
self.streamSubject.onNext(.error(
|
||||
value: unpacked, msg: "Could not get the type of the message"
|
||||
))
|
||||
return
|
||||
}
|
||||
|
||||
switch type {
|
||||
case .response:
|
||||
guard array.count == 4 else {
|
||||
self.streamSubject.onNext(.error(
|
||||
value: unpacked,
|
||||
msg: "Got an array of length \(array.count) for a message type response"
|
||||
))
|
||||
return
|
||||
}
|
||||
|
||||
guard let msgid64 = array[1].uint64Value else {
|
||||
self.streamSubject.onNext(.error(value: unpacked, msg: "Could not get the msgid"))
|
||||
return
|
||||
}
|
||||
|
||||
self.queue.async {
|
||||
self.processResponse(msgid: UInt32(msgid64), error: array[2], result: array[3])
|
||||
}
|
||||
|
||||
case .notification:
|
||||
guard array.count == 3 else {
|
||||
self.streamSubject.onNext(.error(
|
||||
value: unpacked,
|
||||
msg: "Got an array of length \(array.count) for a message type notification"
|
||||
))
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
guard let method = array[1].stringValue, let params = array[2].arrayValue else {
|
||||
self.streamSubject.onNext(.error(
|
||||
value: unpacked,
|
||||
msg: "Could not get the method and params"
|
||||
))
|
||||
return
|
||||
}
|
||||
|
||||
self.streamSubject.onNext(.notification(method: method, params: params))
|
||||
|
||||
case .request:
|
||||
self.streamSubject.onNext(.error(
|
||||
value: unpacked,
|
||||
msg: "Got message type request from remote"
|
||||
))
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
private func processResponse(msgid: UInt32, error: Value, result: Value) {
|
||||
if self.streamResponses {
|
||||
self.streamSubject.onNext(.response(msgid: msgid, error: error, result: result))
|
||||
}
|
||||
|
||||
guard let single: SingleResponseObserver = self.singles[msgid] else { return }
|
||||
|
||||
single(.success(Response(msgid: msgid, error: error, result: result)))
|
||||
self.singles.removeValue(forKey: msgid)
|
||||
}
|
||||
}
|
||||
|
||||
private typealias SingleResponseObserver = (SingleEvent<RxMsgpackRpc.Response>) -> Void
|
File diff suppressed because it is too large
Load Diff
@ -1,71 +0,0 @@
|
||||
/**
|
||||
* Tae Won Ha - http://taewon.de - @hataewon
|
||||
* See LICENSE
|
||||
*/
|
||||
|
||||
import Foundation
|
||||
import RxSwift
|
||||
|
||||
public final class RxNeovimApi {
|
||||
public enum Event {
|
||||
case error(msg: String)
|
||||
}
|
||||
|
||||
public struct Buffer: Equatable, Hashable {
|
||||
public let handle: Int
|
||||
public init(_ handle: Int) { self.handle = handle }
|
||||
}
|
||||
|
||||
public struct Window: Equatable, Hashable {
|
||||
public let handle: Int
|
||||
public init(_ handle: Int) { self.handle = handle }
|
||||
}
|
||||
|
||||
public struct Tabpage: Equatable, Hashable {
|
||||
public let handle: Int
|
||||
public init(_ handle: Int) { self.handle = handle }
|
||||
}
|
||||
|
||||
public typealias Value = RxMsgpackRpc.Value
|
||||
|
||||
public var streamResponses: Bool {
|
||||
get { self.msgpackRpc.streamResponses }
|
||||
set { self.msgpackRpc.streamResponses = newValue }
|
||||
}
|
||||
|
||||
public var msgpackRawStream: Observable<RxMsgpackRpc.Message> { self.msgpackRpc.stream }
|
||||
|
||||
public func run(at path: String) -> Completable { self.msgpackRpc.run(at: path) }
|
||||
|
||||
public func stop() -> Completable { self.msgpackRpc.stop() }
|
||||
|
||||
public func checkBlocked<T>(_ single: Single<T>) -> Single<T> {
|
||||
self
|
||||
.getMode()
|
||||
.flatMap { dict -> Single<T> in
|
||||
guard (dict["blocking"]?.boolValue ?? false) == false else {
|
||||
throw RxNeovimApi.Error.blocked
|
||||
}
|
||||
|
||||
return single
|
||||
}
|
||||
}
|
||||
|
||||
public func rpc(
|
||||
method: String,
|
||||
params: [RxNeovimApi.Value],
|
||||
expectsReturnValue: Bool = true
|
||||
) -> Single<RxNeovimApi.Value> {
|
||||
self.msgpackRpc
|
||||
.request(method: method, params: params, expectsReturnValue: expectsReturnValue)
|
||||
.map { response -> RxMsgpackRpc.Value in
|
||||
guard response.error.isNil else { throw RxNeovimApi.Error(response.error) }
|
||||
|
||||
return response.result
|
||||
}
|
||||
}
|
||||
|
||||
public init() {}
|
||||
|
||||
private let msgpackRpc = RxMsgpackRpc(queueQos: .userInitiated)
|
||||
}
|
@ -1,102 +0,0 @@
|
||||
/**
|
||||
* Tae Won Ha - http://taewon.de - @hataewon
|
||||
* See LICENSE
|
||||
*/
|
||||
|
||||
import Foundation
|
||||
import os
|
||||
import RxSwift
|
||||
|
||||
public extension ObservableType {
|
||||
func compactMap<R>(_ transform: @escaping (Element) throws -> R?) -> Observable<R> {
|
||||
self
|
||||
.map(transform)
|
||||
.filter { $0 != nil }
|
||||
.map { $0! }
|
||||
}
|
||||
}
|
||||
|
||||
public extension PrimitiveSequence where Element == Never, Trait == CompletableTrait {
|
||||
func andThen(using body: () -> Completable) -> Completable { self.andThen(body()) }
|
||||
|
||||
func wait(
|
||||
timeout: TimeInterval = 5,
|
||||
onCompleted: (() -> Void)? = nil,
|
||||
onError: ((Swift.Error) -> Void)? = nil
|
||||
) throws {
|
||||
var trigger = false
|
||||
var err: Swift.Error?
|
||||
|
||||
let condition = NSCondition()
|
||||
|
||||
condition.lock()
|
||||
defer { condition.unlock() }
|
||||
|
||||
let disposable = self.subscribe(onCompleted: {
|
||||
onCompleted?()
|
||||
|
||||
condition.lock()
|
||||
defer { condition.unlock() }
|
||||
trigger = true
|
||||
condition.broadcast()
|
||||
}, onError: { error in
|
||||
onError?(error)
|
||||
err = error
|
||||
|
||||
condition.lock()
|
||||
defer { condition.unlock() }
|
||||
trigger = true
|
||||
condition.broadcast()
|
||||
})
|
||||
|
||||
while !trigger {
|
||||
condition.wait(until: Date(timeIntervalSinceNow: timeout))
|
||||
trigger = true
|
||||
}
|
||||
|
||||
disposable.dispose()
|
||||
|
||||
if let e = err { throw e }
|
||||
}
|
||||
}
|
||||
|
||||
public extension PrimitiveSequence where Trait == SingleTrait {
|
||||
static func fromSinglesToSingleOfArray(_ singles: [Single<Element>]) -> Single<[Element]> {
|
||||
Observable
|
||||
.merge(singles.map { $0.asObservable() })
|
||||
.toArray()
|
||||
}
|
||||
|
||||
func syncValue(timeout: TimeInterval = 5) -> Element? {
|
||||
var trigger = false
|
||||
var value: Element?
|
||||
|
||||
let condition = NSCondition()
|
||||
|
||||
condition.lock()
|
||||
defer { condition.unlock() }
|
||||
|
||||
let disposable = self.subscribe(onSuccess: { result in
|
||||
value = result
|
||||
|
||||
condition.lock()
|
||||
defer { condition.unlock() }
|
||||
trigger = true
|
||||
condition.broadcast()
|
||||
}, onFailure: { _ in
|
||||
condition.lock()
|
||||
defer { condition.unlock() }
|
||||
trigger = true
|
||||
condition.broadcast()
|
||||
})
|
||||
|
||||
while !trigger {
|
||||
condition.wait(until: Date(timeIntervalSinceNow: timeout))
|
||||
trigger = true
|
||||
}
|
||||
|
||||
disposable.dispose()
|
||||
|
||||
return value
|
||||
}
|
||||
}
|
@ -1,121 +0,0 @@
|
||||
/**
|
||||
* Tae Won Ha - http://taewon.de - @hataewon
|
||||
* See LICENSE
|
||||
*/
|
||||
|
||||
import Cocoa
|
||||
import RxPack
|
||||
import RxSwift
|
||||
|
||||
@NSApplicationMain
|
||||
class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
@IBOutlet var window: NSWindow!
|
||||
|
||||
@IBOutlet var clientTextField: NSTextField!
|
||||
|
||||
@IBOutlet var serverTextView: NSTextView!
|
||||
@IBOutlet var clientTextView: NSTextView!
|
||||
|
||||
private let server = RxMessagePortServer(queueQos: .default)
|
||||
private let client = RxMessagePortClient(queueQos: .default)
|
||||
|
||||
private var msgid = Int32(0)
|
||||
|
||||
private let disposeBag = DisposeBag()
|
||||
|
||||
@IBAction func serverStop(sender _: Any?) {
|
||||
self.server.stop().subscribe().disposed(by: self.disposeBag)
|
||||
}
|
||||
|
||||
@IBAction func clientStop(sender _: Any?) {
|
||||
self.client.stop().subscribe().disposed(by: self.disposeBag)
|
||||
}
|
||||
|
||||
@IBAction func clientSend(sender _: Any?) {
|
||||
let text = self.clientTextField.stringValue
|
||||
|
||||
self.logClient("Sending msg (\(self.msgid), \(text))")
|
||||
self.client.send(msgid: self.msgid, data: text.data(using: .utf8)!, expectsReply: true)
|
||||
.observeOn(MainScheduler.instance)
|
||||
.subscribe(onSuccess: { data in
|
||||
if let d = data {
|
||||
self.logClient("Got reply from server: \(String(data: d, encoding: .utf8)!)")
|
||||
} else {
|
||||
self.logClient("Got reply from server: nil")
|
||||
}
|
||||
}, onError: { error in
|
||||
self.logClient("Could not send msg: \(error)")
|
||||
})
|
||||
.disposed(by: self.disposeBag)
|
||||
|
||||
self.msgid += 1
|
||||
}
|
||||
|
||||
func applicationDidFinishLaunching(_: Notification) {
|
||||
self
|
||||
.startServer()
|
||||
.andThen(self.startClient())
|
||||
.subscribe(onCompleted: {
|
||||
DispatchQueue.main.async {
|
||||
self.logServer("Server started with name: com.qvacua.RxMessagePort.demo.server")
|
||||
self.logClient("Connected to com.qvacua.RxMessagePort.demo.server")
|
||||
}
|
||||
}, onError: { error in
|
||||
DispatchQueue.main.async {
|
||||
self.logServer("There was an error: \(error)")
|
||||
self.logClient("There was an error: \(error)")
|
||||
}
|
||||
})
|
||||
.disposed(by: self.disposeBag)
|
||||
}
|
||||
|
||||
func applicationWillTerminate(_: Notification) {
|
||||
self.client.stop().subscribe().disposed(by: self.disposeBag)
|
||||
self.server.stop().subscribe().disposed(by: self.disposeBag)
|
||||
}
|
||||
|
||||
private func startServer() -> Completable {
|
||||
self.logServer("Starting server...")
|
||||
|
||||
self.server.stream
|
||||
.observeOn(MainScheduler.instance)
|
||||
.subscribe(onNext: { message in
|
||||
self.logServer("Got event in stream \(message)")
|
||||
})
|
||||
.disposed(by: self.disposeBag)
|
||||
|
||||
self.server.syncReplyBody = { (msgid, data) -> Data? in
|
||||
DispatchQueue.main.async {
|
||||
self.logServer("Preparing synchronous reply to (\(msgid), \(String(describing: data)))")
|
||||
}
|
||||
|
||||
if let d = data {
|
||||
return "Reply to (\(msgid), \(String(data: d, encoding: .utf8)!))".data(using: .utf8)
|
||||
}
|
||||
|
||||
return "Reply to (\(msgid), nil)".data(using: .utf8)
|
||||
}
|
||||
|
||||
return self.server.run(as: "com.qvacua.RxMessagePort.demo.server")
|
||||
}
|
||||
|
||||
private func startClient() -> Completable {
|
||||
self.logClient("Starting client...")
|
||||
return self.client.connect(to: "com.qvacua.RxMessagePort.demo.server")
|
||||
}
|
||||
|
||||
private func logServer(_ msg: String) {
|
||||
self.serverTextView.append(string: "\(msg)\n")
|
||||
}
|
||||
|
||||
private func logClient(_ msg: String) {
|
||||
self.clientTextView.append(string: "\(msg)\n")
|
||||
}
|
||||
}
|
||||
|
||||
extension NSTextView {
|
||||
func append(string: String) {
|
||||
self.textStorage?.append(NSAttributedString(string: string))
|
||||
self.scrollToEndOfDocument(nil)
|
||||
}
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "16x16",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "16x16",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "32x32",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "32x32",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "128x128",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "128x128",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "256x256",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "256x256",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "512x512",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "512x512",
|
||||
"scale" : "2x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
@ -1,862 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="17147" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="17147"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
|
||||
<connections>
|
||||
<outlet property="delegate" destination="Voe-Tx-rLC" id="GzC-gU-4Uq"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModule="RxMessagePortDemo" customModuleProvider="target">
|
||||
<connections>
|
||||
<outlet property="clientTextField" destination="jeU-0r-k3Z" id="fTA-Ay-9jX"/>
|
||||
<outlet property="clientTextView" destination="9yk-iE-DFP" id="Kar-uz-x9f"/>
|
||||
<outlet property="serverTextView" destination="7xs-KD-PNk" id="e7b-b5-HdR"/>
|
||||
<outlet property="window" destination="QvC-M9-y7g" id="gIp-Ho-8D9"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
<customObject id="YLy-65-1bz" customClass="NSFontManager"/>
|
||||
<menu title="Main Menu" systemMenu="main" id="AYu-sK-qS6">
|
||||
<items>
|
||||
<menuItem title="RxMessagePortDemo" id="1Xt-HY-uBw">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="RxMessagePortDemo" systemMenu="apple" id="uQy-DD-JDr">
|
||||
<items>
|
||||
<menuItem title="About RxMessagePortDemo" id="5kV-Vb-QxS">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="orderFrontStandardAboutPanel:" target="-1" id="Exp-CZ-Vem"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="VOq-y0-SEH"/>
|
||||
<menuItem title="Preferences…" keyEquivalent="," id="BOF-NM-1cW"/>
|
||||
<menuItem isSeparatorItem="YES" id="wFC-TO-SCJ"/>
|
||||
<menuItem title="Services" id="NMo-om-nkz">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Services" systemMenu="services" id="hz9-B4-Xy5"/>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="4je-JR-u6R"/>
|
||||
<menuItem title="Hide RxMessagePortDemo" keyEquivalent="h" id="Olw-nP-bQN">
|
||||
<connections>
|
||||
<action selector="hide:" target="-1" id="PnN-Uc-m68"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Hide Others" keyEquivalent="h" id="Vdr-fp-XzO">
|
||||
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="hideOtherApplications:" target="-1" id="VT4-aY-XCT"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Show All" id="Kd2-mp-pUS">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="unhideAllApplications:" target="-1" id="Dhg-Le-xox"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="kCx-OE-vgT"/>
|
||||
<menuItem title="Quit RxMessagePortDemo" keyEquivalent="q" id="4sb-4s-VLi">
|
||||
<connections>
|
||||
<action selector="terminate:" target="-1" id="Te7-pn-YzF"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="File" id="dMs-cI-mzQ">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="File" id="bib-Uj-vzu">
|
||||
<items>
|
||||
<menuItem title="New" keyEquivalent="n" id="Was-JA-tGl">
|
||||
<connections>
|
||||
<action selector="newDocument:" target="-1" id="4Si-XN-c54"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Open…" keyEquivalent="o" id="IAo-SY-fd9">
|
||||
<connections>
|
||||
<action selector="openDocument:" target="-1" id="bVn-NM-KNZ"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Open Recent" id="tXI-mr-wws">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Open Recent" systemMenu="recentDocuments" id="oas-Oc-fiZ">
|
||||
<items>
|
||||
<menuItem title="Clear Menu" id="vNY-rz-j42">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="clearRecentDocuments:" target="-1" id="Daa-9d-B3U"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="m54-Is-iLE"/>
|
||||
<menuItem title="Close" keyEquivalent="w" id="DVo-aG-piG">
|
||||
<connections>
|
||||
<action selector="performClose:" target="-1" id="HmO-Ls-i7Q"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Save…" keyEquivalent="s" id="pxx-59-PXV">
|
||||
<connections>
|
||||
<action selector="saveDocument:" target="-1" id="teZ-XB-qJY"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Save As…" keyEquivalent="S" id="Bw7-FT-i3A">
|
||||
<connections>
|
||||
<action selector="saveDocumentAs:" target="-1" id="mDf-zr-I0C"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Revert to Saved" keyEquivalent="r" id="KaW-ft-85H">
|
||||
<connections>
|
||||
<action selector="revertDocumentToSaved:" target="-1" id="iJ3-Pv-kwq"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="aJh-i4-bef"/>
|
||||
<menuItem title="Page Setup…" keyEquivalent="P" id="qIS-W8-SiK">
|
||||
<modifierMask key="keyEquivalentModifierMask" shift="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="runPageLayout:" target="-1" id="Din-rz-gC5"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Print…" keyEquivalent="p" id="aTl-1u-JFS">
|
||||
<connections>
|
||||
<action selector="print:" target="-1" id="qaZ-4w-aoO"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Edit" id="5QF-Oa-p0T">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Edit" id="W48-6f-4Dl">
|
||||
<items>
|
||||
<menuItem title="Undo" keyEquivalent="z" id="dRJ-4n-Yzg">
|
||||
<connections>
|
||||
<action selector="undo:" target="-1" id="M6e-cu-g7V"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Redo" keyEquivalent="Z" id="6dh-zS-Vam">
|
||||
<connections>
|
||||
<action selector="redo:" target="-1" id="oIA-Rs-6OD"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="WRV-NI-Exz"/>
|
||||
<menuItem title="Cut" keyEquivalent="x" id="uRl-iY-unG">
|
||||
<connections>
|
||||
<action selector="cut:" target="-1" id="YJe-68-I9s"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Copy" keyEquivalent="c" id="x3v-GG-iWU">
|
||||
<connections>
|
||||
<action selector="copy:" target="-1" id="G1f-GL-Joy"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Paste" keyEquivalent="v" id="gVA-U4-sdL">
|
||||
<connections>
|
||||
<action selector="paste:" target="-1" id="UvS-8e-Qdg"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Paste and Match Style" keyEquivalent="V" id="WeT-3V-zwk">
|
||||
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="pasteAsPlainText:" target="-1" id="cEh-KX-wJQ"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Delete" id="pa3-QI-u2k">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="delete:" target="-1" id="0Mk-Ml-PaM"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Select All" keyEquivalent="a" id="Ruw-6m-B2m">
|
||||
<connections>
|
||||
<action selector="selectAll:" target="-1" id="VNm-Mi-diN"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="uyl-h8-XO2"/>
|
||||
<menuItem title="Find" id="4EN-yA-p0u">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Find" id="1b7-l0-nxx">
|
||||
<items>
|
||||
<menuItem title="Find…" tag="1" keyEquivalent="f" id="Xz5-n4-O0W">
|
||||
<connections>
|
||||
<action selector="performFindPanelAction:" target="-1" id="cD7-Qs-BN4"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Find and Replace…" tag="12" keyEquivalent="f" id="YEy-JH-Tfz">
|
||||
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="performFindPanelAction:" target="-1" id="WD3-Gg-5AJ"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Find Next" tag="2" keyEquivalent="g" id="q09-fT-Sye">
|
||||
<connections>
|
||||
<action selector="performFindPanelAction:" target="-1" id="NDo-RZ-v9R"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Find Previous" tag="3" keyEquivalent="G" id="OwM-mh-QMV">
|
||||
<connections>
|
||||
<action selector="performFindPanelAction:" target="-1" id="HOh-sY-3ay"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Use Selection for Find" tag="7" keyEquivalent="e" id="buJ-ug-pKt">
|
||||
<connections>
|
||||
<action selector="performFindPanelAction:" target="-1" id="U76-nv-p5D"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Jump to Selection" keyEquivalent="j" id="S0p-oC-mLd">
|
||||
<connections>
|
||||
<action selector="centerSelectionInVisibleArea:" target="-1" id="IOG-6D-g5B"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Spelling and Grammar" id="Dv1-io-Yv7">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Spelling" id="3IN-sU-3Bg">
|
||||
<items>
|
||||
<menuItem title="Show Spelling and Grammar" keyEquivalent=":" id="HFo-cy-zxI">
|
||||
<connections>
|
||||
<action selector="showGuessPanel:" target="-1" id="vFj-Ks-hy3"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Check Document Now" keyEquivalent=";" id="hz2-CU-CR7">
|
||||
<connections>
|
||||
<action selector="checkSpelling:" target="-1" id="fz7-VC-reM"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="bNw-od-mp5"/>
|
||||
<menuItem title="Check Spelling While Typing" id="rbD-Rh-wIN">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleContinuousSpellChecking:" target="-1" id="7w6-Qz-0kB"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Check Grammar With Spelling" id="mK6-2p-4JG">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleGrammarChecking:" target="-1" id="muD-Qn-j4w"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Correct Spelling Automatically" id="78Y-hA-62v">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleAutomaticSpellingCorrection:" target="-1" id="2lM-Qi-WAP"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Substitutions" id="9ic-FL-obx">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Substitutions" id="FeM-D8-WVr">
|
||||
<items>
|
||||
<menuItem title="Show Substitutions" id="z6F-FW-3nz">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="orderFrontSubstitutionsPanel:" target="-1" id="oku-mr-iSq"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="gPx-C9-uUO"/>
|
||||
<menuItem title="Smart Copy/Paste" id="9yt-4B-nSM">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleSmartInsertDelete:" target="-1" id="3IJ-Se-DZD"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Smart Quotes" id="hQb-2v-fYv">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleAutomaticQuoteSubstitution:" target="-1" id="ptq-xd-QOA"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Smart Dashes" id="rgM-f4-ycn">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleAutomaticDashSubstitution:" target="-1" id="oCt-pO-9gS"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Smart Links" id="cwL-P1-jid">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleAutomaticLinkDetection:" target="-1" id="Gip-E3-Fov"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Data Detectors" id="tRr-pd-1PS">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleAutomaticDataDetection:" target="-1" id="R1I-Nq-Kbl"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Text Replacement" id="HFQ-gK-NFA">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleAutomaticTextReplacement:" target="-1" id="DvP-Fe-Py6"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Transformations" id="2oI-Rn-ZJC">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Transformations" id="c8a-y6-VQd">
|
||||
<items>
|
||||
<menuItem title="Make Upper Case" id="vmV-6d-7jI">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="uppercaseWord:" target="-1" id="sPh-Tk-edu"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Make Lower Case" id="d9M-CD-aMd">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="lowercaseWord:" target="-1" id="iUZ-b5-hil"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Capitalize" id="UEZ-Bs-lqG">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="capitalizeWord:" target="-1" id="26H-TL-nsh"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Speech" id="xrE-MZ-jX0">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Speech" id="3rS-ZA-NoH">
|
||||
<items>
|
||||
<menuItem title="Start Speaking" id="Ynk-f8-cLZ">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="startSpeaking:" target="-1" id="654-Ng-kyl"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Stop Speaking" id="Oyz-dy-DGm">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="stopSpeaking:" target="-1" id="dX8-6p-jy9"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Format" id="jxT-CU-nIS">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Format" id="GEO-Iw-cKr">
|
||||
<items>
|
||||
<menuItem title="Font" id="Gi5-1S-RQB">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Font" systemMenu="font" id="aXa-aM-Jaq">
|
||||
<items>
|
||||
<menuItem title="Show Fonts" keyEquivalent="t" id="Q5e-8K-NDq">
|
||||
<connections>
|
||||
<action selector="orderFrontFontPanel:" target="YLy-65-1bz" id="WHr-nq-2xA"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Bold" tag="2" keyEquivalent="b" id="GB9-OM-e27">
|
||||
<connections>
|
||||
<action selector="addFontTrait:" target="YLy-65-1bz" id="hqk-hr-sYV"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Italic" tag="1" keyEquivalent="i" id="Vjx-xi-njq">
|
||||
<connections>
|
||||
<action selector="addFontTrait:" target="YLy-65-1bz" id="IHV-OB-c03"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Underline" keyEquivalent="u" id="WRG-CD-K1S">
|
||||
<connections>
|
||||
<action selector="underline:" target="-1" id="FYS-2b-JAY"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="5gT-KC-WSO"/>
|
||||
<menuItem title="Bigger" tag="3" keyEquivalent="+" id="Ptp-SP-VEL">
|
||||
<connections>
|
||||
<action selector="modifyFont:" target="YLy-65-1bz" id="Uc7-di-UnL"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Smaller" tag="4" keyEquivalent="-" id="i1d-Er-qST">
|
||||
<connections>
|
||||
<action selector="modifyFont:" target="YLy-65-1bz" id="HcX-Lf-eNd"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="kx3-Dk-x3B"/>
|
||||
<menuItem title="Kern" id="jBQ-r6-VK2">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Kern" id="tlD-Oa-oAM">
|
||||
<items>
|
||||
<menuItem title="Use Default" id="GUa-eO-cwY">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="useStandardKerning:" target="-1" id="6dk-9l-Ckg"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Use None" id="cDB-IK-hbR">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="turnOffKerning:" target="-1" id="U8a-gz-Maa"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Tighten" id="46P-cB-AYj">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="tightenKerning:" target="-1" id="hr7-Nz-8ro"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Loosen" id="ogc-rX-tC1">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="loosenKerning:" target="-1" id="8i4-f9-FKE"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Ligatures" id="o6e-r0-MWq">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Ligatures" id="w0m-vy-SC9">
|
||||
<items>
|
||||
<menuItem title="Use Default" id="agt-UL-0e3">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="useStandardLigatures:" target="-1" id="7uR-wd-Dx6"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Use None" id="J7y-lM-qPV">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="turnOffLigatures:" target="-1" id="iX2-gA-Ilz"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Use All" id="xQD-1f-W4t">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="useAllLigatures:" target="-1" id="KcB-kA-TuK"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Baseline" id="OaQ-X3-Vso">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Baseline" id="ijk-EB-dga">
|
||||
<items>
|
||||
<menuItem title="Use Default" id="3Om-Ey-2VK">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="unscript:" target="-1" id="0vZ-95-Ywn"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Superscript" id="Rqc-34-cIF">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="superscript:" target="-1" id="3qV-fo-wpU"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Subscript" id="I0S-gh-46l">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="subscript:" target="-1" id="Q6W-4W-IGz"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Raise" id="2h7-ER-AoG">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="raiseBaseline:" target="-1" id="4sk-31-7Q9"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Lower" id="1tx-W0-xDw">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="lowerBaseline:" target="-1" id="OF1-bc-KW4"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="Ndw-q3-faq"/>
|
||||
<menuItem title="Show Colors" keyEquivalent="C" id="bgn-CT-cEk">
|
||||
<connections>
|
||||
<action selector="orderFrontColorPanel:" target="-1" id="mSX-Xz-DV3"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="iMs-zA-UFJ"/>
|
||||
<menuItem title="Copy Style" keyEquivalent="c" id="5Vv-lz-BsD">
|
||||
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="copyFont:" target="-1" id="GJO-xA-L4q"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Paste Style" keyEquivalent="v" id="vKC-jM-MkH">
|
||||
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="pasteFont:" target="-1" id="JfD-CL-leO"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Text" id="Fal-I4-PZk">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Text" id="d9c-me-L2H">
|
||||
<items>
|
||||
<menuItem title="Align Left" keyEquivalent="{" id="ZM1-6Q-yy1">
|
||||
<connections>
|
||||
<action selector="alignLeft:" target="-1" id="zUv-R1-uAa"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Center" keyEquivalent="|" id="VIY-Ag-zcb">
|
||||
<connections>
|
||||
<action selector="alignCenter:" target="-1" id="spX-mk-kcS"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Justify" id="J5U-5w-g23">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="alignJustified:" target="-1" id="ljL-7U-jND"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Align Right" keyEquivalent="}" id="wb2-vD-lq4">
|
||||
<connections>
|
||||
<action selector="alignRight:" target="-1" id="r48-bG-YeY"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="4s2-GY-VfK"/>
|
||||
<menuItem title="Writing Direction" id="H1b-Si-o9J">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Writing Direction" id="8mr-sm-Yjd">
|
||||
<items>
|
||||
<menuItem title="Paragraph" enabled="NO" id="ZvO-Gk-QUH">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
</menuItem>
|
||||
<menuItem id="YGs-j5-SAR">
|
||||
<string key="title"> Default</string>
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="makeBaseWritingDirectionNatural:" target="-1" id="qtV-5e-UBP"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem id="Lbh-J2-qVU">
|
||||
<string key="title"> Left to Right</string>
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="makeBaseWritingDirectionLeftToRight:" target="-1" id="S0X-9S-QSf"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem id="jFq-tB-4Kx">
|
||||
<string key="title"> Right to Left</string>
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="makeBaseWritingDirectionRightToLeft:" target="-1" id="5fk-qB-AqJ"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="swp-gr-a21"/>
|
||||
<menuItem title="Selection" enabled="NO" id="cqv-fj-IhA">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
</menuItem>
|
||||
<menuItem id="Nop-cj-93Q">
|
||||
<string key="title"> Default</string>
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="makeTextWritingDirectionNatural:" target="-1" id="lPI-Se-ZHp"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem id="BgM-ve-c93">
|
||||
<string key="title"> Left to Right</string>
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="makeTextWritingDirectionLeftToRight:" target="-1" id="caW-Bv-w94"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem id="RB4-Sm-HuC">
|
||||
<string key="title"> Right to Left</string>
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="makeTextWritingDirectionRightToLeft:" target="-1" id="EXD-6r-ZUu"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="fKy-g9-1gm"/>
|
||||
<menuItem title="Show Ruler" id="vLm-3I-IUL">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleRuler:" target="-1" id="FOx-HJ-KwY"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Copy Ruler" keyEquivalent="c" id="MkV-Pr-PK5">
|
||||
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="copyRuler:" target="-1" id="71i-fW-3W2"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Paste Ruler" keyEquivalent="v" id="LVM-kO-fVI">
|
||||
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="pasteRuler:" target="-1" id="cSh-wd-qM2"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="View" id="H8h-7b-M4v">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="View" id="HyV-fh-RgO">
|
||||
<items>
|
||||
<menuItem title="Show Toolbar" keyEquivalent="t" id="snW-S8-Cw5">
|
||||
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="toggleToolbarShown:" target="-1" id="BXY-wc-z0C"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Customize Toolbar…" id="1UK-8n-QPP">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="runToolbarCustomizationPalette:" target="-1" id="pQI-g3-MTW"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="hB3-LF-h0Y"/>
|
||||
<menuItem title="Show Sidebar" keyEquivalent="s" id="kIP-vf-haE">
|
||||
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="toggleSidebar:" target="-1" id="iwa-gc-5KM"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Enter Full Screen" keyEquivalent="f" id="4J7-dP-txa">
|
||||
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="toggleFullScreen:" target="-1" id="dU3-MA-1Rq"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Window" id="aUF-d1-5bR">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Window" systemMenu="window" id="Td7-aD-5lo">
|
||||
<items>
|
||||
<menuItem title="Minimize" keyEquivalent="m" id="OY7-WF-poV">
|
||||
<connections>
|
||||
<action selector="performMiniaturize:" target="-1" id="VwT-WD-YPe"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Zoom" id="R4o-n2-Eq4">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="performZoom:" target="-1" id="DIl-cC-cCs"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="eu3-7i-yIM"/>
|
||||
<menuItem title="Bring All to Front" id="LE2-aR-0XJ">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="arrangeInFront:" target="-1" id="DRN-fu-gQh"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Help" id="wpr-3q-Mcd">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Help" systemMenu="help" id="F2S-fz-NVQ">
|
||||
<items>
|
||||
<menuItem title="RxMessagePortDemo Help" keyEquivalent="?" id="FKE-Sm-Kum">
|
||||
<connections>
|
||||
<action selector="showHelp:" target="-1" id="y7X-2Q-9no"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
</items>
|
||||
<point key="canvasLocation" x="94" y="663"/>
|
||||
</menu>
|
||||
<window title="RxMessagePortDemo" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" frameAutosaveName="RxMessagePortDemo" animationBehavior="default" id="QvC-M9-y7g">
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
|
||||
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
|
||||
<rect key="contentRect" x="335" y="390" width="722" height="670"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
|
||||
<view key="contentView" wantsLayer="YES" id="EiT-Mj-1SZ">
|
||||
<rect key="frame" x="0.0" y="0.0" width="722" height="670"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<splitView arrangesAllSubviews="NO" vertical="YES" translatesAutoresizingMaskIntoConstraints="NO" id="wT0-Tp-Tyg">
|
||||
<rect key="frame" x="20" y="20" width="682" height="630"/>
|
||||
<subviews>
|
||||
<customView id="bEk-ft-FxA">
|
||||
<rect key="frame" x="0.0" y="0.0" width="339" height="630"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="5HO-qr-t9F">
|
||||
<rect key="frame" x="18" y="594" width="44" height="16"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Server" id="0Ln-7O-vOB">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<scrollView horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="LWC-uV-61p">
|
||||
<rect key="frame" x="20" y="20" width="294" height="566"/>
|
||||
<clipView key="contentView" drawsBackground="NO" id="ZBU-vj-ZDa">
|
||||
<rect key="frame" x="1" y="1" width="292" height="564"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<textView editable="NO" importsGraphics="NO" verticallyResizable="YES" usesFontPanel="YES" findStyle="panel" continuousSpellChecking="YES" allowsUndo="YES" usesRuler="YES" allowsNonContiguousLayout="YES" quoteSubstitution="YES" dashSubstitution="YES" smartInsertDelete="YES" id="7xs-KD-PNk">
|
||||
<rect key="frame" x="0.0" y="0.0" width="292" height="564"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
<size key="minSize" width="292" height="564"/>
|
||||
<size key="maxSize" width="635" height="10000000"/>
|
||||
<color key="insertionPointColor" name="textColor" catalog="System" colorSpace="catalog"/>
|
||||
</textView>
|
||||
</subviews>
|
||||
</clipView>
|
||||
<scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="YES" id="cOI-TH-fVa">
|
||||
<rect key="frame" x="-100" y="-100" width="87" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</scroller>
|
||||
<scroller key="verticalScroller" wantsLayer="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="SgK-2R-R5T">
|
||||
<rect key="frame" x="277" y="1" width="16" height="564"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</scroller>
|
||||
</scrollView>
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="9NE-hx-XCL">
|
||||
<rect key="frame" x="62" y="584" width="69" height="32"/>
|
||||
<buttonCell key="cell" type="push" title="Stop" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="8uF-tt-4W2">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="serverStopWithSender:" target="Voe-Tx-rLC" id="SpG-SQ-yJ3"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="LWC-uV-61p" firstAttribute="top" secondItem="5HO-qr-t9F" secondAttribute="bottom" constant="8" symbolic="YES" id="BEv-pe-mS0"/>
|
||||
<constraint firstItem="5HO-qr-t9F" firstAttribute="top" secondItem="bEk-ft-FxA" secondAttribute="top" constant="20" symbolic="YES" id="H79-dC-qnD"/>
|
||||
<constraint firstItem="5HO-qr-t9F" firstAttribute="baseline" secondItem="9NE-hx-XCL" secondAttribute="baseline" id="I7Y-Ey-ftx"/>
|
||||
<constraint firstItem="5HO-qr-t9F" firstAttribute="leading" secondItem="LWC-uV-61p" secondAttribute="leading" id="IMu-gE-hy4"/>
|
||||
<constraint firstAttribute="trailing" secondItem="LWC-uV-61p" secondAttribute="trailing" constant="25" id="Kog-7X-Kcw"/>
|
||||
<constraint firstAttribute="bottom" secondItem="LWC-uV-61p" secondAttribute="bottom" constant="20" symbolic="YES" id="UNR-yf-DnS"/>
|
||||
<constraint firstItem="9NE-hx-XCL" firstAttribute="leading" secondItem="5HO-qr-t9F" secondAttribute="trailing" constant="8" symbolic="YES" id="aHQ-OY-VxX"/>
|
||||
<constraint firstItem="5HO-qr-t9F" firstAttribute="leading" secondItem="bEk-ft-FxA" secondAttribute="leading" constant="20" symbolic="YES" id="mO3-uP-EzA"/>
|
||||
</constraints>
|
||||
</customView>
|
||||
<customView id="uNc-80-ErM">
|
||||
<rect key="frame" x="348" y="0.0" width="334" height="630"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="yva-SU-nLt">
|
||||
<rect key="frame" x="18" y="594" width="40" height="16"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Client" id="PaR-00-kFg">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<scrollView horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="n8A-Ih-oc9">
|
||||
<rect key="frame" x="20" y="20" width="294" height="525"/>
|
||||
<clipView key="contentView" drawsBackground="NO" id="OAT-lb-TK0">
|
||||
<rect key="frame" x="1" y="1" width="292" height="523"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<textView editable="NO" importsGraphics="NO" verticallyResizable="YES" usesFontPanel="YES" findStyle="panel" continuousSpellChecking="YES" allowsUndo="YES" usesRuler="YES" allowsNonContiguousLayout="YES" quoteSubstitution="YES" dashSubstitution="YES" smartInsertDelete="YES" id="9yk-iE-DFP">
|
||||
<rect key="frame" x="0.0" y="0.0" width="292" height="523"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
<size key="minSize" width="292" height="523"/>
|
||||
<size key="maxSize" width="640" height="10000000"/>
|
||||
<color key="insertionPointColor" name="textColor" catalog="System" colorSpace="catalog"/>
|
||||
</textView>
|
||||
</subviews>
|
||||
</clipView>
|
||||
<scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="YES" id="s8P-Hq-0wK">
|
||||
<rect key="frame" x="-100" y="-100" width="87" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</scroller>
|
||||
<scroller key="verticalScroller" wantsLayer="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="IZ6-GW-cSQ">
|
||||
<rect key="frame" x="277" y="1" width="16" height="523"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</scroller>
|
||||
</scrollView>
|
||||
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="jeU-0r-k3Z">
|
||||
<rect key="frame" x="20" y="565" width="227" height="21"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="eGE-L6-3qa">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
<connections>
|
||||
<action selector="clientSendWithSender:" target="Voe-Tx-rLC" id="Tsd-Me-Nde"/>
|
||||
</connections>
|
||||
</textField>
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="RUb-zk-z5U">
|
||||
<rect key="frame" x="249" y="558" width="71" height="32"/>
|
||||
<buttonCell key="cell" type="push" title="Send" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="7mY-fg-cYT">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="clientSendWithSender:" target="Voe-Tx-rLC" id="lbo-Gj-F68"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="e6Q-9T-9z8">
|
||||
<rect key="frame" x="58" y="584" width="69" height="32"/>
|
||||
<buttonCell key="cell" type="push" title="Stop" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="etT-3j-7gZ">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="clientStopWithSender:" target="Voe-Tx-rLC" id="M5A-Vo-kuE"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="RUb-zk-z5U" firstAttribute="trailing" secondItem="n8A-Ih-oc9" secondAttribute="trailing" id="0Mu-4t-bl8"/>
|
||||
<constraint firstItem="yva-SU-nLt" firstAttribute="leading" secondItem="uNc-80-ErM" secondAttribute="leading" constant="20" symbolic="YES" id="1KH-tA-Ova"/>
|
||||
<constraint firstItem="RUb-zk-z5U" firstAttribute="leading" secondItem="jeU-0r-k3Z" secondAttribute="trailing" constant="8" symbolic="YES" id="5FL-nh-dmW"/>
|
||||
<constraint firstItem="yva-SU-nLt" firstAttribute="baseline" secondItem="e6Q-9T-9z8" secondAttribute="baseline" id="5VV-iZ-GXm"/>
|
||||
<constraint firstAttribute="trailing" secondItem="RUb-zk-z5U" secondAttribute="trailing" constant="20" symbolic="YES" id="9mp-wY-R1O"/>
|
||||
<constraint firstAttribute="bottom" secondItem="n8A-Ih-oc9" secondAttribute="bottom" constant="20" symbolic="YES" id="Ee8-Yg-nKn"/>
|
||||
<constraint firstItem="yva-SU-nLt" firstAttribute="leading" secondItem="jeU-0r-k3Z" secondAttribute="leading" id="NWr-uB-65h"/>
|
||||
<constraint firstItem="jeU-0r-k3Z" firstAttribute="leading" secondItem="n8A-Ih-oc9" secondAttribute="leading" id="TfG-Dg-krF"/>
|
||||
<constraint firstItem="e6Q-9T-9z8" firstAttribute="leading" secondItem="yva-SU-nLt" secondAttribute="trailing" constant="8" symbolic="YES" id="VX4-Du-0OT"/>
|
||||
<constraint firstItem="jeU-0r-k3Z" firstAttribute="top" secondItem="yva-SU-nLt" secondAttribute="bottom" constant="8" symbolic="YES" id="Zzg-Ia-2nz"/>
|
||||
<constraint firstItem="jeU-0r-k3Z" firstAttribute="baseline" secondItem="RUb-zk-z5U" secondAttribute="baseline" id="te7-wJ-p6x"/>
|
||||
<constraint firstItem="yva-SU-nLt" firstAttribute="top" secondItem="uNc-80-ErM" secondAttribute="top" constant="20" symbolic="YES" id="u9F-b5-Pe2"/>
|
||||
<constraint firstItem="n8A-Ih-oc9" firstAttribute="top" secondItem="RUb-zk-z5U" secondAttribute="bottom" constant="20" symbolic="YES" id="uDb-Oh-wgP"/>
|
||||
</constraints>
|
||||
</customView>
|
||||
</subviews>
|
||||
<holdingPriorities>
|
||||
<real value="250"/>
|
||||
<real value="250"/>
|
||||
</holdingPriorities>
|
||||
</splitView>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="wT0-Tp-Tyg" firstAttribute="top" secondItem="EiT-Mj-1SZ" secondAttribute="top" constant="20" symbolic="YES" id="J1y-VT-SJO"/>
|
||||
<constraint firstItem="wT0-Tp-Tyg" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" constant="20" symbolic="YES" id="eic-22-p0S"/>
|
||||
<constraint firstAttribute="bottom" secondItem="wT0-Tp-Tyg" secondAttribute="bottom" constant="20" symbolic="YES" id="ivM-2p-que"/>
|
||||
<constraint firstAttribute="trailing" secondItem="wT0-Tp-Tyg" secondAttribute="trailing" constant="20" symbolic="YES" id="vz1-Gi-cPG"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<point key="canvasLocation" x="260" y="50"/>
|
||||
</window>
|
||||
</objects>
|
||||
</document>
|
@ -1,32 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string></string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2019 Tae Won Ha. All rights reserved.</string>
|
||||
<key>NSMainNibFile</key>
|
||||
<string>MainMenu</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
</dict>
|
||||
</plist>
|
@ -1,375 +0,0 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 52;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
4B022661224AB1490052362B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4B022660224AB1490052362B /* Assets.xcassets */; };
|
||||
4B022664224AB1490052362B /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4B022662224AB1490052362B /* MainMenu.xib */; };
|
||||
4B7FBFCD24EC8616002D12A1 /* RxPack in Frameworks */ = {isa = PBXBuildFile; productRef = 4B7FBFCC24EC8616002D12A1 /* RxPack */; };
|
||||
4B7FBFD024EC8632002D12A1 /* RxSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 4B7FBFCF24EC8632002D12A1 /* RxSwift */; };
|
||||
4B7FBFD124EC8851002D12A1 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B02265E224AB1490052362B /* AppDelegate.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
4B022671224ACCE80052362B /* Embed Frameworks */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
);
|
||||
name = "Embed Frameworks";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
4B02265C224AB1490052362B /* RxMessagePortDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RxMessagePortDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
4B02265E224AB1490052362B /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
4B022660224AB1490052362B /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
4B022663224AB1490052362B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
|
||||
4B022665224AB1490052362B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
4B022659224AB1490052362B /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
4B7FBFD024EC8632002D12A1 /* RxSwift in Frameworks */,
|
||||
4B7FBFCD24EC8616002D12A1 /* RxPack in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
4B02263A224AB11A0052362B = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4B02265D224AB1490052362B /* RxMessagePortDemo */,
|
||||
4B022644224AB11A0052362B /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
4B022644224AB11A0052362B /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4B02265C224AB1490052362B /* RxMessagePortDemo.app */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
4B02265D224AB1490052362B /* RxMessagePortDemo */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4B02265E224AB1490052362B /* AppDelegate.swift */,
|
||||
4B022660224AB1490052362B /* Assets.xcassets */,
|
||||
4B022662224AB1490052362B /* MainMenu.xib */,
|
||||
4B022665224AB1490052362B /* Info.plist */,
|
||||
);
|
||||
path = RxMessagePortDemo;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
4B02265B224AB1490052362B /* RxMessagePortDemo */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 4B022667224AB1490052362B /* Build configuration list for PBXNativeTarget "RxMessagePortDemo" */;
|
||||
buildPhases = (
|
||||
4B022658224AB1490052362B /* Sources */,
|
||||
4B022659224AB1490052362B /* Frameworks */,
|
||||
4B02265A224AB1490052362B /* Resources */,
|
||||
4B022671224ACCE80052362B /* Embed Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = RxMessagePortDemo;
|
||||
packageProductDependencies = (
|
||||
4B7FBFCC24EC8616002D12A1 /* RxPack */,
|
||||
4B7FBFCF24EC8632002D12A1 /* RxSwift */,
|
||||
);
|
||||
productName = RxMessagePortDemo;
|
||||
productReference = 4B02265C224AB1490052362B /* RxMessagePortDemo.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
4B02263B224AB11A0052362B /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 1020;
|
||||
LastUpgradeCheck = 1340;
|
||||
ORGANIZATIONNAME = "Tae Won Ha";
|
||||
TargetAttributes = {
|
||||
4B02265B224AB1490052362B = {
|
||||
CreatedOnToolsVersion = 10.2;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 4B02263E224AB11A0052362B /* Build configuration list for PBXProject "RxPackSupport" */;
|
||||
compatibilityVersion = "Xcode 9.3";
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = 4B02263A224AB11A0052362B;
|
||||
packageReferences = (
|
||||
4B7FBFCE24EC8632002D12A1 /* XCRemoteSwiftPackageReference "RxSwift" */,
|
||||
);
|
||||
productRefGroup = 4B022644224AB11A0052362B /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
4B02265B224AB1490052362B /* RxMessagePortDemo */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
4B02265A224AB1490052362B /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
4B022661224AB1490052362B /* Assets.xcassets in Resources */,
|
||||
4B022664224AB1490052362B /* MainMenu.xib in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
4B022658224AB1490052362B /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
4B7FBFD124EC8851002D12A1 /* AppDelegate.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
4B022662224AB1490052362B /* MainMenu.xib */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
4B022663224AB1490052362B /* Base */,
|
||||
);
|
||||
name = MainMenu.xib;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
4B02264F224AB11A0052362B /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_IDENTITY = "-";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_DISABLE_SAFETY_CHECKS = YES;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
4B022650224AB11A0052362B /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_IDENTITY = "-";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = fast;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
MTL_FAST_MATH = YES;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_DISABLE_SAFETY_CHECKS = YES;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
4B022668224AB1490052362B /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/../Carthage/Build/Mac";
|
||||
INFOPLIST_FILE = RxMessagePortDemo/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.qvacua.RxMessagePortDemo;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
4B022669224AB1490052362B /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/../Carthage/Build/Mac";
|
||||
INFOPLIST_FILE = RxMessagePortDemo/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.qvacua.RxMessagePortDemo;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
4B02263E224AB11A0052362B /* Build configuration list for PBXProject "RxPackSupport" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
4B02264F224AB11A0052362B /* Debug */,
|
||||
4B022650224AB11A0052362B /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
4B022667224AB1490052362B /* Build configuration list for PBXNativeTarget "RxMessagePortDemo" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
4B022668224AB1490052362B /* Debug */,
|
||||
4B022669224AB1490052362B /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
|
||||
/* Begin XCRemoteSwiftPackageReference section */
|
||||
4B7FBFCE24EC8632002D12A1 /* XCRemoteSwiftPackageReference "RxSwift" */ = {
|
||||
isa = XCRemoteSwiftPackageReference;
|
||||
repositoryURL = "https://github.com/ReactiveX/RxSwift";
|
||||
requirement = {
|
||||
kind = upToNextMajorVersion;
|
||||
minimumVersion = 6.5.0;
|
||||
};
|
||||
};
|
||||
/* End XCRemoteSwiftPackageReference section */
|
||||
|
||||
/* Begin XCSwiftPackageProductDependency section */
|
||||
4B7FBFCC24EC8616002D12A1 /* RxPack */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
productName = RxPack;
|
||||
};
|
||||
4B7FBFCF24EC8632002D12A1 /* RxSwift */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = 4B7FBFCE24EC8632002D12A1 /* XCRemoteSwiftPackageReference "RxSwift" */;
|
||||
productName = RxSwift;
|
||||
};
|
||||
/* End XCSwiftPackageProductDependency section */
|
||||
};
|
||||
rootObject = 4B02263B224AB11A0052362B /* Project object */;
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
import XCTest
|
||||
|
||||
import RxPackTests
|
||||
|
||||
var tests = [XCTestCaseEntry]()
|
||||
tests += RxPackTests.allTests()
|
||||
XCTMain(tests)
|
@ -1,89 +0,0 @@
|
||||
/**
|
||||
* Tae Won Ha - http://taewon.de - @hataewon
|
||||
* See LICENSE
|
||||
*/
|
||||
|
||||
import RxSwift
|
||||
import XCTest
|
||||
|
||||
@testable import RxPack
|
||||
|
||||
class RxMsgpackRpcTests: XCTestCase {
|
||||
private var connection: RxMsgpackRpc!
|
||||
private let disposeBag = DisposeBag()
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
|
||||
// $ NVIM_LISTEN_ADDRESS=/tmp/nvim.sock nvim --headless $SOMEFILE
|
||||
self.connection = RxMsgpackRpc(queueQos: .default)
|
||||
self.connection.stream
|
||||
.subscribe(
|
||||
onNext: { msg in
|
||||
switch msg {
|
||||
case let .notification(method, params):
|
||||
print("NOTIFICATION: \(method): array of \(params.count) elements")
|
||||
case let .error(value, msg):
|
||||
print("ERROR: \(msg) with \(value)")
|
||||
default:
|
||||
print("???")
|
||||
}
|
||||
},
|
||||
onError: { print("ERROR: \($0)") },
|
||||
onCompleted: { print("COMPLETED!") }
|
||||
)
|
||||
.disposed(by: self.disposeBag)
|
||||
|
||||
_ = try? self.connection.run(at: "/tmp/nvim.sock").wait()
|
||||
// .andThen(self.connection.request(
|
||||
// method: "nvim_ui_attach",
|
||||
// params: [.int(40), .int(40), .map([:])],
|
||||
// expectsReturnValue: true
|
||||
// ))
|
||||
// .syncValue()
|
||||
}
|
||||
|
||||
override func tearDown() {
|
||||
super.tearDown()
|
||||
try? self.connection
|
||||
.request(
|
||||
method: "nvim_command", params: [.string("q!")],
|
||||
expectsReturnValue: false
|
||||
)
|
||||
.asCompletable()
|
||||
.wait()
|
||||
try? self.connection.stop().wait()
|
||||
}
|
||||
|
||||
func testExample() {
|
||||
let disposeBag = DisposeBag()
|
||||
|
||||
let lineCount = self.connection
|
||||
.request(
|
||||
method: "nvim_buf_line_count",
|
||||
params: [.int(0)],
|
||||
expectsReturnValue: true
|
||||
)
|
||||
.syncValue()
|
||||
print(lineCount ?? "???")
|
||||
|
||||
let formatter = DateFormatter()
|
||||
formatter.dateFormat = "mm:ss.SSS"
|
||||
for i in 0...100 {
|
||||
let date = Date()
|
||||
connection
|
||||
.request(
|
||||
method: "nvim_command_output",
|
||||
params: [.string("echo '\(i) \(formatter.string(from: date))'")],
|
||||
expectsReturnValue: true
|
||||
)
|
||||
.subscribe(
|
||||
onSuccess: { response in print(response) },
|
||||
onError: { error in print(error) }
|
||||
)
|
||||
.disposed(by: disposeBag)
|
||||
}
|
||||
|
||||
sleep(30)
|
||||
}
|
||||
}
|
@ -1,100 +0,0 @@
|
||||
/**
|
||||
* Tae Won Ha - http://taewon.de - @hataewon
|
||||
* See LICENSE
|
||||
*/
|
||||
|
||||
import MessagePack
|
||||
import RxSwift
|
||||
import XCTest
|
||||
|
||||
@testable import RxPack
|
||||
|
||||
class NvimMsgPackTests: XCTestCase {
|
||||
var nvim = RxNeovimApi()
|
||||
let disposeBag = DisposeBag()
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
|
||||
// $ NVIM_LISTEN_ADDRESS=/tmp/nvim.sock nvim $SOME_FILES
|
||||
try? self.nvim.run(at: "/tmp/nvim.sock").wait()
|
||||
}
|
||||
|
||||
override func tearDown() {
|
||||
super.tearDown()
|
||||
try? self.nvim
|
||||
.command(command: "q!")
|
||||
.wait()
|
||||
try? self.nvim.stop().wait()
|
||||
}
|
||||
|
||||
func testSth() {
|
||||
let colorNames = [
|
||||
"Normal", // color and background-color
|
||||
"Directory", // a
|
||||
"StatusLine", // code background and foreground
|
||||
"NonText", // hr and block quote border
|
||||
"Question", // blockquote foreground
|
||||
]
|
||||
|
||||
typealias HlResult = [String: RxNeovimApi.Value]
|
||||
typealias ColorNameHlResultTuple = (colorName: String, hlResult: HlResult)
|
||||
typealias ColorNameObservableTuple = (colorName: String, observable: Observable<HlResult>)
|
||||
|
||||
Observable
|
||||
.from(colorNames.map { colorName -> ColorNameObservableTuple in
|
||||
(
|
||||
colorName: colorName,
|
||||
observable: self.nvim
|
||||
.getHlByName(name: colorName, rgb: true)
|
||||
.asObservable()
|
||||
)
|
||||
})
|
||||
.flatMap { tuple -> Observable<(String, HlResult)> in
|
||||
Observable.zip(Observable.just(tuple.colorName), tuple.observable)
|
||||
}
|
||||
.subscribe(onNext: { (tuple: ColorNameHlResultTuple) in
|
||||
print(tuple)
|
||||
})
|
||||
.disposed(by: self.disposeBag)
|
||||
|
||||
// Observable
|
||||
// .concat(colorNames.map { colorName in
|
||||
// self.nvim
|
||||
// .getHlByName(name: colorName, rgb: true)
|
||||
// .asObservable()
|
||||
// })
|
||||
// .enumerated()
|
||||
// .subscribe(onNext: { dict in print(dict) })
|
||||
// .disposed(by: self.disposeBag)
|
||||
|
||||
// self.nvim
|
||||
// .getHlByName(name: "Normal", rgb: true)
|
||||
// .subscribe(onSuccess: { dict in
|
||||
// guard let f = dict["foreground"]?.uint64Value,
|
||||
// let b = dict["background"]?.uint64Value else { return }
|
||||
// print(String(format: "%06X %06X", f, b))
|
||||
// }, onError: { err in print(err) })
|
||||
// .disposed(by: self.disposeBag)
|
||||
|
||||
sleep(1)
|
||||
}
|
||||
|
||||
func testExample() {
|
||||
let formatter = DateFormatter()
|
||||
formatter.dateStyle = .short
|
||||
formatter.timeStyle = .full
|
||||
let now = Date()
|
||||
let dispose = DisposeBag()
|
||||
for i in 0...5 {
|
||||
self.nvim
|
||||
.command(
|
||||
command: "echo '\(formatter.string(from: now)) \(i)'"
|
||||
)
|
||||
.subscribe(onCompleted: { print("\(i) handled") })
|
||||
.disposed(by: dispose)
|
||||
}
|
||||
|
||||
sleep(1)
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
import XCTest
|
||||
|
||||
#if !canImport(ObjectiveC)
|
||||
public func allTests() -> [XCTestCaseEntry] {
|
||||
[
|
||||
testCase(RxPackTests.allTests),
|
||||
]
|
||||
}
|
||||
#endif
|
@ -1,431 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import subprocess
|
||||
|
||||
import msgpack
|
||||
from string import Template
|
||||
import re
|
||||
import textwrap
|
||||
import os
|
||||
import io
|
||||
|
||||
|
||||
void_func_template = Template('''\
|
||||
public func ${func_name}(${args}
|
||||
expectsReturnValue: Bool = false
|
||||
) -> Completable {
|
||||
|
||||
let params: [RxNeovimApi.Value] = [
|
||||
${params}
|
||||
]
|
||||
|
||||
if expectsReturnValue {
|
||||
return self
|
||||
.checkBlocked(
|
||||
self.rpc(method: "${nvim_func_name}", params: params, expectsReturnValue: expectsReturnValue)
|
||||
)
|
||||
.asCompletable()
|
||||
}
|
||||
|
||||
return self
|
||||
.rpc(method: "${nvim_func_name}", params: params, expectsReturnValue: expectsReturnValue)
|
||||
.asCompletable()
|
||||
}
|
||||
''')
|
||||
|
||||
get_mode_func_template = Template('''\
|
||||
public func ${func_name}(${args}
|
||||
) -> Single<${result_type}> {
|
||||
|
||||
let params: [RxNeovimApi.Value] = [
|
||||
${params}
|
||||
]
|
||||
return self
|
||||
.rpc(method: "${nvim_func_name}", params: params, expectsReturnValue: true)
|
||||
.map { value in
|
||||
guard let result = (${return_value}) else {
|
||||
throw RxNeovimApi.Error.conversion(type: ${result_type}.self)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
}
|
||||
''')
|
||||
|
||||
func_template = Template('''\
|
||||
public func ${func_name}(${args}
|
||||
errWhenBlocked: Bool = true
|
||||
) -> Single<${result_type}> {
|
||||
|
||||
let params: [RxNeovimApi.Value] = [
|
||||
${params}
|
||||
]
|
||||
|
||||
func transform(_ value: Value) throws -> ${result_type} {
|
||||
guard let result = (${return_value}) else {
|
||||
throw RxNeovimApi.Error.conversion(type: ${result_type}.self)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
if errWhenBlocked {
|
||||
return self
|
||||
.checkBlocked(
|
||||
self.rpc(method: "${nvim_func_name}", params: params, expectsReturnValue: true)
|
||||
)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
return self
|
||||
.rpc(method: "${nvim_func_name}", params: params, expectsReturnValue: true)
|
||||
.map(transform)
|
||||
}
|
||||
''')
|
||||
|
||||
extension_template = Template('''\
|
||||
// Auto generated for nvim version ${version}.
|
||||
// See bin/generate_api_methods.py
|
||||
|
||||
import Foundation
|
||||
import MessagePack
|
||||
import RxSwift
|
||||
|
||||
extension RxNeovimApi {
|
||||
|
||||
public enum Error: Swift.Error {
|
||||
|
||||
${error_types}
|
||||
|
||||
case exception(message: String)
|
||||
case validation(message: String)
|
||||
case blocked
|
||||
case conversion(type: Any.Type)
|
||||
case unknown
|
||||
|
||||
init(_ value: RxNeovimApi.Value?) {
|
||||
let array = value?.arrayValue
|
||||
guard array?.count == 2 else {
|
||||
self = .unknown
|
||||
return
|
||||
}
|
||||
|
||||
guard let rawValue = array?[0].uint64Value, let message = array?[1].stringValue else {
|
||||
self = .unknown
|
||||
return
|
||||
}
|
||||
|
||||
switch rawValue {
|
||||
${error_cases}
|
||||
default: self = .unknown
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension RxNeovimApi {
|
||||
|
||||
$body
|
||||
}
|
||||
|
||||
extension RxNeovimApi.Buffer {
|
||||
|
||||
public init?(_ value: RxNeovimApi.Value) {
|
||||
guard let (type, data) = value.extendedValue else {
|
||||
return nil
|
||||
}
|
||||
|
||||
guard type == ${buffer_type} else {
|
||||
return nil
|
||||
}
|
||||
|
||||
guard let handle = (try? unpack(data))?.value.int64Value else {
|
||||
return nil
|
||||
}
|
||||
|
||||
self.handle = Int(handle)
|
||||
}
|
||||
}
|
||||
|
||||
extension RxNeovimApi.Window {
|
||||
|
||||
public init?(_ value: RxNeovimApi.Value) {
|
||||
guard let (type, data) = value.extendedValue else {
|
||||
return nil
|
||||
}
|
||||
|
||||
guard type == ${window_type} else {
|
||||
return nil
|
||||
}
|
||||
|
||||
guard let handle = (try? unpack(data))?.value.int64Value else {
|
||||
return nil
|
||||
}
|
||||
|
||||
self.handle = Int(handle)
|
||||
}
|
||||
}
|
||||
|
||||
extension RxNeovimApi.Tabpage {
|
||||
|
||||
public init?(_ value: RxNeovimApi.Value) {
|
||||
guard let (type, data) = value.extendedValue else {
|
||||
return nil
|
||||
}
|
||||
|
||||
guard type == ${tabpage_type} else {
|
||||
return nil
|
||||
}
|
||||
|
||||
guard let handle = (try? unpack(data))?.value.int64Value else {
|
||||
return nil
|
||||
}
|
||||
|
||||
self.handle = Int(handle)
|
||||
}
|
||||
}
|
||||
|
||||
fileprivate func msgPackDictToSwift(_ dict: Dictionary<RxNeovimApi.Value, RxNeovimApi.Value>?) -> Dictionary<String, RxNeovimApi.Value>? {
|
||||
return dict?.compactMapToDict { k, v in
|
||||
guard let strKey = k.stringValue else {
|
||||
return nil
|
||||
}
|
||||
|
||||
return (strKey, v)
|
||||
}
|
||||
}
|
||||
|
||||
fileprivate func msgPackArrayDictToSwift(_ array: [RxNeovimApi.Value]?) -> [Dictionary<String, RxNeovimApi.Value>]? {
|
||||
return array?
|
||||
.compactMap { v in v.dictionaryValue }
|
||||
.compactMap { d in msgPackDictToSwift(d) }
|
||||
}
|
||||
|
||||
extension Dictionary {
|
||||
|
||||
fileprivate func mapToDict<K, V>(_ transform: ((key: Key, value: Value)) throws -> (K, V)) rethrows -> Dictionary<K, V> {
|
||||
let array = try self.map(transform)
|
||||
return tuplesToDict(array)
|
||||
}
|
||||
|
||||
fileprivate func compactMapToDict<K, V>(_ transform: ((key: Key, value: Value)) throws -> (K, V)?) rethrows -> Dictionary<K, V> {
|
||||
let array = try self.compactMap(transform)
|
||||
return tuplesToDict(array)
|
||||
}
|
||||
|
||||
fileprivate func tuplesToDict<K:Hashable, V, S:Sequence>(_ sequence: S)
|
||||
-> Dictionary<K, V> where S.Iterator.Element == (K, V) {
|
||||
|
||||
var result = Dictionary<K, V>(minimumCapacity: sequence.underestimatedCount)
|
||||
|
||||
for (key, value) in sequence {
|
||||
result[key] = value
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
}
|
||||
''')
|
||||
|
||||
|
||||
def snake_to_camel(snake_str):
|
||||
components = snake_str.split('_')
|
||||
return components[0] + "".join(x.title() for x in components[1:])
|
||||
|
||||
|
||||
def nvim_type_to_swift(nvim_type):
|
||||
if nvim_type == 'Boolean':
|
||||
return 'Bool'
|
||||
|
||||
if nvim_type == 'Integer':
|
||||
return 'Int'
|
||||
|
||||
if nvim_type == 'Float':
|
||||
return nvim_type
|
||||
|
||||
if nvim_type == 'void':
|
||||
return 'Void'
|
||||
|
||||
if nvim_type == 'String':
|
||||
return 'String'
|
||||
|
||||
if nvim_type == 'Array':
|
||||
return 'RxNeovimApi.Value'
|
||||
|
||||
if nvim_type == 'Dictionary':
|
||||
return 'Dictionary<String, RxNeovimApi.Value>'
|
||||
|
||||
if nvim_type == 'Buffer':
|
||||
return 'RxNeovimApi.Buffer'
|
||||
|
||||
if nvim_type == 'Window':
|
||||
return 'RxNeovimApi.Window'
|
||||
|
||||
if nvim_type == 'Tabpage':
|
||||
return 'RxNeovimApi.Tabpage'
|
||||
|
||||
if nvim_type == 'Object':
|
||||
return 'RxNeovimApi.Value'
|
||||
|
||||
if nvim_type.startswith('ArrayOf('):
|
||||
match = re.match(r'ArrayOf\((.*?)(?:, \d+)*\)', nvim_type)
|
||||
return '[{}]'.format(nvim_type_to_swift(match.group(1)))
|
||||
|
||||
return 'RxNeovimApi.Value'
|
||||
|
||||
|
||||
def msgpack_to_swift(msgpack_value_name, type):
|
||||
if type == 'Bool':
|
||||
return f'{msgpack_value_name}.boolValue'
|
||||
|
||||
if type == 'Int':
|
||||
return f'({msgpack_value_name}.int64Value == nil ? nil : Int({msgpack_value_name}.int64Value!))'
|
||||
|
||||
if type == 'Float':
|
||||
return f'{msgpack_value_name}.floatValue'
|
||||
|
||||
if type == 'Void':
|
||||
return f'()'
|
||||
|
||||
if type == 'String':
|
||||
return f'{msgpack_value_name}.stringValue'
|
||||
|
||||
if type == 'RxNeovimApi.Value':
|
||||
return f'Optional({msgpack_value_name})'
|
||||
|
||||
if type in 'RxNeovimApi.Buffer':
|
||||
return f'RxNeovimApi.Buffer({msgpack_value_name})'
|
||||
|
||||
if type in 'RxNeovimApi.Window':
|
||||
return f'RxNeovimApi.Window({msgpack_value_name})'
|
||||
|
||||
if type in 'RxNeovimApi.Tabpage':
|
||||
return f'RxNeovimApi.Tabpage({msgpack_value_name})'
|
||||
|
||||
if type.startswith('Dictionary<'):
|
||||
return f'msgPackDictToSwift({msgpack_value_name}.dictionaryValue)'
|
||||
|
||||
if type.startswith('[Dictionary<'):
|
||||
return f'msgPackArrayDictToSwift({msgpack_value_name}.arrayValue)'
|
||||
|
||||
if type.startswith('['):
|
||||
element_type = re.match(r'\[(.*)\]', type).group(1)
|
||||
return f'{msgpack_value_name}.arrayValue?.compactMap({{ v in {msgpack_to_swift("v", element_type)} }})'
|
||||
|
||||
return 'RxNeovimApi.Value'
|
||||
|
||||
|
||||
def swift_to_msgpack_value(name, type):
|
||||
if type == 'Bool':
|
||||
return f'.bool({name})'
|
||||
|
||||
if type == 'Int':
|
||||
return f'.int(Int64({name}))'
|
||||
|
||||
if type == 'Float':
|
||||
return f'.float({name})'
|
||||
|
||||
if type == 'Void':
|
||||
return f'.nil()'
|
||||
|
||||
if type == 'String':
|
||||
return f'.string({name})'
|
||||
|
||||
if type == 'Dictionary<String, RxNeovimApi.Value>':
|
||||
return f'.map({name}.mapToDict({{ (Value.string($0), $1) }}))'
|
||||
|
||||
if type == 'RxNeovimApi.Value':
|
||||
return name
|
||||
|
||||
if type in ['RxNeovimApi.Buffer', 'RxNeovimApi.Window', 'RxNeovimApi.Tabpage']:
|
||||
return f'.int(Int64({name}.handle))'
|
||||
|
||||
if type.startswith('['):
|
||||
match = re.match(r'\[(.*)\]', type)
|
||||
test = '$0'
|
||||
return f'.array({name}.map {{ {swift_to_msgpack_value(test, match.group(1))} }})'
|
||||
|
||||
|
||||
def parse_args(raw_params):
|
||||
types = [nvim_type_to_swift(p[0]) for p in raw_params]
|
||||
names = [p[1] for p in raw_params]
|
||||
params = dict(zip(names, types))
|
||||
|
||||
result = '\n'.join([n + ': ' + t + ',' for n, t in params.items()])
|
||||
if not result:
|
||||
return ''
|
||||
|
||||
return '\n' + textwrap.indent(result, ' ')
|
||||
|
||||
|
||||
def parse_params(raw_params):
|
||||
types = [nvim_type_to_swift(p[0]) for p in raw_params]
|
||||
names = [p[1] for p in raw_params]
|
||||
params = dict(zip(names, types))
|
||||
|
||||
result = '\n'.join([swift_to_msgpack_value(n, t) + ',' for n, t in params.items()])
|
||||
return textwrap.indent(result, ' ').strip()
|
||||
|
||||
|
||||
def parse_function(f):
|
||||
args = parse_args(f['parameters'])
|
||||
template = void_func_template if f['return_type'] == 'void' else func_template
|
||||
template = get_mode_func_template if f['name'] == 'nvim_get_mode' else template
|
||||
result = template.substitute(
|
||||
func_name=snake_to_camel(f['name'][5:]),
|
||||
nvim_func_name=f['name'],
|
||||
args=args,
|
||||
params=parse_params(f['parameters']),
|
||||
result_type=nvim_type_to_swift(f['return_type']),
|
||||
return_value=msgpack_to_swift('value', nvim_type_to_swift(f['return_type']))
|
||||
)
|
||||
|
||||
return result
|
||||
|
||||
|
||||
def parse_version(version):
|
||||
return '.'.join([str(v) for v in [version['major'], version['minor'], version['patch']]])
|
||||
|
||||
|
||||
def parse_error_types(error_types):
|
||||
return textwrap.indent(
|
||||
'\n'.join(
|
||||
[f'public static let {t.lower()}RawValue = UInt64({v["id"]})' for t, v in error_types.items()]
|
||||
),
|
||||
' '
|
||||
).lstrip()
|
||||
|
||||
|
||||
def parse_error_cases(error_types):
|
||||
return textwrap.indent(
|
||||
'\n'.join(
|
||||
[f'case Error.{t.lower()}RawValue: self = .{t.lower()}(message: message)' for t, v in error_types.items()]
|
||||
),
|
||||
' '
|
||||
).lstrip()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
result_file_path = './Sources/RxPack/RxNeovimApi.generated.swift'
|
||||
|
||||
nvim_path = os.environ['NVIM_PATH'] if 'NVIM_PATH' in os.environ else 'nvim'
|
||||
|
||||
nvim_output = subprocess.run([nvim_path, '--api-info'], stdout=subprocess.PIPE)
|
||||
api = msgpack.unpackb(nvim_output.stdout)
|
||||
|
||||
version = parse_version(api['version'])
|
||||
functions = [f for f in api['functions'] if 'deprecated_since' not in f]
|
||||
body = '\n'.join([parse_function(f) for f in functions])
|
||||
|
||||
result = extension_template.substitute(
|
||||
body=body,
|
||||
version=version,
|
||||
error_types=parse_error_types(api['error_types']),
|
||||
error_cases=parse_error_cases(api['error_types']),
|
||||
buffer_type=api['types']['Buffer']['id'],
|
||||
window_type=api['types']['Window']['id'],
|
||||
tabpage_type=api['types']['Tabpage']['id']
|
||||
)
|
||||
|
||||
with io.open(result_file_path, 'w') as api_methods_file:
|
||||
api_methods_file.write(result)
|
@ -1,47 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Executing this script will replace the download step of pre-built NvimServer.
|
||||
set -Eeuo pipefail
|
||||
BUILD_DIR=".deps"
|
||||
|
||||
pushd "$(dirname "${BASH_SOURCE[0]}")/.." >/dev/null
|
||||
|
||||
mkdir -p ${BUILD_DIR}
|
||||
|
||||
target_version=$(cat ./nvim-version.txt | awk '{$1=$1}1')
|
||||
nvim="./${BUILD_DIR}/nvim-osx64/bin/nvim"
|
||||
if [[ -f ${nvim} ]] ; then
|
||||
version="$($nvim --version | grep ^NVIM | awk '{print $2}')" || "n/a"
|
||||
else
|
||||
version="n/a"
|
||||
fi
|
||||
|
||||
echo "Downloaded version: $version"
|
||||
echo "Target version: $target_version"
|
||||
|
||||
download=false
|
||||
if [[ "$target_version" == "nightly" ]]; then
|
||||
echo "Target version is nightly => Downloading..."
|
||||
download=true
|
||||
else
|
||||
if ! [[ "$version" =~ "$target_version".* ]]; then
|
||||
echo "Target version differs from the downloaded version => Downloading..."
|
||||
download=true
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "$download" == true ]]; then
|
||||
curl -L -o ./${BUILD_DIR}/nvim-macos.tar.gz "https://github.com/neovim/neovim/releases/download/$target_version/nvim-macos.tar.gz"
|
||||
echo "Downloaded $target_version"
|
||||
pushd ./${BUILD_DIR}
|
||||
tar xf nvim-macos.tar.gz
|
||||
popd
|
||||
echo "Extracted $target_version"
|
||||
else
|
||||
echo "No download necessary"
|
||||
fi
|
||||
|
||||
echo "Generating sources..."
|
||||
NVIM_PATH="$nvim" ./bin/generate_api_methods.py
|
||||
|
||||
popd >/dev/null
|
||||
echo "Generated sources"
|
@ -1 +0,0 @@
|
||||
nightly
|
@ -1,7 +0,0 @@
|
||||
import XCTest
|
||||
|
||||
import TabsTests
|
||||
|
||||
var tests = [XCTestCaseEntry]()
|
||||
tests += TabsTests.allTests()
|
||||
XCTMain(tests)
|
@ -1,9 +0,0 @@
|
||||
import XCTest
|
||||
|
||||
#if !canImport(ObjectiveC)
|
||||
public func allTests() -> [XCTestCaseEntry] {
|
||||
[
|
||||
testCase(TabsTests.allTests),
|
||||
]
|
||||
}
|
||||
#endif
|
6
VimR.xcworkspace/contents.xcworkspacedata
generated
6
VimR.xcworkspace/contents.xcworkspacedata
generated
@ -13,9 +13,6 @@
|
||||
<FileRef
|
||||
location = "group:Tabs">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:RxPack">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:NvimServer">
|
||||
</FileRef>
|
||||
@ -28,9 +25,6 @@
|
||||
<FileRef
|
||||
location = "group:Tabs/Support/TabsSupport.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:RxPack/Support/RxPackSupport.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:NvimView/Support/NvimViewSupport.xcodeproj">
|
||||
</FileRef>
|
||||
|
@ -99,6 +99,15 @@
|
||||
"version" : "3.1.9"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "rxpack.swift",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/qvacua/RxPack.swift",
|
||||
"state" : {
|
||||
"revision" : "c47c1a1bf33f6f8380bc74fb788d9b5554c09f93",
|
||||
"version" : "0.1.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "rxswift",
|
||||
"kind" : "remoteSourceControl",
|
||||
|
@ -62,10 +62,10 @@
|
||||
1929BCC9D3604933DFF07E2E /* FileBrowser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929BA5C7099CDEB04B76BA4 /* FileBrowser.swift */; };
|
||||
1929BCF7F7B9CC5499A3F506 /* AdvancedPrefReducer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B7039C5689CE45F53888 /* AdvancedPrefReducer.swift */; };
|
||||
1929BD3878A3A47B8D685CD2 /* AppDelegateReducer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B7A68B7109CEFAF105E8 /* AppDelegateReducer.swift */; };
|
||||
1929BDFDBDA7180D02ACB37E /* RxSwiftCommonsTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B6C215ACCBE12672A8D7 /* RxSwiftCommonsTest.swift */; };
|
||||
1929BE0DAEE9664C5BCFA211 /* States.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929BB6608B4F0E037CA0F4C /* States.swift */; };
|
||||
1929BE0F64A6CE5BCE2A5092 /* MainWindow+Delegates.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B714EB137AE448CE8ABD /* MainWindow+Delegates.swift */; };
|
||||
1929BE2F3E0182CC51F2763A /* ThemedTableSubviews.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929BD2CA8DD198A6BCDBCB7 /* ThemedTableSubviews.swift */; };
|
||||
1929BE511088E082529199CB /* IgnoreServiceTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B07A72CA7CCA31337713 /* IgnoreServiceTest.swift */; };
|
||||
1929BEAE0592096BC1191B67 /* PrefPane.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B07A4A9209C88380E015 /* PrefPane.swift */; };
|
||||
1929BEDE1BE950EDA9497363 /* GeneralPref.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929BB55946DAEBF55D24048 /* GeneralPref.swift */; };
|
||||
1929BF03FD6465F289AA80B2 /* ToolsPref.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929BB2AD21A10A0ECA66A5E /* ToolsPref.swift */; };
|
||||
@ -159,7 +159,14 @@
|
||||
4BADD55B283A847100C6B16D /* Ignore in Frameworks */ = {isa = PBXBuildFile; productRef = 4BADD55A283A847100C6B16D /* Ignore */; };
|
||||
4BADD55E283ABD0200C6B16D /* OrderedCollections in Frameworks */ = {isa = PBXBuildFile; productRef = 4BADD55D283ABD0200C6B16D /* OrderedCollections */; };
|
||||
4BB409E51DD68CCC005F39A2 /* FileBrowserMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4BB409E71DD68CCC005F39A2 /* FileBrowserMenu.xib */; };
|
||||
4BCB697F285DD4C400BDD358 /* RxPack in Frameworks */ = {isa = PBXBuildFile; productRef = 4BCB697E285DD4C400BDD358 /* RxPack */; };
|
||||
4BDF50171D77540900D8FBC3 /* OpenQuicklyWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4BDF50191D77540900D8FBC3 /* OpenQuicklyWindow.xib */; };
|
||||
4BE73F99285C9A9A00B63585 /* IgnoreService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B71F6A82A34F16BB52BE /* IgnoreService.swift */; };
|
||||
4BE73F9B285C9AC100B63585 /* Ignore in Frameworks */ = {isa = PBXBuildFile; productRef = 4BE73F9A285C9AC100B63585 /* Ignore */; };
|
||||
4BE73F9D285C9AD600B63585 /* OrderedCollections in Frameworks */ = {isa = PBXBuildFile; productRef = 4BE73F9C285C9AD600B63585 /* OrderedCollections */; };
|
||||
4BE73FA2285C9C6C00B63585 /* FoundationCommons.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B9AF20D7BD6E5C975128 /* FoundationCommons.swift */; };
|
||||
4BE73FA4285C9C7700B63585 /* Commons in Frameworks */ = {isa = PBXBuildFile; productRef = 4BE73FA3285C9C7700B63585 /* Commons */; };
|
||||
4BE73FA6285CA9D100B63585 /* Resources in Resources */ = {isa = PBXBuildFile; fileRef = 4BE73FA5285CA9D100B63585 /* Resources */; };
|
||||
4BEBA5091CFF374B00673FDF /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BEBA5081CFF374B00673FDF /* AppDelegate.swift */; };
|
||||
4BEBA50B1CFF374B00673FDF /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4BEBA50A1CFF374B00673FDF /* Assets.xcassets */; };
|
||||
4BEBA50E1CFF374B00673FDF /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4BEBA50C1CFF374B00673FDF /* MainMenu.xib */; };
|
||||
@ -170,7 +177,7 @@
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
4BEBA5151CFF374B00673FDF /* PBXContainerItemProxy */ = {
|
||||
4BE73F9E285C9C4500B63585 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 4BEBA4FD1CFF374B00673FDF /* Project object */;
|
||||
proxyType = 1;
|
||||
@ -194,6 +201,7 @@
|
||||
/* Begin PBXFileReference section */
|
||||
1929B067B3247675BCD09218 /* MainWindow+Actions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "MainWindow+Actions.swift"; sourceTree = "<group>"; };
|
||||
1929B07A4A9209C88380E015 /* PrefPane.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PrefPane.swift; sourceTree = "<group>"; };
|
||||
1929B07A72CA7CCA31337713 /* IgnoreServiceTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IgnoreServiceTest.swift; sourceTree = "<group>"; };
|
||||
1929B07F0085B7AE10413346 /* ShortcutsTableSubviews.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ShortcutsTableSubviews.swift; sourceTree = "<group>"; };
|
||||
1929B0E9B2F018D3E31D4B0B /* ShortcutsPref.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ShortcutsPref.swift; sourceTree = "<group>"; };
|
||||
1929B0EB3F49C42A57D083AF /* GeneralPrefReducer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneralPrefReducer.swift; sourceTree = "<group>"; };
|
||||
@ -216,7 +224,6 @@
|
||||
1929B67A10E6BB2986B2416E /* BufferListReducer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BufferListReducer.swift; sourceTree = "<group>"; };
|
||||
1929B694508FB5FDE607513A /* ToolsPrefReducer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ToolsPrefReducer.swift; sourceTree = "<group>"; };
|
||||
1929B6AD3396160AA2C46919 /* Debouncer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Debouncer.swift; sourceTree = "<group>"; };
|
||||
1929B6C215ACCBE12672A8D7 /* RxSwiftCommonsTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxSwiftCommonsTest.swift; sourceTree = "<group>"; };
|
||||
1929B6C6C7792B05164B0216 /* MarkdownTool.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MarkdownTool.swift; sourceTree = "<group>"; };
|
||||
1929B6E01216D49BB9F3B6A3 /* MainWindow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MainWindow.swift; sourceTree = "<group>"; };
|
||||
1929B7039C5689CE45F53888 /* AdvancedPrefReducer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AdvancedPrefReducer.swift; sourceTree = "<group>"; };
|
||||
@ -328,6 +335,7 @@
|
||||
4B97E2CD1D33F53D00FC0660 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainWindow.xib; sourceTree = "<group>"; };
|
||||
4BB409E61DD68CCC005F39A2 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/FileBrowserMenu.xib; sourceTree = "<group>"; };
|
||||
4BDF50181D77540900D8FBC3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/OpenQuicklyWindow.xib; sourceTree = "<group>"; };
|
||||
4BE73FA5285CA9D100B63585 /* Resources */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Resources; sourceTree = "<group>"; };
|
||||
4BEBA5051CFF374B00673FDF /* VimR-dev.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "VimR-dev.app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
4BEBA5081CFF374B00673FDF /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
4BEBA50A1CFF374B00673FDF /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
@ -348,6 +356,7 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
4BA19812285B4BA600B49309 /* Misc in Frameworks */,
|
||||
4BCB697F285DD4C400BDD358 /* RxPack in Frameworks */,
|
||||
4B0B362A2595236000B06899 /* ShortcutRecorder in Frameworks */,
|
||||
4B0B36242595236000B06899 /* EonilFSEvents in Frameworks */,
|
||||
4B9D049D273481AD007E8614 /* Down in Frameworks */,
|
||||
@ -372,7 +381,10 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
4BE73FA4285C9C7700B63585 /* Commons in Frameworks */,
|
||||
4BE73F9B285C9AC100B63585 /* Ignore in Frameworks */,
|
||||
4B0B36312595236000B06899 /* RxTest in Frameworks */,
|
||||
4BE73F9D285C9AD600B63585 /* OrderedCollections in Frameworks */,
|
||||
4B0B36302595236000B06899 /* Nimble in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@ -434,14 +446,6 @@
|
||||
name = Reducers;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1929B79B3F03D2E050438074 /* Commons */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1929B6C215ACCBE12672A8D7 /* RxSwiftCommonsTest.swift */,
|
||||
);
|
||||
name = Commons;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1929BA652D3B88FC071531EC /* UI */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@ -681,8 +685,9 @@
|
||||
4BEBA5171CFF374B00673FDF /* VimRTests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4BE73FA5285CA9D100B63585 /* Resources */,
|
||||
4BEBA51A1CFF374B00673FDF /* Info.plist */,
|
||||
1929B79B3F03D2E050438074 /* Commons */,
|
||||
1929B07A72CA7CCA31337713 /* IgnoreServiceTest.swift */,
|
||||
);
|
||||
path = VimRTests;
|
||||
sourceTree = "<group>";
|
||||
@ -748,6 +753,7 @@
|
||||
4BADD55A283A847100C6B16D /* Ignore */,
|
||||
4BADD55D283ABD0200C6B16D /* OrderedCollections */,
|
||||
4BA19811285B4BA600B49309 /* Misc */,
|
||||
4BCB697E285DD4C400BDD358 /* RxPack */,
|
||||
);
|
||||
productName = VimR;
|
||||
productReference = 4BEBA5051CFF374B00673FDF /* VimR-dev.app */;
|
||||
@ -765,12 +771,15 @@
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
4BEBA5161CFF374B00673FDF /* PBXTargetDependency */,
|
||||
4BE73F9F285C9C4500B63585 /* PBXTargetDependency */,
|
||||
);
|
||||
name = VimRTests;
|
||||
packageProductDependencies = (
|
||||
4BD67CDB24EE45E900147C51 /* Nimble */,
|
||||
4BD67CDF24EE465B00147C51 /* RxTest */,
|
||||
4BE73F9A285C9AC100B63585 /* Ignore */,
|
||||
4BE73F9C285C9AD600B63585 /* OrderedCollections */,
|
||||
4BE73FA3285C9C7700B63585 /* Commons */,
|
||||
);
|
||||
productName = VimRTests;
|
||||
productReference = 4BEBA5141CFF374B00673FDF /* VimRTests.xctest */;
|
||||
@ -821,6 +830,7 @@
|
||||
4B9D049B273481AD007E8614 /* XCRemoteSwiftPackageReference "Down" */,
|
||||
4BADD55C283ABD0200C6B16D /* XCRemoteSwiftPackageReference "swift-collections" */,
|
||||
4BA19810285B4BA600B49309 /* XCRemoteSwiftPackageReference "misc" */,
|
||||
4BCB697D285DD4C400BDD358 /* XCRemoteSwiftPackageReference "RxPack" */,
|
||||
);
|
||||
productRefGroup = 4BEBA5061CFF374B00673FDF /* Products */;
|
||||
projectDirPath = "";
|
||||
@ -914,6 +924,7 @@
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
4BE73FA6285CA9D100B63585 /* Resources in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@ -1016,17 +1027,19 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
1929BDFDBDA7180D02ACB37E /* RxSwiftCommonsTest.swift in Sources */,
|
||||
4BE73FA2285C9C6C00B63585 /* FoundationCommons.swift in Sources */,
|
||||
4BE73F99285C9A9A00B63585 /* IgnoreService.swift in Sources */,
|
||||
1929BE511088E082529199CB /* IgnoreServiceTest.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
4BEBA5161CFF374B00673FDF /* PBXTargetDependency */ = {
|
||||
4BE73F9F285C9C4500B63585 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 4BEBA5041CFF374B00673FDF /* VimR */;
|
||||
targetProxy = 4BEBA5151CFF374B00673FDF /* PBXContainerItemProxy */;
|
||||
targetProxy = 4BE73F9E285C9C4500B63585 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
@ -1246,11 +1259,6 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/../Carthage/Build/Mac",
|
||||
);
|
||||
HEADER_SEARCH_PATHS = "$(PROJECT_DIR)/../third-party/vimr-deps/include";
|
||||
INFOPLIST_FILE = VimRTests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
@ -1259,7 +1267,6 @@
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.qvacua.VimRTests;
|
||||
PRODUCT_NAME = VimRTests;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = VimR/Bridge.h;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@ -1267,11 +1274,6 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/../Carthage/Build/Mac",
|
||||
);
|
||||
HEADER_SEARCH_PATHS = "$(PROJECT_DIR)/../third-party/vimr-deps/include";
|
||||
INFOPLIST_FILE = VimRTests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
@ -1280,7 +1282,6 @@
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.qvacua.VimRTests;
|
||||
PRODUCT_NAME = VimRTests;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = VimR/Bridge.h;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
@ -1381,6 +1382,14 @@
|
||||
minimumVersion = 1.0.0;
|
||||
};
|
||||
};
|
||||
4BCB697D285DD4C400BDD358 /* XCRemoteSwiftPackageReference "RxPack" */ = {
|
||||
isa = XCRemoteSwiftPackageReference;
|
||||
repositoryURL = "https://github.com/qvacua/RxPack.swift";
|
||||
requirement = {
|
||||
kind = exactVersion;
|
||||
version = 0.1.0;
|
||||
};
|
||||
};
|
||||
4BD5655124E8014100D52809 /* XCRemoteSwiftPackageReference "swifter" */ = {
|
||||
isa = XCRemoteSwiftPackageReference;
|
||||
repositoryURL = "https://github.com/httpswift/swifter";
|
||||
@ -1486,6 +1495,11 @@
|
||||
package = 4BADD55C283ABD0200C6B16D /* XCRemoteSwiftPackageReference "swift-collections" */;
|
||||
productName = OrderedCollections;
|
||||
};
|
||||
4BCB697E285DD4C400BDD358 /* RxPack */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = 4BCB697D285DD4C400BDD358 /* XCRemoteSwiftPackageReference "RxPack" */;
|
||||
productName = RxPack;
|
||||
};
|
||||
4BD5655224E8014100D52809 /* Swifter */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = 4BD5655124E8014100D52809 /* XCRemoteSwiftPackageReference "swifter" */;
|
||||
@ -1520,6 +1534,19 @@
|
||||
package = 4B9BC41F24EB2E45000209B5 /* XCRemoteSwiftPackageReference "RxSwift" */;
|
||||
productName = RxTest;
|
||||
};
|
||||
4BE73F9A285C9AC100B63585 /* Ignore */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
productName = Ignore;
|
||||
};
|
||||
4BE73F9C285C9AD600B63585 /* OrderedCollections */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = 4BADD55C283ABD0200C6B16D /* XCRemoteSwiftPackageReference "swift-collections" */;
|
||||
productName = OrderedCollections;
|
||||
};
|
||||
4BE73FA3285C9C7700B63585 /* Commons */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
productName = Commons;
|
||||
};
|
||||
/* End XCSwiftPackageProductDependency section */
|
||||
};
|
||||
rootObject = 4BEBA4FD1CFF374B00673FDF /* Project object */;
|
||||
|
@ -32,8 +32,6 @@ class FuzzySearchService {
|
||||
}
|
||||
}
|
||||
|
||||
let coreDataStack: CoreDataStack
|
||||
|
||||
func cleanUp() {
|
||||
do {
|
||||
try self.coreDataStack.deleteStore()
|
||||
@ -158,7 +156,7 @@ class FuzzySearchService {
|
||||
return
|
||||
}
|
||||
|
||||
let initialBaton = self.ignoreService.ignoreCollection(forUrl: folder.url!)
|
||||
let initialBaton = self.ignoreService.ignore(for: folder.url!)
|
||||
let testIgnores = self.usesVcsIgnores
|
||||
var stack = [(initialBaton, folder)]
|
||||
while let iterElement = stack.popLast() {
|
||||
@ -190,7 +188,7 @@ class FuzzySearchService {
|
||||
folder.needsScanChildren = false
|
||||
|
||||
let childFolders = childFiles.filter { $0.direntType == DT_DIR }
|
||||
let childBatons = childFolders.map { self.ignoreService.ignoreCollection(forUrl: $0.url!) }
|
||||
let childBatons = childFolders.map { self.ignoreService.ignore(for: $0.url!) }
|
||||
|
||||
stack.append(contentsOf: zip(childBatons, childFolders))
|
||||
|
||||
@ -416,6 +414,8 @@ class FuzzySearchService {
|
||||
)
|
||||
|
||||
private let fileMonitor = FileMonitor()
|
||||
|
||||
private let coreDataStack: CoreDataStack
|
||||
private let writeContext: NSManagedObjectContext
|
||||
private let ignoreService: IgnoreService
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
/// Tae Won Ha - http://taewon.de - @hataewon
|
||||
/// See LICENSE
|
||||
|
||||
import Commons
|
||||
import Foundation
|
||||
import Ignore
|
||||
import OrderedCollections
|
||||
@ -8,10 +9,7 @@ import OrderedCollections
|
||||
class IgnoreService {
|
||||
var root: URL {
|
||||
didSet {
|
||||
self.rootIgnore = Ignore(
|
||||
base: self.root,
|
||||
parent: Ignore.globalGitignoreCollection(base: self.root)
|
||||
)
|
||||
self.rootIgnore = Ignore(base: self.root, parent: Ignore.globalGitignore(base: self.root))
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,22 +23,18 @@ class IgnoreService {
|
||||
)
|
||||
self.storage = OrderedDictionary(minimumCapacity: count)
|
||||
|
||||
self.rootIgnore = Ignore(
|
||||
base: root,
|
||||
parent: Ignore.globalGitignoreCollection(base: root)
|
||||
)
|
||||
self.rootIgnore = Ignore(base: root, parent: Ignore.globalGitignore(base: root))
|
||||
}
|
||||
|
||||
func ignoreCollection(forUrl url: URL) -> Ignore? {
|
||||
func ignore(for url: URL) -> Ignore? {
|
||||
self.queue.sync {
|
||||
if self.root == url { return self.rootIgnore }
|
||||
guard self.root.isAncestor(of: url) else { return nil }
|
||||
|
||||
if url == self.root { return self.rootIgnore }
|
||||
if let ignore = self.storage[url] { return ignore }
|
||||
|
||||
if let parentIgnore = self.storage[url.parent] {
|
||||
let ignore = Ignore(base: url, parent: parentIgnore)
|
||||
let ignore = Ignore.parentOrIgnore(for: url, withParent: parentIgnore)
|
||||
self.storage[url] = ignore
|
||||
|
||||
return ignore
|
||||
@ -49,22 +43,25 @@ class IgnoreService {
|
||||
// Since we descend the directory structure step by step, the ignore of the parent should
|
||||
// already be present. Most probably we won't land here...
|
||||
let rootPathComp = self.root.pathComponents
|
||||
let pathComp = url.pathComponents.dropLast()
|
||||
let pathComp = url.pathComponents
|
||||
let lineage = pathComp.suffix(from: rootPathComp.count)
|
||||
var ancestorUrl = self.root
|
||||
var ancestorIc = self.rootIgnore
|
||||
var ancestorIgnore = self.rootIgnore
|
||||
for ancestorComponent in lineage {
|
||||
ancestorUrl = ancestorUrl.appendingPathComponent(ancestorComponent, isDirectory: true)
|
||||
if self.storage[ancestorUrl] == nil {
|
||||
guard let ignore = Ignore(base: ancestorUrl, parent: ancestorIc) else {
|
||||
return nil
|
||||
}
|
||||
self.set(ignoreCollection: ignore, forUrl: url)
|
||||
ancestorIc = ignore
|
||||
if let cachedAncestorIc = self.storage[ancestorUrl] { ancestorIgnore = cachedAncestorIc }
|
||||
else {
|
||||
guard let ignore = Ignore.parentOrIgnore(
|
||||
for: ancestorUrl,
|
||||
withParent: ancestorIgnore
|
||||
) else { return nil }
|
||||
|
||||
self.set(ignoreCollection: ignore, forUrl: ancestorUrl)
|
||||
ancestorIgnore = ignore
|
||||
}
|
||||
}
|
||||
|
||||
return ancestorIc
|
||||
return ancestorIgnore
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@ import Cocoa
|
||||
import NvimView
|
||||
import RxPack
|
||||
import RxSwift
|
||||
import RxNeovim
|
||||
import Workspace
|
||||
|
||||
// MARK: - NvimViewDelegate
|
||||
|
57
VimR/VimRTests/IgnoreServiceTest.swift
Normal file
57
VimR/VimRTests/IgnoreServiceTest.swift
Normal file
@ -0,0 +1,57 @@
|
||||
/// Tae Won Ha - http://taewon.de - @hataewon
|
||||
/// See LICENSE
|
||||
|
||||
import Nimble
|
||||
import XCTest
|
||||
|
||||
class IgnoreServiceTest: XCTestCase {
|
||||
var base: URL!
|
||||
var service: IgnoreService!
|
||||
|
||||
override func setUp() {
|
||||
self.base = Bundle(for: type(of: self)).url(
|
||||
forResource: "ignore-service-test",
|
||||
withExtension: nil,
|
||||
subdirectory: "Resources"
|
||||
)!
|
||||
self.service = IgnoreService(count: 100, root: base)
|
||||
|
||||
super.setUp()
|
||||
}
|
||||
|
||||
func testDeepest() {
|
||||
let ignoreAaa = service.ignore(for: base.appendingPathComponent("a/aa/aaa"))!
|
||||
|
||||
expect(ignoreAaa.filters.count).to(beGreaterThanOrEqualTo(4))
|
||||
expect(ignoreAaa.filters[back: 0].pattern).to(equal("last-level"))
|
||||
expect(ignoreAaa.filters[back: 1].pattern).to(equal("level-aaa"))
|
||||
expect(ignoreAaa.filters[back: 2].pattern).to(equal("level-a"))
|
||||
expect(ignoreAaa.filters[back: 3].pattern).to(equal("root-level"))
|
||||
}
|
||||
|
||||
func testWholeTree() {
|
||||
let ignoreBase = service.ignore(for: base)!
|
||||
let ignoreA = service.ignore(for: base.appendingPathComponent("a/"))!
|
||||
let ignoreAa = service.ignore(for: base.appendingPathComponent("a/aa/"))!
|
||||
let ignoreAaa = service.ignore(for: base.appendingPathComponent("a/aa/aaa"))!
|
||||
|
||||
expect(ignoreBase.filters.count).to(beGreaterThanOrEqualTo(1))
|
||||
expect(ignoreBase.filters[back: 0].pattern).to(equal("root-level"))
|
||||
|
||||
expect(ignoreA.filters.count).to(equal(ignoreBase.filters.count + 1))
|
||||
expect(ignoreA.filters[back: 0].pattern).to(equal("level-a"))
|
||||
expect(ignoreA.filters[back: 1].pattern).to(equal("root-level"))
|
||||
|
||||
expect(ignoreAa).to(be(ignoreA))
|
||||
|
||||
expect(ignoreAaa.filters.count).to(equal(ignoreAa.filters.count + 2))
|
||||
expect(ignoreAaa.filters[back: 0].pattern).to(equal("last-level"))
|
||||
expect(ignoreAaa.filters[back: 1].pattern).to(equal("level-aaa"))
|
||||
expect(ignoreAaa.filters[back: 2].pattern).to(equal("level-a"))
|
||||
expect(ignoreAaa.filters[back: 3].pattern).to(equal("root-level"))
|
||||
}
|
||||
}
|
||||
|
||||
private extension BidirectionalCollection {
|
||||
subscript(back i: Int) -> Element { self[index(endIndex, offsetBy: -(i + 1))] }
|
||||
}
|
2
VimR/VimRTests/Resources/ignore-service-test/.gitignore
vendored
Normal file
2
VimR/VimRTests/Resources/ignore-service-test/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
root-level
|
||||
|
2
VimR/VimRTests/Resources/ignore-service-test/a/.gitignore
vendored
Normal file
2
VimR/VimRTests/Resources/ignore-service-test/a/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
level-a
|
||||
|
3
VimR/VimRTests/Resources/ignore-service-test/a/aa/aaa/.gitignore
vendored
Normal file
3
VimR/VimRTests/Resources/ignore-service-test/a/aa/aaa/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
level-aaa
|
||||
last-level
|
||||
|
@ -1,38 +0,0 @@
|
||||
/**
|
||||
* Tae Won Ha - http://taewon.de - @hataewon
|
||||
* See LICENSE
|
||||
*/
|
||||
|
||||
import Nimble
|
||||
import RxSwift
|
||||
import RxTest
|
||||
import XCTest
|
||||
|
||||
class RxSwiftCommonsTest: XCTestCase {
|
||||
func testMapOmittingNil() {
|
||||
let scheduler = TestScheduler(initialClock: 0)
|
||||
|
||||
let xs = scheduler.createHotObservable(
|
||||
[
|
||||
Recorded.next(150, 1),
|
||||
Recorded.next(210, 2),
|
||||
Recorded.next(220, 3),
|
||||
Recorded.next(230, 4),
|
||||
Recorded.next(240, 5),
|
||||
Recorded.next(260, 6),
|
||||
Recorded.completed(300),
|
||||
]
|
||||
)
|
||||
|
||||
let res = scheduler.start { xs.compactMap { $0 % 2 == 0 ? $0 : nil } }
|
||||
|
||||
let correctMessages = [
|
||||
Recorded.next(210, 2),
|
||||
Recorded.next(230, 4),
|
||||
Recorded.next(260, 6),
|
||||
Recorded.completed(300),
|
||||
]
|
||||
|
||||
expect(res.events).to(equal(correctMessages))
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
import XCTest
|
||||
|
||||
import WorkspaceTests
|
||||
|
||||
var tests = [XCTestCaseEntry]()
|
||||
tests += WorkspaceTests.allTests()
|
||||
XCTMain(tests)
|
@ -1,9 +0,0 @@
|
||||
import XCTest
|
||||
|
||||
#if !canImport(ObjectiveC)
|
||||
public func allTests() -> [XCTestCaseEntry] {
|
||||
[
|
||||
testCase(WorkspaceTests.allTests),
|
||||
]
|
||||
}
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user