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

How to manually trigger Promise in Swift 3 with PromiseKit

I'm looking to develop a sync service which is trigger when a user pulls to refresh. This sync service will perform multiple requests to the server. How can I manually trigger a PromiseKit promise after every API call has been completed? The…
user1007817
1
vote
1 answer

Cannot convert return expression of type Promise (_,_) -> DataRequest to return type Promise>

Cannot convert return expression of type Promise (,) -> DataRequest to return type Promise> my function is func postJson(_ url: String, parameters: [String: String]) -> Promise> { var request = URLRequest(url:…
quantumpotato
  • 9,637
  • 14
  • 70
  • 146
1
vote
1 answer

Polling for a async task and then waiting for either 1 success or all response rejected

PromiseKit version: 4.0 Xcode version: 8.3.2 I have recently started using PromiseKit. Actually, I am creating a polling HTTP request which in returns gives "completed" or "notCompleted". I have to keep making HTTP calls after every 1 secs for a…
Balraj Singh
  • 3,381
  • 6
  • 47
  • 82
1
vote
1 answer

PromiseKit : compose two promises into one

Given the following methods: func loadFromCache(url: URL) -> Promise> func loadFromNetwork(url: URL) -> Promise> I have implemented a method that returns a new promise, by trying the cache first, then the network…
Jasper Blues
  • 28,258
  • 22
  • 102
  • 185
1
vote
0 answers

Linker error, when archiving project with Xcode 8.3.2

After updating to Xcode 8.3.2 from Xcode 8.0 I started seeing this Linker error, when Archiving my project: However, the project compiles still Runs with Debug configuration correctly. That makes me think that the problem might have something to do…
Peter G.
  • 7,816
  • 20
  • 80
  • 154
1
vote
1 answer

Tracking progress when using PromiseKit and Alamofire

Is there any idiomatic way to track execution progress using PromiseKit? For example with Alamofire downloading progress?
pgmarchenko
  • 121
  • 1
  • 8
1
vote
1 answer

Converting PromiseKit to Signal & SignalProducer

I'm trying to convert a Promise from PromiseKit into a ReactiveSwift SignalProducer but I'm having trouble coming up with it. Could someone point me in the right direction? Currently I have: extension SignalProducer { func from(promise:…
barndog
  • 6,975
  • 8
  • 53
  • 105
1
vote
1 answer

Rejecting a the returned promise inside a then block

Say I have two promises I want to combine with a when(resolved:). I want to reject the promise if there was a problem with the first promise, but resolve otherwise. Essentially, this is what I want to do: func personAndPetPromise() ->…
Senseful
  • 86,719
  • 67
  • 308
  • 465
1
vote
0 answers

Firebase observeSingleEvent not invoking callback function ios

I have a situation in which my Firebase reference is not invoking the callback for observeSingleEvent. let uid = FIRAuth.auth()?.currentUser?.uid FIRDatabase.database().reference().child("users").child(uid).observeSingleEvent(of: .value, with: {…
nwales
  • 3,521
  • 2
  • 25
  • 47
1
vote
1 answer

Problems with migration to Swift3, compilation error with URLSession.GET

I'm trying to migrate from Swift2 to Swift3 and I'm having an issue with URLSession.GET I went through the migration tool provided by XCode, and changed my "NSURLSession" calls into "URLSession" but I keep having this error message: "Use of Instance…
AziCode
  • 2,510
  • 6
  • 27
  • 53
1
vote
1 answer

PromiseKit 4 - Wrap Delegation

I am trying to Implement a Singleton with Wrap Delegation using Promisekit I manage to implement this as described here: https://github.com/mxcl/PromiseKit/issues/136 It works, but the promise retain the value from the first call. It dont renew the…
Marckaraujo
  • 7,422
  • 11
  • 59
  • 97
1
vote
1 answer

PromsieKit + Alamofire for loading paged HTTP Data

I am migrating some code from RestKit to Alamofire. I use MagicalRecord + AlamofireObjectMapper to map the JSON into CoreData objects. I am now faced with the following situation: My Data lives at this…
Besi
  • 22,579
  • 24
  • 131
  • 223
1
vote
2 answers

Swift Promise Kit and throws

So I'm using PromiseKit in my latest swift app to do most of the networking code, along with Alamofire. I'm trying to setup my promises to throw when my returns aren't what I desire - here's what the code looks like: ` do{ firstly({ …
1
vote
1 answer

Error handling with PromiseKit

I have following enum: enum RequestResult: ErrorType { case TimedOut case ConnectionFailed } and in my view controller i have following code: when(promise1, promise2).then { results -> Void in //work with results }.error { error in if let err…
Andrey M.
  • 3,021
  • 29
  • 42
1
vote
1 answer

Error handler not called for promise

I have a service, which fails when I enter bad login credentials. However, my Promise error handler does not get called. I don't seem to grasp what's wrong with my code so that the error callback is never reached. Service func loadRepositories() ->…
Besi
  • 22,579
  • 24
  • 131
  • 223