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

Remove retain cycle in the examples #23

Merged
merged 2 commits into from
Apr 27, 2019

Conversation

NeverwinterMoon
Copy link
Member

Self was strongly referenced in most of the examples, thus creating a dependency cycle. This could easy be verified by checking the #debug logs: isDisposed was never called when navigating back from the controllers.

Considering that people will use the examples as a reference, it seems weird to leave it as it was.

Self was strongly referenced in most of the examples, thus creating a dependency cycle. This could easy be verified by checking the #debug logs: isDisposed was never called when navigating back from the controllers.
Copy link
Member

@freak4pc freak4pc left a comment

Choose a reason for hiding this comment

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

Looks great! I'd just want to use self instead of strongSelf.

@@ -25,10 +25,11 @@ class FailedRequestViewController: UIViewController {
.didFailProvisionalNavigation
.observeOn(MainScheduler.instance)
.debug("didFailProvisionalNavigation")
.subscribe(onNext: {(webView, navigation, error) in
.subscribe(onNext: { [weak self] webView, navigation, error in
guard let strongSelf = self else { return }
Copy link
Member

Choose a reason for hiding this comment

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

can you do

Suggested change
guard let strongSelf = self else { return }
guard let self = self else { return }

As available since Swift 4.2 ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

This is possible since Swift 4.2
Copy link
Member

@freak4pc freak4pc left a comment

Choose a reason for hiding this comment

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

Thank you!

@freak4pc freak4pc merged commit 389907e into RxSwiftCommunity:master Apr 27, 2019
@rxswiftcommunity
Copy link

Thanks a lot for contributing @NeverwinterMoon! I've invited you to join the
RxSwiftCommunity GitHub organization – no pressure to accept! If you'd like
more information on what this means, check out our contributor guidelines
and feel free to reach out with any questions.

Generated by 🚫 dangerJS

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.

2 participants