Skip to content

timi2506/AsyncButton

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Requirements

iOS 15+

Usage

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)
}

About

A new Type of Button for asynchronous Functions, built for SwiftUI, completely made on Swift Playground for iPad

Resources

License

Stars

Watchers

Forks

Contributors

Languages