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

Chaining promises in Swift to initialize a custom object

I implemented PromiseKit in Swift to avoid callback hell with completion blocks. I need to know the best way to chain promises together to init custom objects that have other associated objects. For example a Comment object that has a User object…
1
vote
1 answer

PromiseKit with EKEvents - asking user's permission to access calendar events

New to PromiseKit so I want to try it with an async request to get the user's permission to retrieve calendar events. This simple example is just the beginning and will be chaining on from there, but I can't get the first part to work. Here is the…
MplsRich
  • 137
  • 1
  • 13
1
vote
1 answer

PromiseKit in Linux swift project works not as expected

If you execute in Linux swift project something like: import PromiseKit func runAsyncAction() { firstly { executeSomePromiseFunc() }.done { getResult($0) } } getResult($0) will never be executed. Why?
Serhii Didanov
  • 2,200
  • 1
  • 16
  • 31
1
vote
1 answer

PromiseKit ios Swift closure return type issue

I am using Promise Kit in my app. I am new to promise kit. I need to know actually how this closure works. So if anyone can explain the thing with example that would be very helpful. Problem i am facing is, though i am returning the expected value,…
Ahsan Aasim
  • 1,177
  • 3
  • 14
  • 40
1
vote
0 answers

PromiseKit 6, Alamofire, Xcode 10.2/Swift 5

I'm having trouble writing the following code: public func get(organization inSID: String) -> Promise { URLSession.showNetworkActivity() return firstly { let req =…
Rick
  • 3,298
  • 3
  • 29
  • 47
1
vote
1 answer

Network requests timed out irregularly in Swift (using Alamofire)

We have been experiencing timeout issues with some of our requests very rarely and occasionally. It is difficult to reproduce as it just happens out of nowhere and on retry (resending the request by doing the exact same action, like pressing a…
nigong
  • 1,727
  • 3
  • 19
  • 33
1
vote
1 answer

When initializing a promise with a closure/resolver, can we throw directly?

PromiseKit has this initializer for Promise: /// Initialize a new promise that can be resolved with the provided `Resolver`. public init(resolver body: (PromiseKit.Resolver) throws -> Void) Sometimes I need my function to return a Promise but…
blwinters
  • 1,911
  • 19
  • 40
1
vote
0 answers

PromiseKit catch or perform operation without changing type

I have a function that returns a Promise of type T, but I want to both catch, and perform an operation on the result without changing the return type of the promise while keeping the promise chain. This is a simplified version of my workaround but…
natecraft1
  • 2,737
  • 9
  • 36
  • 56
1
vote
1 answer

PromiseKit unable to hit catch within chain

I'm currently mixing SwiftyStoreKit and PromiseKit in order to handle in-app purchases, the problem/issue I'm having is that within the chain of promises if I throw an error within one of them the catch block isn't being executed/hit when the…
Tunds
  • 1,804
  • 2
  • 15
  • 30
1
vote
1 answer

PromiseKit 6 error in cannot convert error

Firstly, I'm aware that the implementation has changed in v6 and and I using the seal object as intended, the problem I'm having is that even when following the example to the letter it still gives me the old Cannot convert value of type '(_) ->…
Marnus Steyn
  • 1,053
  • 2
  • 16
  • 44
1
vote
0 answers

How do I test retry attempts in PromiseKit?

I'm trying to implement a network call using PromiseKit and if it fails I want it to retry several times before giving up. I have done this using the PromiseKit documentation and it seems to work well enough. However, I have encountered issue when…
parski
  • 104
  • 2
  • 8
1
vote
1 answer

Swift 4 - Call nests with PromiseKit

Good morning everyone! I'm doing an app with Swift 4.2 with Xcode10 and calls I manage with Alomofire together with PromiseKit. At one point I need to load a screen at the beginning of the app with the terms of use, but only if they have updated it.…
1
vote
1 answer

PromiseKit 6 Reference to member 'value' cannot be resolved without a contextual type

An update from PromiseKit 4 to 6 was that this... Promise(foo) Has become... .value(foo) And this has worked for me throughout the entirety of updating my project except for one instance in my ContestListViewController.swift.. func confirmEntry(to…
Konrad Wright
  • 1,254
  • 11
  • 24
1
vote
0 answers

Receiving Promise instead of NSMutableURLRequest

I'm attempting to login to my app, however, all my APIRequests are showing as Void instead of APIRequest. This function was working back in Swift 2 and has since gone through some minor changes to attempt to migrate from PromiseKit 4 to PromiseKit…
Konrad Wright
  • 1,254
  • 11
  • 24
1
vote
1 answer

Unable to unwrap Promise<[CLPlacemark]>

I have a method that attempts to update my authorized status. Using PromiseKit 6, Swift 4.2, I can't seem to get my Promise<[CLPlacemark]> to just be a CLPlacemark. This causes a chain of errors of Value of type 'Promise<[CLPlacemark]>' has no…
Konrad Wright
  • 1,254
  • 11
  • 24