1111#import < Foundation/Foundation.h>
1212
1313#import < Bolts/BFCancellationToken.h>
14+ #import < Bolts/BFGeneric.h>
1415
1516NS_ASSUME_NONNULL_BEGIN
1617
@@ -24,29 +25,12 @@ extern NSString *const BFTaskErrorDomain;
2425 */
2526extern NSInteger const kBFMultipleErrorsError ;
2627
27- /* !
28- An exception that is thrown if there was multiple exceptions on <BFTask taskForCompletionOfAllTasks:>.
29-
30- @deprecated `BFTask` exception handling is deprecated and will be removed in a future release.
31- */
32- extern NSString *const BFTaskMultipleExceptionsException
33- __attribute__ ((deprecated(" `BFTask` exception handling is deprecated and will be removed in a future release." )));
34-
3528/* !
3629 An error userInfo key used if there were multiple errors on <BFTask taskForCompletionOfAllTasks:>.
3730 Value type is `NSArray<NSError *> *`.
3831 */
3932extern NSString *const BFTaskMultipleErrorsUserInfoKey;
4033
41- /* !
42- An error userInfo key used if there were multiple exceptions on <BFTask taskForCompletionOfAllTasks:>.
43- Value type is `NSArray<NSException *> *`.
44-
45- @deprecated `BFTask` exception handling is deprecated and will be removed in a future release.
46- */
47- extern NSString *const BFTaskMultipleExceptionsUserInfoKey
48- __attribute__ ((deprecated(" `BFTask` exception handling is deprecated and will be removed in a future release." )));
49-
5034@class BFExecutor;
5135@class BFTask;
5236
@@ -74,15 +58,6 @@ typedef __nullable id(^BFContinuationBlock)(BFTask<ResultType> *t);
7458 */
7559+ (instancetype )taskWithError : (NSError *)error ;
7660
77- /* !
78- Creates a task that is already completed with the given exception.
79- @param exception The exception for the task.
80-
81- @deprecated `BFTask` exception handling is deprecated and will be removed in a future release.
82- */
83- + (instancetype )taskWithException : (NSException *)exception
84- __attribute__((deprecated(" `BFTask` exception handling is deprecated and will be removed in a future release." )));
85-
8661/* !
8762 Creates a task that is already cancelled.
8863 */
@@ -105,7 +80,7 @@ __attribute__((deprecated("`BFTask` exception handling is deprecated and will be
10580
10681/* !
10782 Returns a task that will be completed once there is at least one successful task.
108- The first task to successuly complete will set the result, all other tasks results are
83+ The first task to successuly complete will set the result, all other tasks results are
10984 ignored.
11085 @param tasks An `NSArray` of the tasks to use as an input.
11186 */
@@ -116,15 +91,15 @@ __attribute__((deprecated("`BFTask` exception handling is deprecated and will be
11691 @param millis The approximate number of milliseconds to wait before the
11792 task will be finished (with result == nil).
11893 */
119- + (instancetype )taskWithDelay : (int )millis ;
94+ + (BFTask<BFVoid> * )taskWithDelay : (int )millis ;
12095
12196/* !
12297 Returns a task that will be completed a certain amount of time in the future.
12398 @param millis The approximate number of milliseconds to wait before the
12499 task will be finished (with result == nil).
125100 @param token The cancellation token (optional).
126101 */
127- + (instancetype )taskWithDelay : (int )millis cancellationToken : (nullable BFCancellationToken *)token ;
102+ + (BFTask<BFVoid> * )taskWithDelay : (int )millis cancellationToken : (nullable BFCancellationToken *)token ;
128103
129104/* !
130105 Returns a task that will be completed after the given block completes with
@@ -136,7 +111,7 @@ __attribute__((deprecated("`BFTask` exception handling is deprecated and will be
136111 If block returns a BFTask, then the task returned from
137112 this method will not be completed until that task is completed.
138113 */
139- + (instancetype )taskFromExecutor : (BFExecutor *)executor withBlock : (nullable id (^)())block;
114+ + (instancetype )taskFromExecutor : (BFExecutor *)executor withBlock : (nullable id (^)(void ))block;
140115
141116// Properties that will be set on the task once it is completed.
142117
@@ -150,21 +125,13 @@ __attribute__((deprecated("`BFTask` exception handling is deprecated and will be
150125 */
151126@property (nullable , nonatomic , strong , readonly ) NSError *error;
152127
153- /* !
154- The exception of a failed task.
155-
156- @deprecated `BFTask` exception handling is deprecated and will be removed in a future release.
157- */
158- @property (nullable , nonatomic , strong , readonly ) NSException *exception
159- __attribute__ ((deprecated(" `BFTask` exception handling is deprecated and will be removed in a future release." )));
160-
161128/* !
162129 Whether this task has been cancelled.
163130 */
164131@property (nonatomic , assign , readonly , getter =isCancelled) BOOL cancelled;
165132
166133/* !
167- Whether this task has completed due to an error or exception .
134+ Whether this task has completed due to an error.
168135 */
169136@property (nonatomic , assign , readonly , getter =isFaulted) BOOL faulted;
170137
@@ -184,7 +151,7 @@ __attribute__((deprecated("`BFTask` exception handling is deprecated and will be
184151 If block returns a BFTask, then the task returned from
185152 this method will not be completed until that task is completed.
186153 */
187- - (BFTask *)continueWithBlock : (BFContinuationBlock)block ;
154+ - (BFTask *)continueWithBlock : (BFContinuationBlock)block NS_SWIFT_NAME(continueWith(block:)) ;
188155
189156/* !
190157 Enqueues the given block to be run once this task is complete.
@@ -198,7 +165,8 @@ __attribute__((deprecated("`BFTask` exception handling is deprecated and will be
198165 If block returns a BFTask, then the task returned from
199166 this method will not be completed until that task is completed.
200167 */
201- - (BFTask *)continueWithBlock : (BFContinuationBlock)block cancellationToken : (nullable BFCancellationToken *)cancellationToken ;
168+ - (BFTask *)continueWithBlock : (BFContinuationBlock)block
169+ cancellationToken : (nullable BFCancellationToken *)cancellationToken NS_SWIFT_NAME(continueWith(block:cancellationToken:));
202170
203171/* !
204172 Enqueues the given block to be run once this task is complete.
@@ -209,7 +177,9 @@ __attribute__((deprecated("`BFTask` exception handling is deprecated and will be
209177 If block returns a BFTask, then the task returned from
210178 this method will not be completed until that task is completed.
211179 */
212- - (BFTask *)continueWithExecutor : (BFExecutor *)executor withBlock : (BFContinuationBlock)block ;
180+ - (BFTask *)continueWithExecutor : (BFExecutor *)executor
181+ withBlock : (BFContinuationBlock)block NS_SWIFT_NAME(continueWith(executor:block:));
182+
213183/* !
214184 Enqueues the given block to be run once this task is complete.
215185 @param executor A BFExecutor responsible for determining how the
@@ -222,23 +192,24 @@ __attribute__((deprecated("`BFTask` exception handling is deprecated and will be
222192 */
223193- (BFTask *)continueWithExecutor : (BFExecutor *)executor
224194 block : (BFContinuationBlock)block
225- cancellationToken : (nullable BFCancellationToken *)cancellationToken ;
195+ cancellationToken : (nullable BFCancellationToken *)cancellationToken
196+ NS_SWIFT_NAME(continueWith(executor:block:cancellationToken:));
226197
227198/* !
228199 Identical to continueWithBlock:, except that the block is only run
229- if this task did not produce a cancellation, error, or exception .
200+ if this task did not produce a cancellation or an error .
230201 If it did, then the failure will be propagated to the returned
231202 task.
232203 @param block The block to be run once this task is complete.
233204 @returns A task that will be completed after block has run.
234205 If block returns a BFTask, then the task returned from
235206 this method will not be completed until that task is completed.
236207 */
237- - (BFTask *)continueWithSuccessBlock : (BFContinuationBlock)block ;
208+ - (BFTask *)continueWithSuccessBlock : (BFContinuationBlock)block NS_SWIFT_NAME(continueOnSuccessWith(block:)) ;
238209
239210/* !
240211 Identical to continueWithBlock:, except that the block is only run
241- if this task did not produce a cancellation, error, or exception .
212+ if this task did not produce a cancellation or an error .
242213 If it did, then the failure will be propagated to the returned
243214 task.
244215 @param block The block to be run once this task is complete.
@@ -247,27 +218,28 @@ __attribute__((deprecated("`BFTask` exception handling is deprecated and will be
247218 If block returns a BFTask, then the task returned from
248219 this method will not be completed until that task is completed.
249220 */
250- - (BFTask *)continueWithSuccessBlock : (BFContinuationBlock)block cancellationToken : (nullable BFCancellationToken *)cancellationToken ;
221+ - (BFTask *)continueWithSuccessBlock : (BFContinuationBlock)block
222+ cancellationToken : (nullable BFCancellationToken *)cancellationToken
223+ NS_SWIFT_NAME(continueOnSuccessWith(block:cancellationToken:));
251224
252225/* !
253226 Identical to continueWithExecutor:withBlock:, except that the block
254- is only run if this task did not produce a cancellation, error, or
255- exception. If it did, then the failure will be propagated to the
256- returned task.
227+ is only run if this task did not produce a cancellation, error, or an error.
228+ If it did, then the failure will be propagated to the returned task.
257229 @param executor A BFExecutor responsible for determining how the
258230 continuation block will be run.
259231 @param block The block to be run once this task is complete.
260232 @returns A task that will be completed after block has run.
261233 If block returns a BFTask, then the task returned from
262234 this method will not be completed until that task is completed.
263235 */
264- - (BFTask *)continueWithExecutor : (BFExecutor *)executor withSuccessBlock : (BFContinuationBlock)block ;
236+ - (BFTask *)continueWithExecutor : (BFExecutor *)executor
237+ withSuccessBlock : (BFContinuationBlock)block NS_SWIFT_NAME(continueOnSuccessWith(executor:block:));
265238
266239/* !
267240 Identical to continueWithExecutor:withBlock:, except that the block
268- is only run if this task did not produce a cancellation, error, or
269- exception. If it did, then the failure will be propagated to the
270- returned task.
241+ is only run if this task did not produce a cancellation or an error.
242+ If it did, then the failure will be propagated to the returned task.
271243 @param executor A BFExecutor responsible for determining how the
272244 continuation block will be run.
273245 @param block The block to be run once this task is complete.
@@ -278,7 +250,8 @@ __attribute__((deprecated("`BFTask` exception handling is deprecated and will be
278250 */
279251- (BFTask *)continueWithExecutor : (BFExecutor *)executor
280252 successBlock : (BFContinuationBlock)block
281- cancellationToken : (nullable BFCancellationToken *)cancellationToken ;
253+ cancellationToken : (nullable BFCancellationToken *)cancellationToken
254+ NS_SWIFT_NAME(continueOnSuccessWith(executor:block:cancellationToken:));
282255
283256/* !
284257 Waits until this operation is completed.
0 commit comments