Skip to content

Conversation

@MarcHidalgo5
Copy link
Contributor

@MarcHidalgo5 MarcHidalgo5 commented Feb 9, 2026

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.

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.

Usage example

Before (default progress view):

AsyncButton {
    try await checkSMSCodeAndPerformAuthentication()
} label: {
    smsConfirmationButtonView()
}

After (custom progress view):

AsyncButton {
    try await checkSMSCodeAndPerformAuthentication()
} label: {
    smsConfirmationButtonView()
}
.asyncButtonProgressView { _ in
    ModernCircularProgressView(tintColor: Color.BlackTextColor)
}

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.
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.
Copy link
Contributor

@piercifani piercifani left a 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.
@MarcHidalgo5 MarcHidalgo5 merged commit fbc9d41 into develop Feb 12, 2026
3 checks passed
@MarcHidalgo5 MarcHidalgo5 deleted the async-button-custom-loading branch February 12, 2026 14:21
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.

2 participants