-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
change FolderContentMonitor observable initialization
See discussion here for details: RxSwiftCommunity/contributors#16
- Loading branch information
1 parent
bc243cf
commit a30a212
Showing
7 changed files
with
92 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// | ||
// Monitoring.swift | ||
// RxFileMonitor | ||
// | ||
// Created by Christian Tietze on 08/11/16. | ||
// Copyright © 2016 RxSwiftCommunity https://github.com/RxSwiftCommunity | ||
// | ||
|
||
import Foundation | ||
import RxSwift | ||
|
||
extension FolderContentMonitor: ObservableConvertibleType { | ||
|
||
public func asObservable() -> Observable<FolderContentChangeEvent> { | ||
|
||
return Observable.create { observer in | ||
|
||
// Wrap existing callback | ||
let oldCallback = self.callback | ||
|
||
self.callback = { event in | ||
oldCallback?(event) | ||
observer.on(.next(event)) | ||
} | ||
|
||
if !self.hasStarted { | ||
self.start() | ||
} | ||
|
||
return Disposables.create { | ||
self.stop() | ||
} | ||
} | ||
} | ||
} |