commit | author | age
|
a0a843
|
1 |
// |
H |
2 |
// TWTRComposerViewController.h |
|
3 |
// TwitterKit |
|
4 |
// |
|
5 |
// Copyright (c) 2015 Twitter. All rights reserved. |
|
6 |
// |
|
7 |
|
|
8 |
#import <UIKit/UIKit.h> |
|
9 |
@class TWTRTweet; |
|
10 |
@protocol TWTRComposerViewControllerDelegate; |
|
11 |
|
|
12 |
NS_ASSUME_NONNULL_BEGIN |
|
13 |
|
|
14 |
/** |
|
15 |
* Composer interface to allow users to compose & send Tweets from |
|
16 |
* inside an app. |
|
17 |
* |
|
18 |
* It is the developers' responsibility to ensure that there exists a |
|
19 |
* logged in Twitter user before creating a `TWTRComposerViewController`. |
|
20 |
* |
|
21 |
* See: https://dev.twitter.com/twitterkit/ios/compose-tweets#presenting-a-basic-composer |
|
22 |
* |
|
23 |
* Initial Text |
|
24 |
* If you wish to add default mentions to the Tweet, add them to the |
|
25 |
* beginning of `initialText`. |
|
26 |
* |
|
27 |
* If you wish to add default hashtags or links to the Tweet, |
|
28 |
* add them at the end of `initialText`. |
|
29 |
*/ |
|
30 |
@interface TWTRComposerViewController : UIViewController |
|
31 |
|
|
32 |
/** |
|
33 |
* The delegate for this composer view controller. |
|
34 |
*/ |
|
35 |
@property (nonatomic, weak) id<TWTRComposerViewControllerDelegate> delegate; |
|
36 |
|
|
37 |
/** |
|
38 |
* Create an empty composer view controller. The developer must handle ensuring |
|
39 |
* that a logged in Twitter user exists before creating this controller. |
|
40 |
*/ |
|
41 |
+ (instancetype)emptyComposer; |
|
42 |
|
|
43 |
/** |
|
44 |
* Initialize a composer with pre-filled text and an image or video attachment. |
|
45 |
* Requires a logged in Twitter user. |
|
46 |
* |
|
47 |
* @param initialText (optional) Text with which to pre-fill the composer text. |
|
48 |
* @param image (optional) Image to add as an attachment. |
|
49 |
* @param videoURL (optional) Video URL to add as an attachment. Of the form of `assets-library`. |
|
50 |
* |
|
51 |
* Note: Only one type of attachment (image or video) may be added. |
|
52 |
*/ |
|
53 |
- (instancetype)initWithInitialText:(nullable NSString *)initialText image:(nullable UIImage *)image videoURL:(nullable NSURL *)videoURL; |
|
54 |
|
|
55 |
- (instancetype)init NS_UNAVAILABLE; |
|
56 |
|
|
57 |
@end |
|
58 |
|
|
59 |
@protocol TWTRComposerViewControllerDelegate <NSObject> |
|
60 |
|
|
61 |
@optional |
|
62 |
/** |
|
63 |
* Called when the user taps the cancel button. This method will be called after the view controller is dismissed. |
|
64 |
*/ |
|
65 |
- (void)composerDidCancel:(TWTRComposerViewController *)controller; |
|
66 |
|
|
67 |
/** |
|
68 |
* Called when the user successfully sends a Tweet. The resulting Tweet object is returned. |
|
69 |
* This method is called after the view controller is dimsissed and the API response is |
|
70 |
* received. |
|
71 |
*/ |
|
72 |
- (void)composerDidSucceed:(TWTRComposerViewController *)controller withTweet:(TWTRTweet *)tweet; |
|
73 |
|
|
74 |
/** |
|
75 |
* This method is called if the composer is not able to send the Tweet. |
|
76 |
* The view controller will not be dismissed automatically if this method is called. |
|
77 |
*/ |
|
78 |
- (void)composerDidFail:(TWTRComposerViewController *)controller withError:(NSError *)error; |
|
79 |
|
|
80 |
@end |
|
81 |
|
|
82 |
NS_ASSUME_NONNULL_END |