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

can not deinit #3711

Closed
xujialiang opened this issue Jul 10, 2020 · 2 comments
Closed

can not deinit #3711

xujialiang opened this issue Jul 10, 2020 · 2 comments

Comments

@xujialiang
Copy link

// My ViewModel can deinit
showAPIHelperAction = Action<(), Void, Never>{[unowned self] _ in
return self.showAPIHelperActionExec()
}

// My ViewModel can't deinit
showAPIHelperAction = Action(execute: showAPIHelperActionExec)

func showAPIHelperActionExec() -> SignalProducer<Void, Never> {
return SignalProducer<Void, Never> { [unowned self] observer, disposable in
observer.sendCompleted()
}
}

@kaybutter
Copy link
Contributor

That's just how Swift works. Not much ReactiveCocoa can do about that. Passing a method as a closure parameter like in Action(execute: showAPIHelperActionExec) will always capture self as a strong reference.

@RuiAAPeres
Copy link
Member

Hello. 👋 Thanks for opening this issue. Due to inactivity, we will soft close the issue. If you feel that it should remain open, please let us know. 😄

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

3 participants