Skip to content

Instantly share code, notes, and snippets.

@josuesasilva
Created May 29, 2020 23:46
Show Gist options
  • Save josuesasilva/3e2c012bdf94fd7026632bd9f8cc769c to your computer and use it in GitHub Desktop.
Save josuesasilva/3e2c012bdf94fd7026632bd9f8cc769c to your computer and use it in GitHub Desktop.
Running async operations with dependent functions
infix operator >>->>: LogicalConjunctionPrecedence
typealias AsyncJob = (@escaping () -> Void) -> Void
func >>->>(lhs: @escaping AsyncJob, rhs: @escaping AsyncJob) -> AsyncJob {
return { completion in
lhs {
rhs(completion)
}
}
}
// let job = loadBackgroundImage >>->> loadLastProgress >>->> loadAudioContent
// job { do something after chain execution }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment