timi2506/asyncbutton
iOS 15+
Title + SystemImage
AsyncButton( title: String, systemImage: String?, cancellationMessage: String?, onRunningChanged: ((Bool) -> Void)?, action: () async -> Void)
Title
AsyncButton(_ title: String, cancellationMessage: String?, onRunningChanged: ((Bool) -> Void)?, action: () async -> Void)
Custom Label View
AsyncButton(label: () -> View, cancellationMessage: String?, onRunningChanged: ((Bool) -> Void)?, action: () async -> Void)
Examples
AsyncButton(
"Sleep for 3 Seconds",
cancellationMessage: "This will stop the sleeping Task!",
onRunningChanged: { value in
print(value.description)
}
) {
try? await Task.sleep(nanoseconds: 3_000_000_000)
}Package Metadata
Repository: timi2506/asyncbutton
Default branch: main
README: README.md