iOS 15+
AsyncButton(_ title: String, _ systemImage: String?, cancellationMessage: String?, onRunningChanged: ((Bool) -> Void)?, action: () async -> Void)
AsyncButton(_ title: String, cancellationMessage: String?, onRunningChanged: ((Bool) -> Void)?, action: () async -> Void)
AsyncButton(label: () -> View, cancellationMessage: String?, onRunningChanged: ((Bool) -> Void)?, action: () async -> Void)
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)
}