Skip to content
This repository has been archived by the owner on Jun 21, 2019. It is now read-only.

Commit

Permalink
[Sources] Add nullability annotations.
Browse files Browse the repository at this point in the history
  • Loading branch information
ruslanskorb authored and Ruslan Skorb committed Nov 19, 2015
1 parent 30e49d8 commit e320b07
Showing 1 changed file with 46 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,121 +25,125 @@

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@interface UIViewController (RSKKeyboardAnimationObserver)

/**
Block to handle a start point of animation, could be used for simultaneous animations OR for setting some flags for internal usage.
@param keyboardRectEnd The end frame of the keyboard.
@param duration Duration for keyboard change frame animation.
*/
*/
typedef void(^RSKKeyboardBeforeWillChangeFrameAnimationBlock)(CGRect keyboardRectEnd, NSTimeInterval duration);

/**
Block to handle a start point of animation, could be used for simultaneous animations OR for setting some flags for internal usage.
@param keyboardRectEnd The end frame of the keyboard.
@param duration Duration for keyboard showing animation.
@param isShowing If isShowing is YES we will handle keyboard showing, if NO we will process keyboard dismissing.
*/
*/
typedef void(^RSKKeyboardBeforeWillShowOrHideAnimationBlock)(CGRect keyboardRectEnd, NSTimeInterval duration, BOOL isShowing);

/**
Block which contains user defined animations.
@param keyboardRectEnd The end frame of the keyboard.
@param duration Duration for keyboard change frame animation.
*/
*/
typedef void(^RSKKeyboardWillChangeFrameAnimationBlock)(CGRect keyboardRectEnd, NSTimeInterval duration);

/**
Block to handle completion of keyboard animation.
@param finished If NO animation was canceled during performing.
*/
*/
typedef void(^RSKKeyboardWillChangeFrameAnimationCompletionBlock)(BOOL finished);

/**
Block which contains user defined animations.
@param keyboardRectEnd The end frame of the keyboard.
@param duration Duration for keyboard showing animation.
@param isShowing If isShowing is YES we handle keyboard showing, if NO we process keyboard dismissing.
*/
*/
typedef void(^RSKKeyboardWillShowOrHideAnimationBlock)(CGRect keyboardRectEnd, NSTimeInterval duration, BOOL isShowing);

/**
Block to handle completion of keyboard animation.
@param finished If NO animation was canceled during performing.
@param isShown If YES the keyboard was shown.
*/
*/
typedef void(^RSKKeyboardWillShowOrHideAnimationCompletionBlock)(BOOL finished, BOOL isShown);

/**
Animation block will be called inside [UIView animateWithDuration:::::].
@tip viewDidAppear is the best place to subscribe to keyboard events.
@param beforeWillChangeFrameAnimationBlock Preanimation actions should be performed inside this block.
@param willChangeFrameAnimationBlock User defined animations. If using auto layout don't forget to call layoutIfNeeded.
@param completionBlock User defined completion block, will be called when animation ends.
@warning These blocks will be holding inside UIViewController which calls it, so as with any block-style API avoid a retain cycle.
*/
- (void)rsk_subscribeKeyboardWithBeforeWillChangeFrameAnimation:(RSKKeyboardBeforeWillChangeFrameAnimationBlock)beforeWillChangeFrameAnimationBlock
willChangeFrameAnimation:(RSKKeyboardWillChangeFrameAnimationBlock)willChangeFrameAnimationBlock
onComplete:(RSKKeyboardWillChangeFrameAnimationCompletionBlock)completionBlock;
*/
- (void)rsk_subscribeKeyboardWithBeforeWillChangeFrameAnimation:(nullable RSKKeyboardBeforeWillChangeFrameAnimationBlock)beforeWillChangeFrameAnimationBlock
willChangeFrameAnimation:(nullable RSKKeyboardWillChangeFrameAnimationBlock)willChangeFrameAnimationBlock
onComplete:(nullable RSKKeyboardWillChangeFrameAnimationCompletionBlock)completionBlock;

