Skip to content

westerlund/Dispatch-After-Swift

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

How to dispatch after in Swift?

Since Xcode doesn't have the dispatch_after snippet Swift-ready, I decided I was going to see if the kind of ugly looking API could be improved. This is what I came up with.

Usage

The easy way:

dispatch(after: 2) {
    // ... block that will run after 2 seconds
}

you can also specify a custom queue if you like:

dispatch(after: 2, queue: someQueue) {
    // ... block that will run after 2 seconds on someQueue
}

Installation

Just drop dispatch.swift in your project and you're good to go.

I'm on @wesslansimon if you have questions or just intrested in having a cup of coffee.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages