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

How to fire() without arguments? #54

Closed
PierBover opened this issue Feb 3, 2018 · 3 comments
Closed

How to fire() without arguments? #54

PierBover opened this issue Feb 3, 2018 · 3 comments

Comments

@PierBover
Copy link

Sorry if this is obvious but I'm new to Swift.

I'd like fire a Signal without passing any argument.

I've resorted to using Signal<Int?>() and .fire(nil) but is there more elegant way of handling this?

@artman
Copy link
Owner

artman commented Feb 4, 2018

You can do:

let signal = Signal<Void>()
signal.fire(())

@artman artman closed this as completed Feb 4, 2018
@PierBover
Copy link
Author

Is there no way to simply do signal.fire() ?

@artman
Copy link
Owner

artman commented Feb 4, 2018

Unfortunately no. In Swift 4 you cannot omit the parameter even when calling a function that takes a void argument.

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

No branches or pull requests

2 participants