Proyectos de Subversion Iphone Microlearning

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
/**
2
 Copyright 2018 Google Inc. All rights reserved.
3
 
4
 Licensed under the Apache License, Version 2.0 (the "License");
5
 you may not use this file except in compliance with the License.
6
 You may obtain a copy of the License at:
7
 
8
 http://www.apache.org/licenses/LICENSE-2.0
9
 
10
 Unless required by applicable law or agreed to in writing, software
11
 distributed under the License is distributed on an "AS IS" BASIS,
12
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 See the License for the specific language governing permissions and
14
 limitations under the License.
15
 */
16
 
17
#import "FBLPromise.h"
18
 
19
NS_ASSUME_NONNULL_BEGIN
20
 
21
@interface FBLPromise<Value>(DoAdditions)
22
 
23
typedef id __nullable (^FBLPromiseDoWorkBlock)(void) NS_SWIFT_UNAVAILABLE("");
24
 
25
/**
26
 Creates a pending promise and executes `work` block asynchronously.
27
 
28
 @param work A block that returns a value or an error used to resolve the promise.
29
 @return A new pending promise.
30
 */
31
+ (instancetype)do:(FBLPromiseDoWorkBlock)work NS_SWIFT_UNAVAILABLE("");
32
 
33
/**
34
 Creates a pending promise and executes `work` block asynchronously on the given queue.
35
 
36
 @param queue A queue to invoke the `work` block on.
37
 @param work A block that returns a value or an error used to resolve the promise.
38
 @return A new pending promise.
39
 */
40
+ (instancetype)onQueue:(dispatch_queue_t)queue do:(FBLPromiseDoWorkBlock)work NS_REFINED_FOR_SWIFT;
41
 
42
@end
43
 
44
/**
45
 Convenience dot-syntax wrappers for `FBLPromise` `do` operators.
46
 Usage: FBLPromise.doOn(queue, ^(NSError *error) { ... })
47
 */
48
@interface FBLPromise<Value>(DotSyntax_DoAdditions)
49
 
50
+ (FBLPromise * (^)(dispatch_queue_t, FBLPromiseDoWorkBlock))doOn FBL_PROMISES_DOT_SYNTAX
51
    NS_SWIFT_UNAVAILABLE("");
52
 
53
@end
54
 
55
NS_ASSUME_NONNULL_END