commit | author | age
|
a0a843
|
1 |
// |
H |
2 |
// TWTRComposer.h |
|
3 |
// TwitterKit |
|
4 |
// |
|
5 |
// Copyright (c) 2015 Twitter. All rights reserved. |
|
6 |
// |
|
7 |
|
|
8 |
#import <UIKit/UIKit.h> |
|
9 |
|
|
10 |
NS_ASSUME_NONNULL_BEGIN |
|
11 |
|
|
12 |
/** |
|
13 |
* Possible values for the <i>result</i> parameter of the completionHandler property. |
|
14 |
*/ |
|
15 |
typedef NS_ENUM(NSInteger, TWTRComposerResult) { |
|
16 |
/** |
|
17 |
* The composer is dismissed without sending the Tweet (i.e. the user selects Cancel, or the account is unavailable). |
|
18 |
*/ |
|
19 |
TWTRComposerResultCancelled, |
|
20 |
|
|
21 |
/** |
|
22 |
* The composer is dismissed and the message is being sent in the background, after the user selects Done. |
|
23 |
*/ |
|
24 |
TWTRComposerResultDone |
|
25 |
}; |
|
26 |
|
|
27 |
/** |
|
28 |
* Completion block called when the user finishes composing a Tweet. |
|
29 |
*/ |
|
30 |
typedef void (^TWTRComposerCompletion)(TWTRComposerResult result); |
|
31 |
|
|
32 |
/** |
|
33 |
* The TWTRComposer class presents a view to the user to compose a Tweet. |
|
34 |
*/ |
|
35 |
@interface TWTRComposer : NSObject |
|
36 |
|
|
37 |
/** |
|
38 |
* Sets the initial text for the Tweet composition prior to showing it. |
|
39 |
* |
|
40 |
* @param text The text to tweet. |
|
41 |
* |
|
42 |
* @return This will return NO if the receiver has already been presented (and therefore cannot be changed). |
|
43 |
*/ |
|
44 |
- (BOOL)setText:(nullable NSString *)text; |
|
45 |
|
|
46 |
/** |
|
47 |
* Sets an image attachment. |
|
48 |
* |
|
49 |
* @param image The image to attach. |
|
50 |
* |
|
51 |
* @return This will return NO if the receiver has already been presented (and therefore cannot be changed). |
|
52 |
*/ |
|
53 |
- (BOOL)setImage:(nullable UIImage *)image; |
|
54 |
|
|
55 |
/** |
|
56 |
* Adds a URL to the contents of the Tweet message. |
|
57 |
* |
|
58 |
* @param url The URL. |
|
59 |
* |
|
60 |
* @return This will return NO if the receiver has already been presented (and therefore cannot be changed). |
|
61 |
*/ |
|
62 |
- (BOOL)setURL:(nullable NSURL *)url; |
|
63 |
|
|
64 |
/** |
|
65 |
* Presents the composer, with an optional completion handler from the specified view controller. |
|
66 |
* @param fromController The controller in which to present the composer from. |
|
67 |
* @param completion completion The completion handler, which has a single parameter indicating whether the user finished or cancelled the Tweet composition. |
|
68 |
*/ |
|
69 |
- (void)showFromViewController:(UIViewController *)fromController completion:(TWTRComposerCompletion)completion; |
|
70 |
|
|
71 |
@end |
|
72 |
|
|
73 |
NS_ASSUME_NONNULL_END |