Skip to content

Instantly share code, notes, and snippets.

View saiday's full-sized avatar
:shipit:
su su su

Saiday saiday

:shipit:
su su su
View GitHub Profile
@saiday
saiday / TestCase.m
Last active September 17, 2015 15:28
@interface ViewControllerTests : XCTestCase
@property (nonatomic) CustomViewController *viewController;
@property (nonatomic) BOOL beenDealloc;
@property (nonatomic) id<AspectToken> aspectToken;
@end
- (void)setUp {
[super setUp];
#import <objc/runtime.h>
@interface AUIViewController (Test)
@property (nonatomic) UINavigationController *mockNavigationController;
@end
@implementation AUIViewController (Test)
@dynamic mockNavigationController;
find ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins -name Info.plist -maxdepth 3 | xargs -I{} defaults write {} DVTPlugInCompatibilityUUIDs -array-add `defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID`
@saiday
saiday / BaseAnimator.h
Last active August 29, 2015 14:23
BaseAnimator
#import <Foundation/Foundation.h>
typedef NS_ENUM(NSInteger, ModalAnimatedTransitioningType) {
ModalAnimatedTransitioningTypePresent,
ModalAnimatedTransitioningTypeDismiss
};
@interface BaseAnimator : NSObject <UIViewControllerAnimatedTransitioning>
@property (nonatomic) ModalAnimatedTransitioningType transitionType;
@saiday
saiday / BaseAnimator.m
Created June 15, 2015 10:09
BaseAnimator
#import "BaseAnimator.h"
@implementation BaseAnimator
- (void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext
{
UIViewController *to = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
UIViewController *from = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
if (self.transitionType == ModalAnimatedTransitioningTypePresent) {
@saiday
saiday / MiniToLargePlayerAnimator.h
Last active August 29, 2015 14:23
MiniToLargeViewAnimator
#import "BaseAnimator.h"
@interface MiniToLargeViewAnimator : BaseAnimator
@property (nonatomic) CGFloat initialY;
@end
@saiday
saiday / MiniToLargeViewAnimator.m
Last active August 29, 2015 14:23
MiniToLargeViewAnimator
#import "MiniToLargeViewAnimator.h"
static NSTimeInterval kAnimationDuration = .4f;
static NSString *const kFadeoutAnimationKey = @"FadeoutAnimationKey";
static NSString *const kFadeinAnimationKey = @"FadeinAnimationKey";
@implementation MiniToLargeViewAnimator
- (NSTimeInterval)transitionDuration:(id<UIViewControllerContextTransitioning>)transitionContext
{
@saiday
saiday / ExistViewController.m
Last active August 29, 2015 14:23
ExistViewController
@interface ExistViewController () <UIViewControllerTransitioningDelegate>
@end
@implementation BaseNavigationViewController
- (id<UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed
{
MiniToLargeViewAnimator *animator = [[MiniToLargeViewAnimator alloc] init];
animator.initialY = bottomBarHeight;
@saiday
saiday / MiniToLargeViewInteractive.h
Created June 15, 2015 13:18
MiniToLargePlayerInteractive
#import <UIKit/UIKit.h>
@interface MiniToLargeViewInteractive : UIPercentDrivenInteractiveTransition
@property (nonatomic) UIViewController *viewController;
@property (nonatomic) UIViewController *presentViewController;
@property (nonatomic) UIPanGestureRecognizer *pan;
- (void)attachToViewController:(UIViewController *)viewController withView:(UIView *)view presentViewController:(UIViewController *)presentViewController;
@end
@saiday
saiday / MiniToLargeViewInteractive.m
Last active November 19, 2015 08:34
MiniToLargeViewInteractive
#import "MiniToLargeViewInteractive.h"
@interface MiniToLargeViewInteractive ()
@property (nonatomic) BOOL shouldComplete;
@end
@implementation MiniToLargeViewInteractive