Commit Graph

41 Commits

Author SHA1 Message Date
Max Howell
1f3564887e
Clarify when(resolved:) behavior 2018-09-27 13:37:40 -04:00
Max Howell
59847871ba Xcode 9.3 / Swift 4.1 / Swift 3.3 updates
Strictly I’d feel better to test all configurations, but PromiseKit only uses Foundation, so the chance that for some reason there is an API break or worse some kind of runtime issue is pretty low and I feel that we have to be kinder to Travis’s free infrastructure.

Tag 6.0.2
2018-02-16 15:26:52 -05:00
Max Howell
17587be4ac PromiseKit 6.0.0
This because `Promise(value:)` is selected for PMK-4’s pending initializer due to trailing closure syntax and the fact that `T` could be anything. I guess this isn’t a Swift bug, but geez.

This is a real problem for people migrating to 5 from 4, such that I have decided 5 must be deprecated.

The severity is due to Swift giving a very misleading error diagnostic when it uses `Promise(value:)`, because as you can guess you end up with:

    Promise<(T->Void, Error->Void)>

As your inferred type.

Because we no longer have ambiguity between `Promise { seal in` and `Promise(value:` I have removed the `.pending` parameter for that usage which will also aid migration.

In some cases this leads to less nice code, but mostly it’s fine due to being able to do `.value(1)` where `Promise` can be inferred. The trade off is worth it though as PromiseKit should be delightful to use and as it stands, it is a pain due to how Swift is.
2018-02-10 17:23:27 -05:00
Max Howell
ddc626d1b9
Update when.swift 2017-11-29 09:49:58 -05:00
Max Howell
47367f1df6 5.0.0 2017-11-06 09:27:11 -05:00
Max Howell
a89fe37356 Support Swift 4 alongside Swift 3
I wish I could configure Travis to run both. Probably I can… not sure how and any effort to do anything with Travis is MANY WASTED DAYS.
2017-07-10 21:27:30 -04:00
Zach Langley
c3be8eb7ef Update NSURL in docs (#656) 2017-05-17 15:35:01 -04:00
JaviLorbada
75bcda4f6b Fix when.swift to compile on Linux. 2017-05-11 10:33:39 +02:00
Max Howell
f0a4644ddf Remove NSProgress on Linux; Fixes #636 2017-04-24 12:41:27 -04:00
Max Howell
dce916d50f Merge pull request #599 from carlbrown/master
Changes to get PromiseKit to compile on Linux
2016-12-07 12:44:54 -05:00
Carl Brown
175bf5404b Changes to compile on Linux 2016-11-30 15:17:19 -06:00
Filip Zawada
0feda053a9 [#560] Add when for 4 and 5 different promises 2016-11-21 13:06:24 +01:00
Zach Langley
eb8ee39103 Make dispatch_barrier_sync Swifty 2016-10-22 21:10:09 -07:00
Max Howell
eaa7ef6fad Prevent Swift compiler ambiguity with when 2016-09-07 15:45:21 -07:00
Max Howell
f4cda6720f - Error.when; + when(resolved/fulfilled:)
Refs #341
2016-09-07 15:45:21 -07:00
Max Howell
67bc256992 PromiseKit 4 / Swift 3 / Xcode 8
http://promisekit.org/news/2016/09/PromiseKit-4.0-Released/
2016-09-07 15:45:21 -07:00
Max Howell
b064b62773 Error if concurrency is <= 0 2016-07-23 13:29:57 -07:00
Max Howell
2743e28d8f Make concurrent when thread-safe 2016-07-23 13:29:35 -07:00
Max Howell
6a5a06a518 Improve concurrent when documentation 2016-07-23 12:53:28 -07:00
Max Howell
c1a4503229 Fix concurrent when tests from crashing
One of the tests was crashing later due to pending promises continuing to resolve and somehow the array of values contained a `nil`. I rewrote the specific when to not depend on optionals.
2016-07-23 12:48:52 -07:00
Valentin Shergin
e04e760c53 Concurrent when: Little simplification. 2016-06-25 09:33:50 -07:00
Valentin Shergin
98aacde606 when with limited concurrently pending promises. 2016-06-20 23:59:08 -07:00
Leo Mehlig
9bcccaecdd Update to Swift 2.2
Update all code to work with Xcode 7.3
2016-03-22 20:22:58 +01:00
Nathan Hosselton
744d770d98 Fix typo in documentation 2015-10-08 13:34:31 -05:00
Nathan Hosselton
b812cc5528 Rename report -> error (report deprecated) 2015-09-30 10:08:47 -05:00
DJ Tarazona
a2718b2d3e Allow an array of void promises for when 2015-08-26 00:45:41 -07:00
Max Howell
9962e330c6 Swift join()
Behaves differently to the ObjC one, but this is the way the ObjC one should behave. This way error-handling propagates correctly.
2015-08-12 21:20:54 -07:00
Max Howell
f004e8ba6c Tests for possible spurious unhandled-errors 2015-08-12 21:20:53 -07:00
Max Howell
2a7df11708 Swift 2: Revised error system (due to ErrorType)
Since ErrorType is not (necessarily) an NSObject we needed to handle the unhandled tokens differently.

Instead we keep an ErrorConsumptionToken with the ErrorType and ensure we pass it around with subsequent promises.

This appears to work for all possible Swift paths and thus I think it will work for all ObjC paths too and it may be worth switching to this system.

The reason the other system was used (add a runtime iVar) is so that errors that are consumed but then end up going back into the a chain are known to already be consumed. However with further realization it is apparent that any error that goes back into a chain is unconsumed and thus the new system should be work well in all cases.
2015-08-12 21:20:53 -07:00
Max Howell
5710dab827 Custom ErrorTypes for our Promises 2015-08-12 21:11:29 -07:00
Max Howell
6f44e12410 docs++; docs += Quick Help format 2015-08-12 21:11:28 -07:00
Max Howell
3573ff938e Swift 2: --warning 2015-08-12 21:11:28 -07:00
Max Howell
b115a0896e Swift 2: Migration: @available syntax change 2015-08-12 21:11:27 -07:00
Max Howell
64b22b1af2 Swift 2: Migration: Function label rules 2015-08-12 21:11:27 -07:00
Max Howell
e3d71bc536 Swift 2: Migration: defer -> pendingPromise
`defer` is now a reserved keyword.

Refs #199
2015-08-12 21:11:27 -07:00
Max Howell
09fe901ba6 Swift 2: Migration: stdlib compliance 2015-08-12 21:11:27 -07:00
Max Howell
63592841d2 Ensure when is thread-safe
Specifically `countdown` must count atomically, and the progress could exceed 100% with certain race paths.
2015-08-06 15:00:22 -05:00
Jack Flintermann
fc4b92597a fix when behavior for empty array 2015-06-26 22:04:10 -04:00
Max Howell
e61187034f Add join but mark it as unavailable
Because Little Bites of Cococa featured PromiseKit using this unavailable function we should provide any users that try to use it with a helpful pointer to when.

We cannot elegantly provide join for Swift, and frankly I’m not convinced it should have been added to our API at all: it breaks the first rule of promises: that errors propogate!
2015-06-06 12:35:41 -07:00
Max Howell
74a3d344dd Add NSProgress to when and PMKWhen
If you don’t want this feature you can compile defining PMKDisableProgress. You’ll want to ensure this flag is added for objc and Swift compilation units.

Closes #127
2015-05-19 14:02:25 -07:00
Max Howell
e96adc5fed PromiseKit 2.0
Fixes #165
Fixes #56
Closes #18
Fixes #13
2015-05-14 00:42:58 -05:00