Skip to content

Remove unnecessary throws from view model inits#6426

Merged
facumenzella merged 2 commits into
mainfrom
fix/remove-unnecessary-throws-viewmodels
Mar 12, 2026
Merged

Remove unnecessary throws from view model inits#6426
facumenzella merged 2 commits into
mainfrom
fix/remove-unnecessary-throws-viewmodels

Conversation

@facumenzella

@facumenzella facumenzella commented Mar 9, 2026

Copy link
Copy Markdown
Member

Summary

  • Follow-up to Restore rethrows on toPresentedOverrides #6419: removes throws from view model inits that no longer contain throwing operations after the rethrows fix on toPresentedOverrides
  • Affected view models: CarouselComponentViewModel, IconComponentViewModel, StackComponentViewModel, TabsComponentViewModel, TabViewModel, TimelineComponentViewModel, TimelineItemViewModel
  • Also removes throws from StackComponentViewModel.copy(withViewModels:) and cleans up all call sites (try/try!)

Relates to #6419

Test plan

  • swift build passes with zero warnings
  • SwiftLint passes with zero violations

🤖 Generated with Claude Code


Note

Low Risk
Low risk refactor that only changes initializer method signatures and removes try/try! at call sites; main risk is downstream compile failures for external callers relying on the old throwing APIs.

Overview
Removes throws from several Paywalls V2 component view model initializers (Carousel, Icon, Stack, Tabs/Tab, Timeline/TimelineItem) and from StackComponentViewModel.copy(withViewModels:), since they no longer perform throwing work.

Updates ViewModelFactory and SwiftUI preview helpers to stop using try/try! when constructing these view models.

Written by Cursor Bugbot for commit a31e0c7. This will update automatically on new commits. Configure here.

Follow-up to #6419: now that `toPresentedOverrides` identity overload is
non-throwing, several view model inits no longer contain throwing operations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@facumenzella facumenzella merged commit ec9b8a6 into main Mar 12, 2026
14 of 16 checks passed
@facumenzella facumenzella deleted the fix/remove-unnecessary-throws-viewmodels branch March 12, 2026 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants