Each icon indicating copy to clipboard operation
Each copied to clipboard

Add `Disposable` concept

Open dalu93 opened this issue 8 years ago • 0 comments

To workaround the memory leak issue, an another idea could be to implement the famous pattern of Disposable and Disposer

// MARK: - Disposable declaration
public protocol Disposable {
    func dispose()
}

// MARK: - Disposable
extension Each: Disposable {
    public func dispose() {
        stop()
    }
}

// MARK: - Disposer declaration
public protocol Disposer {
    func add(_ disposable: Disposable)
    func dispose()
}

dalu93 avatar Nov 11 '17 10:11 dalu93