mirror of
https://github.com/qvacua/vimr.git
synced 2024-12-25 23:02:35 +03:00
GH-213 Add a method to Array to merge observables
This commit is contained in:
parent
23fb64957e
commit
2272996da7
@ -41,6 +41,7 @@
|
||||
4B9A15241D2993DA009F9F67 /* Nimble.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4B56F29B1D29926600C1F92E /* Nimble.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
4B9A15251D2993DA009F9F67 /* Quick.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4B56F29C1D29926600C1F92E /* Quick.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
4B9A15261D2993DF009F9F67 /* SwiftNeoVim.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4B2A2BF71D0351810074CE9A /* SwiftNeoVim.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
4BB1BEA91D48773200463C29 /* RxSwiftUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BB1BEA81D48773200463C29 /* RxSwiftUtils.swift */; };
|
||||
4BCADE081D11ED12004DAD0F /* CocoaExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BCADE071D11ED12004DAD0F /* CocoaExtensions.swift */; };
|
||||
4BD3BF931D32A95800082605 /* MainWindowComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BD3BF921D32A95800082605 /* MainWindowComponent.swift */; };
|
||||
4BD3BF971D32B0DB00082605 /* MainWindowManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BD3BF961D32B0DB00082605 /* MainWindowManager.swift */; };
|
||||
@ -182,6 +183,7 @@
|
||||
4B854A1A1D31447C00E08DE1 /* NeoVimServer */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = NeoVimServer; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
4B854A1C1D31447C00E08DE1 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
||||
4B97E2CD1D33F53D00FC0660 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainWindow.xib; sourceTree = "<group>"; };
|
||||
4BB1BEA81D48773200463C29 /* RxSwiftUtils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RxSwiftUtils.swift; sourceTree = "<group>"; };
|
||||
4BCADE071D11ED12004DAD0F /* CocoaExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CocoaExtensions.swift; sourceTree = "<group>"; };
|
||||
4BCF638F1D323CFD00F15CE4 /* nvim */ = {isa = PBXFileReference; lastKnownFileType = folder; name = nvim; path = neovim/src/nvim; sourceTree = SOURCE_ROOT; };
|
||||
4BD3BF921D32A95800082605 /* MainWindowComponent.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MainWindowComponent.swift; sourceTree = "<group>"; };
|
||||
@ -409,6 +411,7 @@
|
||||
1929B39DA7AC4A9B62D7CD39 /* Component.swift */,
|
||||
4BD3BF961D32B0DB00082605 /* MainWindowManager.swift */,
|
||||
4BD3BF921D32A95800082605 /* MainWindowComponent.swift */,
|
||||
4BB1BEA81D48773200463C29 /* RxSwiftUtils.swift */,
|
||||
4B238BED1D3ED55300CBDD98 /* Preferences */,
|
||||
4B97E2CF1D33F92200FC0660 /* resources */,
|
||||
4B2A2C0D1D0353750074CE9A /* Bridge.h */,
|
||||
@ -700,6 +703,7 @@
|
||||
4BD3BF971D32B0DB00082605 /* MainWindowManager.swift in Sources */,
|
||||
4B238BEC1D3ED54D00CBDD98 /* AppearancePrefPane.swift in Sources */,
|
||||
4BD3BF931D32A95800082605 /* MainWindowComponent.swift in Sources */,
|
||||
4BB1BEA91D48773200463C29 /* RxSwiftUtils.swift in Sources */,
|
||||
4B4546871D468CEC00A1E27F /* PrefStore.swift in Sources */,
|
||||
4B4FC8E61D3E8739009352C3 /* PrefWindowComponent.swift in Sources */,
|
||||
4BEBA5091CFF374B00673FDF /* AppDelegate.swift in Sources */,
|
||||
|
@ -36,15 +36,13 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
|
||||
[ self.prefStore ]
|
||||
.map { $0.sink }
|
||||
.toObservable()
|
||||
.flatMap { $0 }
|
||||
.toMergedObservables()
|
||||
.subscribe(self.changeSubject)
|
||||
.addDisposableTo(self.disposeBag)
|
||||
|
||||
[ self.prefWindowComponent ]
|
||||
.map { $0.sink }
|
||||
.toObservable()
|
||||
.flatMap { $0 }
|
||||
.toMergedObservables()
|
||||
.subscribe(self.actionSubject)
|
||||
.addDisposableTo(self.disposeBag)
|
||||
}
|
||||
|
19
VimR/RxSwiftUtils.swift
Normal file
19
VimR/RxSwiftUtils.swift
Normal file
@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Tae Won Ha - http://taewon.de - @hataewon
|
||||
* See LICENSE
|
||||
*/
|
||||
|
||||
import Foundation
|
||||
import RxSwift
|
||||
|
||||
extension Array {
|
||||
|
||||
/// This method only makes sense for `Array<Observable<Any>>`.
|
||||
/// - Returns: Merged observables
|
||||
func toMergedObservables() -> Observable<Any> {
|
||||
return self
|
||||
.flatMap { $0 as? Observable<Any> }
|
||||
.toObservable()
|
||||
.flatMap { $0 }
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user