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
0
votes
0 answers

What Happens if Fulfill is called Twice on a Promise

This code is blocking the UI until the remote config fetch is done. I have put 2 seconds as timeout. Here both completionHandler and after will execute, whichever finishes first. Will it be ok? Or do I need to take care that only one should…
Namit Gupta
  • 796
  • 9
  • 20
0
votes
1 answer

Error after update PromiseKit: Cannot convert value of type 'PMKFinalizer' to expected argument type 'Promise'

This code worked with PromiseKit v.4.5.2. func getReminderIds(idArray: [Int]) { var reminderPromises: [Promise] = [] for id in idArray { if let prom = self.delegate?.getReminders(id).then({ (reminderArray) -> Promise
maxwell
  • 3,788
  • 6
  • 26
  • 40
0
votes
1 answer

Cannot convert return expression of type 'Promise' to return type 'Promise' Swift

I am new to PromiseKit and am having trouble getting the value of the Promise. The end goal is to have the async call resolve to an array of JSON. Currently the compiler is complaining that: Cannot convert return expression of type 'Promise'…
llamacorn
  • 551
  • 4
  • 23
0
votes
1 answer

Error on Void with Alamofire and PromiseKit with Swift (Request)

n my last projects I have been using alamofire and promisekit to connect to my web services Now I have a new version of both and when I create a request I get this error Cannot convert value of type 'DataRequest' to closure result type 'Void' this…
Dimoreno
  • 227
  • 3
  • 15
0
votes
0 answers

How to extract the connection from function with return in swift?

I am trying to connect with my smart lamp by LIFXClient framework, but unfortunately I do not understand how to use this library. The library looks very simple, here is link. I'm trying changing color by this function: LIFXClient.connect(host:…
Madrox24
  • 31
  • 1
  • 5
0
votes
1 answer

How can I catch error in request when using PromiseKit?

I've started to use PromiseKit in async requests and I have a problem for now, I can't parse an error in chain. I have an request manager with method like this: func request( url: String, parameters: JSON? = nil, …
0
votes
1 answer

Problem updating Realm objects while using PromiseKit

I want to update some properties of my Realm items in the background after getting data back from an API. Some API calls need to be chained, that is, the result of one call fed to another. PromiseKit looked promising for this, but I'm having trouble…
Chad Parker
  • 382
  • 3
  • 6
0
votes
1 answer

PromiseKit: How to do retry / polling in ObjC?

The PromiseKit "Common Patterns" docs are in Swift. How can I write the retry / polling code in Objective C? Retry / Polling func attempt(maximumRetryCount: Int = 3, delayBeforeRetry: DispatchTimeInterval = .seconds(2), _ body: @escaping () ->…
thomers
  • 2,603
  • 4
  • 29
  • 50
0
votes
1 answer

PromiseKit: can't call custom code between then handlers

Just started with PromiseKit and running into a weird compile problem: with firstly: Ambiguous reference to member 'firstly(execute:)' () without firstly: Unable to infer complex closure return type; add explicit Not sure what I am doing wrong…
Markus
  • 599
  • 1
  • 5
  • 18
0
votes
1 answer

Does PromiseKit have an RxSwift Zip alternative?

I am currently working a project with a requirement to refactor the RxSwift dependencies for introduce PromiseKit. I am not hugely familiar with RxSwift or PromiseKit so please forgive me if this is an obvious one. I am looking for a way to handle…
Tim J
  • 1,211
  • 1
  • 14
  • 31
0
votes
1 answer

How to use a method with throws returning a value in promiseKit

I create a set of promises which relies on the results from a function that may throw an error. I can get this to work as shown in the code below, but I don't like the double catch blocks. I'd like to use the a single promiseKit catch block. …
Steig
  • 173
  • 2
  • 5
0
votes
1 answer

I would like to implement promises my own, but I could not find the solution

Here I would like to implement 'Promise' like blocks. But I'm not able to set the result for the blocks. Here I have 2 Challenges : I'm trying to implement simple Promise example for getting a full string from the first name and last name. I…
Damodar
  • 707
  • 2
  • 10
  • 23
0
votes
1 answer

Swift access closure members programmatically

I am building a Swift app and using PromiseKit to make the async features more readable. From the PromiseKit docs, I can see that it supports multiple concurrent promises. I wrote some code as follows to generate promises in a for loop then wait for…
rhlsthrm
  • 769
  • 1
  • 12
  • 23
0
votes
1 answer

Cannot assign value of type 'Promise' to type 'Promise<_>?'

I'm attempting an API Request, however I'm receiving an error Cannot assign value of type 'Promise' to type 'Promise<_>?' I have no idea where 'Promise<_>?' is arising. Here's a look at the code: throwing error at 'as! Promise' class Cache
Konrad Wright
  • 1,254
  • 11
  • 24
0
votes
1 answer

Use of undelcared type 'URLDataPromise'

Currently updating an app from Swift 2 to Swift 4.2 I am running into an error concerning URLDataPromise extension NSURLConnection { public class func GET(URL: String, query: [NSObject:Any]? = nil) -> URLDataPromise { return go(try…
Konrad Wright
  • 1,254
  • 11
  • 24