Wrapper view of Button that supports asynchronous code.


This is a convenience type for encapsulating asynchronous logic in a SwiftUI Button. The initial base of this code was taken from John Sundell's article here: This included the main idea and structure of AsyncButton. I restuctured it in various ways (i.e. using OptionSet for ActionOptions, backporting to iOS 13, using the .task modifier instead of a nested Task, the extra convenience initializers, etc.).


  • Create environment values (internal ones that are used by public modifiers) for more granular settings
    • Animation for changes to isEnabled and isShowingPlaceholder
    • Duration to wait before showing the placeholder view (minAsyncDuration), which is used just in case action is so fast, nothing is needed to be shown
    • ActionOptions


  • Swift Tools 5.7.0
View More Packages from this Author


Last updated: Tue May 14 2024 03:54:44 GMT-0900 (Hawaii-Aleutian Daylight Time)