Skip to content

Add EmptyDisposable#209

Merged
dflems merged 3 commits intospotify:masterfrom
mjburghard:add-EmptyDisposable
Mar 26, 2026
Merged

Add EmptyDisposable#209
dflems merged 3 commits intospotify:masterfrom
mjburghard:add-EmptyDisposable

Conversation

@mjburghard
Copy link
Copy Markdown
Contributor

No description provided.

@mjburghard mjburghard force-pushed the add-EmptyDisposable branch 2 times, most recently from 219fab2 to 0bf84b3 Compare February 29, 2024 16:29
Copy link
Copy Markdown
Collaborator

@zvonicek zvonicek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall looks like a good convenience to add

}

public extension Disposable where Self == EmptyDisposable {
static var empty: EmptyDisposable { EmptyDisposable() }
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the disposable will be most of the times used through this getter, I would suggest to add documentation to it, such as:

Suggested change
static var empty: EmptyDisposable { EmptyDisposable() }
/// Gets the disposable that does nothing when disposed.
static var empty: EmptyDisposable { EmptyDisposable() }

}

public extension Disposable where Self == EmptyDisposable {
static var empty: EmptyDisposable { EmptyDisposable() }
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we don't need the concrete type outside, could you return just Disposable? (on iOS 13+ even some Disposable, but I think that the target here is lower)

dflems
dflems previously approved these changes Mar 26, 2026
Updated copyright notice and license header.
@dflems dflems merged commit 74baa7e into spotify:master Mar 26, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants