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

Proper way to err out of PromiseKit

What is the proper way to throw an error from a function like this: func fetch(by id: String, page: Int = 1) -> Promise { // call api guard let url = URL(string: "") else { return Promise { _ in return…
natecraft1
  • 2,737
  • 9
  • 36
  • 56
0
votes
1 answer

Cannot convert value of type '(Any) -> ()' to expected argument type '(_) -> _'

Installing PromiseKit (6.2.1). Swift4.0. import UIKit import PromiseKit class ViewController: UIViewController { func onFulfilled() -> (String) -> Promise { return { result in return Promise { seal in …
shingo.nakanishi
  • 2,045
  • 2
  • 21
  • 55
0
votes
2 answers

Swift 4: Cannot assign value of type '(Void) -> Void' to type '(() -> Void)?'

I'm a noob in the Swift-Universe, but I have to get the app running ;) It would be great if you help me to find a solution. Thanks a lot in advance. The Problem occurs after upgrading to newer version of X-Code (Version 9.4.1) and Swift 4. private…
JayUU
  • 23
  • 1
  • 4
0
votes
0 answers

Retry mechanism in PromiseKit 6 by making extra call in recover

I would like to know if the below scenario can be achieved using PromiseKit 6. If so, please suggest the best way to do this. firstly { makeAPICall() }.recover { error in // if error != session expired throw error renewTokens().done {…
andrew
  • 272
  • 2
  • 11
0
votes
1 answer

Invalid conversion of recover block, PromiseKit

This code let promise: Promise = self.supplierController .update(supplier: supplier) let block: ((Error) throws -> Supplier) = { (error: Error) throws -> Supplier in let supplier: Supplier = supplier guard…
Vladyslav Zavalykhatko
  • 15,202
  • 8
  • 65
  • 100
0
votes
1 answer

How to return a modified result in a promise as a promise

I'm using promiseKit 6 with the extensions for Alamofire. In the function bellow I'm looking to return Promise (I use swiftyJson) but the response from the alamofire call is a Promise containing a tuple: Promise<(json: Any, response:…
SamAko
  • 3,485
  • 7
  • 41
  • 77
0
votes
1 answer

PromiseKit Framework - Ambiguous reference to member 'then()'

I am using a PromiseKit framework version 1.7.7 (I need to use this version due another framework that needs it). So, in this framework that uses the PromiseKit framework has this method: - (PMKPromise *)paymentTokenForCreditCard:(GNCreditCard…
GuiDupas
  • 1,681
  • 2
  • 22
  • 44
0
votes
1 answer

PromiseKit 6.0 error with launching IOS app

Is PromiseKit 6.0 structure Correct or not?? because i am receiving an error when i running my app :( Here's the image: //Promise block firstly{ removePreviusSearch(text) }.then {(finished) -> Promise in …
0
votes
2 answers

PromiseKit unwrapping optional before chaining

Just started using PromiseKit 6 with Swift. I've checked some examples and read the documentation. I have a scenario that seems trivial but I can't get around it. I have the following scenario: func addModel(_ model: Model, image: UIImage?,…
Vasil Garov
  • 4,851
  • 1
  • 26
  • 37
0
votes
1 answer

ios Promise 6 - Cannot convert value of type '(_) -> Environment' to expected argument type '(_) -> _'

I am migrating from promiseKit 4.3 -> 6 and got stuck on this one error. Any help would be appreciated. Thanks error - "Cannot convert value of type '() -> Environment' to expected argument type '() -> _'" open func run() -> Promise { …
satish
  • 21
  • 2
0
votes
0 answers

Can build and run on the simulator but cannot archive

I am trying to solve a problem for a week now. I can successfully build and run my app on the simulator but when I try to upload it to the app store, I cannot archive it. Can you help with what might be the problem? I am using the PromiseKit…
Murat Yasar
  • 994
  • 9
  • 24
0
votes
1 answer

Odd promiseKit 6 syntax behavior in Xcode

I am getting started with PromiseKit to prevent myself from writing functions with 10 levels of callbacks.. I installed the latest version (6.2.4) using CocoaPods, am running the latest version of xCode, imported PromiseKit in the file I am trying…
Joris416
  • 4,751
  • 5
  • 32
  • 59
0
votes
1 answer

Unable to use then on ios swift promisekit

I created a promise which gets some data from API and returns it. Now what i am stuck is after getting the json data i need to store them on device storage (realm). After calling the promise when i try with then i get some error stating Cannot…
Ahsan Aasim
  • 1,177
  • 3
  • 14
  • 40
0
votes
1 answer

PromiseKit For In Loop When Implementation

With Swift, I am trying to incorporate promises into my code with PromiseKit for the first time and am having difficulty understanding syntactically how to make this work. My goal is to pipeline requests to Firebase for data and execute another…
Chris
  • 431
  • 8
  • 33
0
votes
1 answer

PromiseKit unseen type conversion for NSDictionary

I'm attempting to fetch a json from my path. And everything seems right (granted I came from Swift 2 and tried updating to Swift 4) however, things seem to have gone awry. class func getPlayerStatuses(sportName: String) -> Promise<[NSDictionary]> { …
Konrad Wright
  • 1,254
  • 11
  • 24