NoDisposable
类似于telegram
中SwiftSignalKit
中的EmptyDisposable
1
2
3
4
5
6
7
8
9
10
11
12
private struct NopDisposable : Disposable {
fileprivate static let noOp: Disposable = NopDisposable()
private init() {
}
/// Does nothing.
public func dispose() {
}
}
1
2
3
4
5
6
7
8
extension Disposables {
/**
Creates a disposable that does nothing on disposal.
*/
static public func create() -> Disposable {
return NopDisposable.noOp
}
}
Disposable见另一篇
注:文中源码来自RxSwift