/**
Animation block will be called inside [UIView animateWithDuration:::::].
@tip viewDidAppear is the best place to subscribe to keyboard events.
@param beforeWillShowOrHideAnimationBlock Preanimation actions should be performed inside this block.
@param willShowOrHideAnimationBlock User defined animations. If using auto layout don't forget to call layoutIfNeeded.
@param completionBlock User defined completion block, will be called when animation ends.
@warning These blocks will be holding inside UIViewController which calls it, so as with any block-style API avoid a retain cycle.
*/
- (void)rsk_subscribeKeyboardWithBeforeWillShowOrHideAnimation:(RSKKeyboardBeforeWillShowOrHideAnimationBlock)beforeWillShowOrHideAnimationBlock
willShowOrHideAnimation:(RSKKeyboardWillShowOrHideAnimationBlock)willShowOrHideAnimationBlock
onComplete:(RSKKeyboardWillShowOrHideAnimationCompletionBlock)completionBlock;
*/
- (void)rsk_subscribeKeyboardWithBeforeWillShowOrHideAnimation:(nullable RSKKeyboardBeforeWillShowOrHideAnimationBlock)beforeWillShowOrHideAnimationBlock
willShowOrHideAnimation:(nullable RSKKeyboardWillShowOrHideAnimationBlock)willShowOrHideAnimationBlock
onComplete:(nullable RSKKeyboardWillShowOrHideAnimationCompletionBlock)completionBlock;

/**
Animation block will be called inside [UIView animateWithDuration:::::].
@tip viewDidAppear is the best place to subscribe to keyboard events.
@param willChangeFrameAnimationBlock User defined animations. If using auto layout don't forget to call layoutIfNeeded.
@param completionBlock User defined completion block, will be called when animation ends.
@warning These blocks will be holding inside UIViewController which calls it, so as with any block-style API avoid a retain cycle.
*/
- (void)rsk_subscribeKeyboardWithWillChangeFrameAnimation:(RSKKeyboardWillChangeFrameAnimationBlock)willChangeFrameAnimationBlock
onComplete:(RSKKeyboardWillChangeFrameAnimationCompletionBlock)completionBlock;
*/
- (void)rsk_subscribeKeyboardWithWillChangeFrameAnimation:(nullable RSKKeyboardWillChangeFrameAnimationBlock)willChangeFrameAnimationBlock
onComplete:(nullable RSKKeyboardWillChangeFrameAnimationCompletionBlock)completionBlock;

/**
Animation block will be called inside [UIView animateWithDuration:::::].
@tip viewDidAppear is the best place to subscribe to keyboard events.
@param willShowOrHideAnimationBlock User defined animations. If using auto layout don't forget to call layoutIfNeeded.
@param completionBlock User defined completion block, will be called when animation ends.
@warning These blocks will be holding inside UIViewController which calls it, so as with any block-style API avoid a retain cycle.
*/
- (void)rsk_subscribeKeyboardWithWillShowOrHideAnimation:(RSKKeyboardWillShowOrHideAnimationBlock)willShowOrHideAnimationBlock
onComplete:(RSKKeyboardWillShowOrHideAnimationCompletionBlock)completionBlock;
*/
- (void)rsk_subscribeKeyboardWithWillShowOrHideAnimation:(nullable RSKKeyboardWillShowOrHideAnimationBlock)willShowOrHideAnimationBlock
onComplete:(nullable RSKKeyboardWillShowOrHideAnimationCompletionBlock)completionBlock;

/**
Call it to unsubscribe from keyboard events and clean all animations and completion blocks.
@tip viewDidDisappear is the best place to call it.
@warning If you will not call it when current view disappeared, subscribed view controller will handle keyboard events on other screens.
*/
*/
- (void)rsk_unsubscribeKeyboard;

@end

NS_ASSUME_NONNULL_END

0 comments on commit e320b07

Please sign in to comment.