Questions tagged [promisekit]

PromiseKit is Objective-C and Swift Promises implementation. It is also a collection of helper functions that make the typical asynchronous patterns we use in iOS development delightful too.

Modern development is highly asynchronous: isn’t it about time iOS developers had tools that made programming asynchronously powerful, easy and delightful?

PromisesKit is not just a Promises implementation, it is also a collection of helper functions that make the typical asynchronous patterns we use in iOS development delightful too.

In addition, PromisesKit is designed to be integrated into other CocoaPods. If your library has asynchronous operations then consider adding an opt-in subspec that provides Promises for your users. Documentation to help you integrate PromiseKit into your own pods is provided later in this guide.

PromisesKit is available in Objective-C and Swift flavors.

241 questions
2
votes
6 answers

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?
2
votes
1 answer

PromiseKit and CloudKit saving (using Swift)

I'm new to PromiseKit and I'm a bit confused to how to handle multiple promises. I'm using CloudKit and saving two records, and when they are both saved, I want to do something on completion and something else on error. I thought I should do the…
niklassaers
  • 8,480
  • 20
  • 99
  • 146
1
vote
2 answers

Pass value over Promise in Swift

I have a Promise chain like this firstly { Network.shared.getInfo() } .then { info in Network.shared.getUserDetail(info) } .then { detail in Network.shared.getAddOn(detail) } .done { addOn in //do stuff with addOn } .catch { error in…
Fry
  • 6,235
  • 8
  • 54
  • 93
1
vote
1 answer

Pending Task in Swift

Now I am migrating from PromiseKit to Concurrency. As I understood, I should replace Promise and Guarantee with Task. However, I cannot find a replacement for Promise.pending(). Is there something similar in Concurrency? For instance, I want to…
Roman Podymov
  • 4,168
  • 4
  • 30
  • 57
1
vote
5 answers

Swift equivalent of await Promise.all

I'm coming from JS and learning Swift to build an iOS native version of an app. In JS, I use the following pattern all the time: ... async function doAyncFunction(item) { try { // do async call to fetch data using item return…
Kim
  • 856
  • 1
  • 11
  • 21
1
vote
1 answer

How to Unit Test asynchronous functions that uses Promise Kit

Might I be so inclined to ask for a hand and or different perspectives on how to Unit Test a function on my Viewcontroller that calls an HTTP request to a Back End server using promise kit which returns JSON that is then decoded into the data types…
1
vote
1 answer

Use the 'asPromise ()' in the Observable RxSwift can be used in a PromiseKit Promise?

I write function 'asPromise()' extension PrimitiveSequence { public func asPromise() -> Promise { var disposed: Disposable? = nil return Promise { seal in disposed = self.asObservable() .subscribe {…
ocean
  • 13
  • 3
1
vote
1 answer

PromiseKit Cannot invoke 'fulfill' with an argument list of type '(Data)'

I'm trying to get data from the network request using PromiseKit in the following code below, but on the line seal.fulfill(data) I'm getting the error 'Cannot invoke 'fulfill' with an argument list of type '(Data)''. Can anyone please give me a hint…
Andrey
  • 25
  • 4
1
vote
1 answer

iOS Promise Kit and Await Kit in swift

I am trying to use async await / Promise. I have a function like this: extension DemoWebCrypto { class func runWEC(password: String, encrypted: Data) { let crypto = WebCrypto() crypto.decrypt(data: encrypted, …
Abhishek Thapliyal
  • 3,497
  • 6
  • 30
  • 69
1
vote
0 answers

PromiseKit, how to await a finalized promise?

coming from the JS world I'm having a bit of problem wrapping my head around promise kit flavor of promises, I need a bit of help with the following. Assume I have a function that returns a promise, say an api call, on some super class I await for…
Oscar Franco
  • 5,691
  • 5
  • 34
  • 56
1
vote
0 answers

PromiseKit - Pass previous result to next promise in chain

Im trying to follow the Documentation to pass the result of a promise to the next promise https://github.com/mxcl/PromiseKit/blob/master/Documentation/CommonPatterns.md#saving-previous-results I keep getting Contextual closure type '(_) throws ->…
omarojo
  • 1,197
  • 1
  • 13
  • 26
1
vote
1 answer

PromiseKit compilation errors

I'm new to PromiseKit however I can't get something very basic to work. Consider this: func test1() -> Promise { return Promise.value(true) } func test2() -> Promise { return Promise { seal in …
strangetimes
  • 4,953
  • 1
  • 34
  • 62
1
vote
0 answers

ios Swift 4 installing PromiseKit json parse error

I add this line pod "PromiseKit", "~> 6.0" to my Podfile and hit pod update, only to get below error: JSON::ParserError - 416: unexpected token at '{ "name": "QuartzCore", "tvos": { "source_files": "Extensions/QuartzCore/Sources/*", …
3960278
  • 756
  • 4
  • 12
1
vote
0 answers

How can I mock a Promise in a test stub without using PromiseKit

I have a need to add a library to an app, the trouble is the library is using PromiseKit. My application does not use promises, as such I was planning on introducing an adapter to map the promise results to completion handlers. What I am unsure of…
Harry Blue
  • 4,202
  • 10
  • 39
  • 78
1
vote
1 answer

how to resolve this cycle in dependencies swift

Does anyone know how I could resolve this cycle in dependencies? I've been stuck on this problem for 3 days. I tried build cleans, clearing derived data, rebuilding pods, even doing git reverts are not helping. error: Cycle in dependencies between…
ByteMe
  • 1,159
  • 2
  • 15
  • 28