| 1 | // |
| 2 | // TWTRLogInButton.h |
| 3 | // TwitterKit |
| 4 | // |
| 5 | // Copyright (c) 2015 Twitter. All rights reserved. |
| 6 | // |
| 7 | |
| 8 | #import <TwitterCore/TWTRSession.h> |
| 9 | #import <TwitterKit/Twitter.h> |
| 10 | #import <UIKit/UIKit.h> |
| 11 | |
| 12 | NS_ASSUME_NONNULL_BEGIN |
| 13 | |
| 14 | /** |
| 15 | * A Button which launches the sign in to Twitter flow when tapped. |
| 16 | */ |
| 17 | @interface TWTRLogInButton : UIButton |
| 18 | |
| 19 | /** |
| 20 | * The completion block to be called with a `TWTRSession` if successful, |
| 21 | * and a `NSError` if logging in failed or was canceled. |
| 22 | */ |
| 23 | @property (nonatomic, copy) TWTRLogInCompletion logInCompletion; |
| 24 | |
| 25 | /** |
| 26 | * The login methods to attempt when the button is pressed. |
| 27 | * Defaults to TWTRLoginMethodAll. See -[Twitter logInWithMethods:completion:] for more info. |
| 28 | */ |
| 29 | @property (nonatomic) TWTRLoginMethod loginMethods; |
| 30 | |
| 31 | /** |
| 32 | * Returns a new log in button which launches Twitter log in when tapped and |
| 33 | * calls `completion` when logging in succeeds or fails. |
| 34 | * |
| 35 | * Internally, this button simply calls `-[Twitter logInWithCompletion:]`. |
| 36 | * |
| 37 | * @param completion The completion to be called with a `TWTRSession` if successful, |
| 38 | * and a `NSError` if logging in failed or was canceled. |
| 39 | * @return An initialized `TWTRLogInButton`. |
| 40 | */ |
| 41 | + (instancetype)buttonWithLogInCompletion:(TWTRLogInCompletion)completion; |
| 42 | |
| 43 | @end |
| 44 | |
| 45 | NS_ASSUME_NONNULL_END |