Commit Graph

15 Commits

Author SHA1 Message Date
Roman Podymov
0452552590
Update AnyPromise.m 2019-06-28 12:02:03 +02:00
Ivanov Anton
2d2729f508
Fixed build error in AnyPromise.m
When installing PromiseKit 6 as a static library via CocoaPods.
The problem is described in the following issue - https://github.com/mxcl/PromiseKit/issues/825.
2018-05-16 17:25:21 +07:00
Max Howell
f6a448fb86 Add rejected & fulfilled to AnyPromise; Fixes #731 2018-02-12 22:07:31 -05:00
Max Howell
54a99ba7f2 Fixes for CocoaPods; --warning 2018-02-12 21:33:36 -05:00
Max Howell
1339ca0695 Rewrite AnyPromise to use composition
Our existing hack broke the new Xcode build system (see #724).

Also, CocoaPods 1.4 didn’t like it.

So I had to rewrite with composition instead adding additional methods via an objc category.

The cause of the issue was that the framework required that the -Swift.h file be generated before the objc portions were built (since the objc extended the swift portion), and neither build system guarantees this.

All tests pass. However it is not as efficient as before. Could use some optimizations.
2018-02-12 15:27:50 -05:00
Max Howell
47367f1df6 5.0.0 2017-11-06 09:27:11 -05:00
Igor Makarov
db8d5df6f6 expand the ObjC AnyPromise interface by adding -catchOn, -catchInBackground, -catchOnWithPoilcy + add 2 tests for the new methods 2017-06-08 14:36:28 +03:00
Max Howell
c298b43c59 Xcode 9 update; Swift 3.2 --warnings 2017-06-06 13:15:41 -04: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
David Rodriguez
c3d0aab318 Add ability to change the default dispatch queue for all promises 2016-04-18 12:07:23 -05:00
Max Howell
af107056ac Disambiguify category promise() functions
Having to specialize your thens makes using PromiseKit much less pleasant.
However naming our functions more verbosely, for example:

    CLLocationManager.promiseLocations()

    // versus

    CLLocationManager.promiseLocation()

Read confusingly. This new idea allows promises to be non-ambiguous yet
specialization is easy. For example:

    NSURLSession.GET(url).then { data in }  // no compiler ambiguity!

    // or:

    NSURLSession.GET(url).asImage().then { image in }
2015-08-12 21:56:42 -07:00
Max Howell
f4db019044 AnyPromise cannot be subclassed
And even if it could would this make sense?
2015-08-12 21:20:54 -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
575cee9ae7 Back-compat for promiseWithResolver
This is unappetizing, but is required for us to consider our library “stable”.

Also added deprecated versions of adapter methods.
2015-05-14 01:43:42 -05:00
Max Howell
e96adc5fed PromiseKit 2.0
Fixes #165
Fixes #56
Closes #18
Fixes #13
2015-05-14 00:42:58 -05:00