Skip to content

LandonRover/SwiftyThreads

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

SwiftyThreads

Basic Pure Swift expressive background thread execution

Usage

STBackground { () -> () in
        // Code to perform in a background thread
      }.afterInterval(3) { () -> () in
        // Still running? Code here is evaluated on the main thread, if the task is not complete
        // Optional
      }.completion { () -> () in
        // Done! Code here is evaluated on the main thread, when the task completes
        // Optional
      }

Alternate Usage

// Just do this in the background, I don't care about anything else.
STBackground { () -> () in
        // Code to perform in a background thread
      }
  
// Do this in the background, then tell me when you're done
STBackground { () -> () in
        // Code to perform in a background thread
      }.completion { () -> () in
        // Done! Code here is evaluated on the main thread, when the task completes
      }
      
// Do this in the background, and tell me only if you're taking a long time
STBackground { () -> () in
        // Code to perform in a background thread
      }.afterInterval(3) { () -> () in
        // Still running? Code here is evaluated on the main thread, if the task is not complete
      }

About

Basic Pure Swift expressive background thread execution

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages