Skip to content

Capture [weak navigator] in viewmodel sinks#10

Merged
Sajjon merged 1 commit into
mainfrom
weak_navigator_capture
May 14, 2026
Merged

Capture [weak navigator] in viewmodel sinks#10
Sajjon merged 1 commit into
mainfrom
weak_navigator_capture

Conversation

@Sajjon
Copy link
Copy Markdown
Owner

@Sajjon Sajjon commented May 14, 2026

Summary

  • SignUpViewModel.transform and HomeViewModel.transform end with a .sink whose only body is self?.navigator.next(...). Capturing the navigator directly drops the self?. chain and makes the closure honest about what it actually retains.
  • Updated the README inline example to match.
  • Left the two coordinator (HomeCoordinator, OnboardingCoordinator) [weak self] captures alone — their switch branches are written to scale and may end up reaching into other parts of self.

Test plan

  • just example-build succeeds.
  • Pre-commit hooks pass (typos, swiftformat, swiftlint).
  • Pre-push hook (Swift unit tests) passes.
  • CI green.

🤖 Generated with Claude Code

The sink bodies only call `navigator.next(...)`, so capturing the
navigator directly drops the `self?.` chain and makes the closure
honest about what it actually needs. Coordinators still use
`[weak self]` since their switch branches reach into more of `self`.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@Sajjon Sajjon merged commit 87752f0 into main May 14, 2026
2 checks passed
@Sajjon Sajjon deleted the weak_navigator_capture branch May 14, 2026 05:32
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.

1 participant