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
1 answer

Alamofire and PromiseKit returning a Promise<[T]>

I used Alamofire and PromiseKit as separate Cocoapod installs. I can retrieve the JSON data using Alamofire, but I am receiving the error below when configuring PromiseKit. The error below appears in the line where 'fulfill, reject' are in. Error…
0
votes
0 answers

Chaining when(fulfilled:) to make many requests with PromiseKit 6

I'm using PromiseKit 6 to make async requests. Think paginated requests: api/v1/resource? api/v1/resource?offset=5 api/v1/resource?offset=10 ... api/v1/resource?offset=50 What I do currently is this: let paginatedResources: [Promise] =…
7ball
  • 2,183
  • 4
  • 26
  • 61
0
votes
1 answer

Synthax of firstly in PromiseKit 6

I would like to use this method from PromiseKit but dont know how to write propper synthax :x public func firstly(execute body: () throws -> U) -> Promise { do { let rp = Promise(.pending) try body().pipe(to:…
Marlen
  • 85
  • 2
  • 8
0
votes
1 answer

Firebase calls with PromiseKit/AwaitKit in Swift never returns

Similarly to this unanswered question, I have been unable to use Firebase Auth and Database calls with a Promise in Swift. I am able use such calls in a completion handler like this (as long as the completion handler isn't within a…
Wilson Gramer
  • 702
  • 8
  • 23
0
votes
1 answer

PromiseKit - Optional promise with reload first promise

I read all documentation but I don't response my question with successfull. I have this scenario I call the authenticated api point If the response is 200 to 299 I fullfill If the response is 401 I call the api for refresh the token If i…
Luigi Marino
  • 139
  • 6
0
votes
0 answers

Swift - async request after login with PromiseKit

I have been using PromiseKit in the project for asynchronous request processing and my goal is to present the login screen to the user if the request has failed. It is not a problem to react on the first failed request, delete the access token and…
skornos
  • 3,121
  • 1
  • 26
  • 30
0
votes
1 answer

Handling reject with PromiseKit with Swift standard networking?

I've got small function that uses native solutions to parse and decode JSON. Everything works fine, except handling errors. I know that when error occurs, I should get JSON with error and message func fetchCardDetails(withNumber number: Int) ->…
Drwalcore
  • 161
  • 1
  • 13
0
votes
1 answer

loop result from alamofire service in swift 3

I am working with alamofire and promiseKit and I want to return the result as JSON this is my code: Services.objServices.ServLogin(auth: auth_dato).then{ data -> Void in print(data) SVProgressHUD.dismiss() …
Dimoreno
  • 227
  • 3
  • 15
0
votes
2 answers

PromiseKit how to return "when(resolved)" as a promise?

I have a series of functions that look like this: func getA() -> Promise { // code } func getB() -> Promise { // code } func getC() -> Promise { // code } I want to return a Promise when all of these are finished. Here's…
7ball
  • 2,183
  • 4
  • 26
  • 61
0
votes
1 answer

Creating a void Promise which wraps executable code

I need to wrap some code in a promise using PromiseKit. I can create a void promise like this: let promise = Promise(value:()) // Void promise. But that's immediately resolved where as I want to return a void promise that wraps some code which is…
drekka
  • 20,957
  • 14
  • 79
  • 135
0
votes
1 answer

Create a "null" promise which resolves immediately

Is there a short way to do this... Promise { fulfill, reject in fulfill(t) } ... where t is a T and the type of the promise is Promise.
Ian Warburton
  • 15,170
  • 23
  • 107
  • 189
0
votes
2 answers

Poll url until response is a certain value

I've just begun coding in Swift (a very nice language) and I am trying to make an app that requires the user to login using a third party login service. The basics of the authentication flow looks like this: 1. User enters ssn (swedish personnummer)…
Tomas
  • 1,399
  • 1
  • 14
  • 19
0
votes
1 answer

PromiseKit catch multiple arguments

I'm integrating PromiseKit into our current system and I need the catch part of the chain to use 2 arguments. I'd like my catch to use error, fetcher instead of just error. What is the best way to do this? infoPromise.then { objects in …
Alex
  • 3,861
  • 5
  • 28
  • 44
0
votes
0 answers

Unescaped control character around character 1461

I'm hitting web service base below params. posting params: { "UserToken" :…
Yalamandarao
  • 3,852
  • 3
  • 20
  • 27
0
votes
1 answer

PromiseKit dependent promises result in early deallocation

I'm trying to tame some callback hell pyramid of doom code using PromiseKit. To do this I wrap my asynchronous code in promises, but depending on how I return dependent promises, I encounter problems. If I unwrap the promise and fulfill/reject then…
Rhythmic Fistman
  • 34,352
  • 5
  • 87
  • 159