Remove unnecessary throws from view model inits#6426
Merged
Conversation
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>
JZDesign
approved these changes
Mar 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
rethrowsontoPresentedOverrides#6419: removesthrowsfrom view modelinits that no longer contain throwing operations after therethrowsfix ontoPresentedOverridesCarouselComponentViewModel,IconComponentViewModel,StackComponentViewModel,TabsComponentViewModel,TabViewModel,TimelineComponentViewModel,TimelineItemViewModelthrowsfromStackComponentViewModel.copy(withViewModels:)and cleans up all call sites (try/try!)Relates to #6419
Test plan
swift buildpasses with zero warnings🤖 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
throwsfrom several Paywalls V2 component view model initializers (Carousel,Icon,Stack,Tabs/Tab,Timeline/TimelineItem) and fromStackComponentViewModel.copy(withViewModels:), since they no longer perform throwing work.Updates
ViewModelFactoryand SwiftUI preview helpers to stop usingtry/try!when constructing these view models.Written by Cursor Bugbot for commit a31e0c7. This will update automatically on new commits. Configure here.