Sign In Sign Up

Refactor UpdatePopoverView cases to separate views

Turn each @macos/Sources/Features/Update/UpdatePopoverView.swift case into a dedicated fileprivate Swift view that takes the typed value as its parameter so that we can remove the guards.

Done! I've refactored all the views into dedicated fileprivate structs that take typed parameters, eliminating all the guard statements.

Build it and fix errors.

I need to check the UpdateViewModel to see the correct type names:

Explored 1 file

Now I can see the issues. The State is actually named UpdateState and is a separate enum. Also, there's a naming conflict with ErrorView. Let me fix these:

Edited UpdatePopoverView.swift
+9
-9

Now I need to fix the remaining compilation errors. Let me check the exact types for SUUpdatePermissionResponse and SPUUserUpdateChoice:

Explored 1 file, 2 searches

Now I need to fix the remaining errors. The first is that .init(automaticUpdateChecks:...) needs the full type SUUpdatePermissionResponse. The second is that the ProgressView needs an explicit type, and third is that .dismiss needs to be .skip:

Edited UpdatePopoverView.swift
+4
-4

Now let's build again:

I need to import Sparkle in the file to access SUUpdatePermissionResponse:

Edited UpdatePopoverView.swift
+1

Perfect! The build succeeded. Let me verify by running the build command one more time to ensure it completes successfully:

Great! The build completed successfully. The refactoring is complete. All view cases have been extracted into dedicated fileprivate structs with typed parameters, eliminating all the guard statements as requested.