swiftpromisefuturepromisekit

Are there anything similar to Java's "Future" in Swift?


Java has Future or FutureTask that can run a task in a new thread. Then, return the execution result to the original thread. Are there any feature in Swift can achieve that?


Solution

  • You're looking into some kind of language construction called Futures and promises. You can find some examples, like:

    However the language itself misses such feature.