NSObject+YHAnimationGroupInternal.m 986 Bytes
//
//  NSObject+YHAnimationGroupInternal.m
//  YHAnimationDemo
//
//  Created by gaoqiang xu on 2/9/15.
//  Copyright (c) 2015 gaoqiang. All rights reserved.
//

#import "NSObject+YHAnimationGroupInternal.h"
#import <objc/runtime.h>

static char kAnimationGroupsKey;
static char kActiveAnimationGroupKey;

@implementation NSObject (YHAnimationGroupInternal)

+ (NSMutableArray *)yh_animationGroups {
    NSMutableArray *array = objc_getAssociatedObject(self, &kAnimationGroupsKey);
    if (!array) {
        array = [NSMutableArray array];
        objc_setAssociatedObject(self, &kAnimationGroupsKey, array, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
    }
    return array;
}

+ (YHAnimationGroup *)yh_activeAnimationGroup {
    return objc_getAssociatedObject(self, &kActiveAnimationGroupKey);
}

+ (void)yh_setActiveAnimationGroup:(YHAnimationGroup *)animationGroup {
    objc_setAssociatedObject(self, &kActiveAnimationGroupKey, animationGroup, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}

@end