Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Disposable concept #14

Open
dalu93 opened this issue Nov 11, 2017 · 0 comments
Open

Add Disposable concept #14

dalu93 opened this issue Nov 11, 2017 · 0 comments
Assignees
Milestone

Comments

@dalu93
Copy link
Owner

dalu93 commented Nov 11, 2017

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()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant