-
Notifications
You must be signed in to change notification settings - Fork 5
feat: add customizable progress view to AsyncButton #453
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
Merged
Conversation
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
Introduce a new method `asyncButtonProgressView` allowing customization of the progress view displayed by `AsyncButton`. This change enables developers to provide a custom progress view appearance in addition to the existing loading states. The update includes: - Creation of an `AsyncButtonProgressViewProvider` typealias and corresponding environment value. - Replacement of hardcoded `ProgressView` with a customizable `progressView` property in `AsyncButton`. - New view modifiers for setting custom progress view configurations. - Enhanced flexibility in UI design for loading states.
piercifani
reviewed
Feb 9, 2026
piercifani
reviewed
Feb 9, 2026
Introduce an optional customization for the progress view in `AsyncButton`. Implement an environment key for `asyncButtonProgressViewProvider` to allow custom styling of the loading spinner. This change enables developers to provide a custom loading spinner via a closure tied to the AsyncButton, enhancing the user experience and visual consistency with the app's theme. Default behavior remains unchanged unless provided with a custom configuration.
Allow customizing the HUD loading spinner by adding a `loader` view builder parameter to the `hud` modifier. This enhancement provides more flexibility in defining how loading states are represented in the interface. The default implementation remains with a `ProgressView`, but now users can substitute their own loader components to better align with their design requirements. The change affects the modifiers for both iOS and macOS platforms, ensuring consistent customization across the implementations.
Refactor AsyncButton in Swift to allow more flexible and customizable loading indicators. Introduce a generic Progress view parameter to the AsyncButton struct, replacing the fixed progress view logic with a customizable provider approach. This change provides a new default progress view and a progress view builder modifier, enabling users to specify custom loading indicators more easily. This improves code modularity and aligns the component with idiomatic SwiftUI patterns. Simplifying the AsyncButton logic helps both maintain and extend the component.
Enhance the `AsyncButton` by adding comprehensive documentation, explaining its purpose for `async` actions and UI feedback during loading states. The documentation specifies customization via `.asyncButtonLoadingConfiguration` and details blocking and inline styles. This clarity aids developers in using and customizing the component effectively. Additionally, simplify `EnvironmentValues` management for better modularity.
Refactor HUDView to improve flexibility and maintainability by renaming variables for better clarity. In HUDState, change variable names from 's' to 'string' for better readability. In AsyncButton, streamline performAction by changing Result to Swift.Result for consistency. Enhance loader messages with detailed inline and blocking configuration. Improve loading indicators with scaling and text customization. This enables better user feedback while maintaining interface consistency.
piercifani
reviewed
Feb 10, 2026
piercifani
approved these changes
Feb 10, 2026
Contributor
piercifani
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just that change and that's it
Change `DefaultAsyncButtonProgressView` from `public` to `internal` to limit its visibility as it's primarily used internally. Remove the `public` keyword from `AsyncButton` extensions to use default module-wide access level, aligning with internal usage patterns. This enhances encapsulation and reduces public API exposure, simplifying maintenance and ensuring proper usage within its intended scope.
…s view Modify the initializer of `AsyncButton` and `DefaultAsyncButtonProgressView` to be public, allowing external modules to instantiate and utilize these components. This change improves the library's extensibility and integration capabilities for developers who need to leverage `AsyncButton` in their own SwiftUI projects. The `public` access level for `DefaultAsyncButtonProgressView` enables users to customize and utilize the default view for displaying progress.
Change the visibility of certain AsyncButton extensions from internal to public. This allows users to access convenience initializers for AsyncButtons with text or image labels outside of the module. This modification improves flexibility and usability by enabling API consumers to easily initialize buttons using strings, localized string keys, or system images without needing to redefine these initializers.
piercifani
approved these changes
Feb 12, 2026
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.
Introduce a new method
asyncButtonProgressViewallowing customization of the progress view displayed byAsyncButton. This change enables developers to provide a custom progress view appearance in addition to the existing loading states.The update includes:
AsyncButtonProgressViewProvidertypealias and corresponding environment value.ProgressViewwith a customizableprogressViewproperty inAsyncButton.Introduce a new method
asyncButtonProgressViewallowing customization of the progress view displayed byAsyncButton. This change enables developers to provide a custom progress view appearance in addition to the existing loading states.The update includes:
AsyncButtonProgressViewProvidertypealias and corresponding environment value.ProgressViewwith a customizableprogressViewproperty inAsyncButton.Usage example
Before (default progress view):
After (custom progress view):