├── .gitignore ├── CDD ├── CDDContext.h ├── CDDContext.m ├── CDDMutableArray.h ├── CDDMutableArray.m ├── NSObject+CDD.h ├── NSObject+CDD.m ├── UIView+CDD.h └── UIView+CDD.m ├── CDDDemo.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── gaofeng.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── gaofeng.xcuserdatad │ └── xcschemes │ ├── CDDDemo.xcscheme │ └── xcschememanagement.plist ├── CDDDemo.xcworkspace ├── contents.xcworkspacedata └── xcuserdata │ └── gaofeng.xcuserdatad │ ├── UserInterfaceState.xcuserstate │ └── xcdebugger │ └── Breakpoints_v2.xcbkptlist ├── CDDDemo ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── CDDDemoBusinessObject.h ├── CDDDemoBusinessObject.m ├── CDDDemoBusinessObjectProtocol.h ├── CDDDemoController.h ├── CDDDemoController.m ├── CDDDemoDataHandler.h ├── CDDDemoDataHandler.m ├── CDDDemoDataHandlerProtocol.h ├── CDDDemoInputView.h ├── CDDDemoInputView.m ├── CDDDemoView.h ├── CDDDemoView.m ├── CDDDemo_Prefix.h ├── CDDUserDetailBusinessObject.h ├── CDDUserDetailBusinessObject.m ├── CDDUserDetailBusinessObjectProtocol.h ├── CDDUserDetailController.h ├── CDDUserDetailController.m ├── CDDUserDetailDataHandler.h ├── CDDUserDetailDataHandler.m ├── CDDUserDetailDataHandlerProtocol.h ├── CDDUserDetailView.h ├── CDDUserDetailView.m ├── ChatMessageBase.h ├── ChatMessageBase.m ├── ChatMessageText.h ├── ChatMessageText.m ├── Info.plist ├── MessageCellBase.h ├── MessageCellBase.m ├── MessageCellText.h ├── MessageCellText.m ├── UserProfile.h ├── UserProfile.m ├── ViewController.h ├── ViewController.m └── main.m ├── CDDDemoTests ├── CDDDemoTests.m └── Info.plist ├── CDDDemoUITests ├── CDDDemoUITests.m └── Info.plist ├── LICENSE ├── Podfile ├── Podfile.lock ├── Pods ├── Headers │ ├── Private │ │ ├── KVOController │ │ │ └── FBKVOController.h │ │ ├── Masonry │ │ │ ├── MASCompositeConstraint.h │ │ │ ├── MASConstraint+Private.h │ │ │ ├── MASConstraint.h │ │ │ ├── MASConstraintMaker.h │ │ │ ├── MASLayoutConstraint.h │ │ │ ├── MASUtilities.h │ │ │ ├── MASViewAttribute.h │ │ │ ├── MASViewConstraint.h │ │ │ ├── Masonry.h │ │ │ ├── NSArray+MASAdditions.h │ │ │ ├── NSArray+MASShorthandAdditions.h │ │ │ ├── NSLayoutConstraint+MASDebugAdditions.h │ │ │ ├── View+MASAdditions.h │ │ │ ├── View+MASShorthandAdditions.h │ │ │ └── ViewController+MASAdditions.h │ │ └── SDWebImage │ │ │ ├── NSData+ImageContentType.h │ │ │ ├── SDImageCache.h │ │ │ ├── SDWebImageCompat.h │ │ │ ├── SDWebImageDecoder.h │ │ │ ├── SDWebImageDownloader.h │ │ │ ├── SDWebImageDownloaderOperation.h │ │ │ ├── SDWebImageManager.h │ │ │ ├── SDWebImageOperation.h │ │ │ ├── SDWebImagePrefetcher.h │ │ │ ├── UIButton+WebCache.h │ │ │ ├── UIImage+GIF.h │ │ │ ├── UIImage+MultiFormat.h │ │ │ ├── UIImageView+HighlightedWebCache.h │ │ │ ├── UIImageView+WebCache.h │ │ │ └── UIView+WebCacheOperation.h │ └── Public │ │ ├── KVOController │ │ └── FBKVOController.h │ │ ├── Masonry │ │ ├── MASCompositeConstraint.h │ │ ├── MASConstraint+Private.h │ │ ├── MASConstraint.h │ │ ├── MASConstraintMaker.h │ │ ├── MASLayoutConstraint.h │ │ ├── MASUtilities.h │ │ ├── MASViewAttribute.h │ │ ├── MASViewConstraint.h │ │ ├── Masonry.h │ │ ├── NSArray+MASAdditions.h │ │ ├── NSArray+MASShorthandAdditions.h │ │ ├── NSLayoutConstraint+MASDebugAdditions.h │ │ ├── View+MASAdditions.h │ │ ├── View+MASShorthandAdditions.h │ │ └── ViewController+MASAdditions.h │ │ └── SDWebImage │ │ ├── NSData+ImageContentType.h │ │ ├── SDImageCache.h │ │ ├── SDWebImageCompat.h │ │ ├── SDWebImageDecoder.h │ │ ├── SDWebImageDownloader.h │ │ ├── SDWebImageDownloaderOperation.h │ │ ├── SDWebImageManager.h │ │ ├── SDWebImageOperation.h │ │ ├── SDWebImagePrefetcher.h │ │ ├── UIButton+WebCache.h │ │ ├── UIImage+GIF.h │ │ ├── UIImage+MultiFormat.h │ │ ├── UIImageView+HighlightedWebCache.h │ │ ├── UIImageView+WebCache.h │ │ └── UIView+WebCacheOperation.h ├── KVOController │ ├── FBKVOController │ │ ├── FBKVOController.h │ │ └── FBKVOController.m │ ├── LICENSE │ └── README.md ├── Manifest.lock ├── Masonry │ ├── LICENSE │ ├── Masonry │ │ ├── MASCompositeConstraint.h │ │ ├── MASCompositeConstraint.m │ │ ├── MASConstraint+Private.h │ │ ├── MASConstraint.h │ │ ├── MASConstraint.m │ │ ├── MASConstraintMaker.h │ │ ├── MASConstraintMaker.m │ │ ├── MASLayoutConstraint.h │ │ ├── MASLayoutConstraint.m │ │ ├── MASUtilities.h │ │ ├── MASViewAttribute.h │ │ ├── MASViewAttribute.m │ │ ├── MASViewConstraint.h │ │ ├── MASViewConstraint.m │ │ ├── Masonry.h │ │ ├── NSArray+MASAdditions.h │ │ ├── NSArray+MASAdditions.m │ │ ├── NSArray+MASShorthandAdditions.h │ │ ├── NSLayoutConstraint+MASDebugAdditions.h │ │ ├── NSLayoutConstraint+MASDebugAdditions.m │ │ ├── View+MASAdditions.h │ │ ├── View+MASAdditions.m │ │ ├── View+MASShorthandAdditions.h │ │ ├── ViewController+MASAdditions.h │ │ └── ViewController+MASAdditions.m │ └── README.md ├── Pods.xcodeproj │ ├── project.pbxproj │ └── xcuserdata │ │ └── gaofeng.xcuserdatad │ │ └── xcschemes │ │ ├── KVOController.xcscheme │ │ ├── Masonry.xcscheme │ │ ├── Pods-CDDDemo.xcscheme │ │ ├── SDWebImage.xcscheme │ │ └── xcschememanagement.plist ├── SDWebImage │ ├── LICENSE │ ├── README.md │ └── SDWebImage │ │ ├── NSData+ImageContentType.h │ │ ├── NSData+ImageContentType.m │ │ ├── SDImageCache.h │ │ ├── SDImageCache.m │ │ ├── SDWebImageCompat.h │ │ ├── SDWebImageCompat.m │ │ ├── SDWebImageDecoder.h │ │ ├── SDWebImageDecoder.m │ │ ├── SDWebImageDownloader.h │ │ ├── SDWebImageDownloader.m │ │ ├── SDWebImageDownloaderOperation.h │ │ ├── SDWebImageDownloaderOperation.m │ │ ├── SDWebImageManager.h │ │ ├── SDWebImageManager.m │ │ ├── SDWebImageOperation.h │ │ ├── SDWebImagePrefetcher.h │ │ ├── SDWebImagePrefetcher.m │ │ ├── UIButton+WebCache.h │ │ ├── UIButton+WebCache.m │ │ ├── UIImage+GIF.h │ │ ├── UIImage+GIF.m │ │ ├── UIImage+MultiFormat.h │ │ ├── UIImage+MultiFormat.m │ │ ├── UIImageView+HighlightedWebCache.h │ │ ├── UIImageView+HighlightedWebCache.m │ │ ├── UIImageView+WebCache.h │ │ ├── UIImageView+WebCache.m │ │ ├── UIView+WebCacheOperation.h │ │ └── UIView+WebCacheOperation.m └── Target Support Files │ ├── KVOController │ ├── KVOController-dummy.m │ ├── KVOController-prefix.pch │ └── KVOController.xcconfig │ ├── Masonry │ ├── Masonry-dummy.m │ ├── Masonry-prefix.pch │ └── Masonry.xcconfig │ ├── Pods-CDDDemo │ ├── Pods-CDDDemo-acknowledgements.markdown │ ├── Pods-CDDDemo-acknowledgements.plist │ ├── Pods-CDDDemo-dummy.m │ ├── Pods-CDDDemo-frameworks.sh │ ├── Pods-CDDDemo-resources.sh │ ├── Pods-CDDDemo.debug.xcconfig │ └── Pods-CDDDemo.release.xcconfig │ └── SDWebImage │ ├── SDWebImage-dummy.m │ ├── SDWebImage-prefix.pch │ └── SDWebImage.xcconfig └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata 19 | 20 | ## Other 21 | *.xccheckout 22 | *.moved-aside 23 | *.xcuserstate 24 | *.xcscmblueprint 25 | 26 | ## Obj-C/Swift specific 27 | *.hmap 28 | *.ipa 29 | 30 | # CocoaPods 31 | # 32 | # We recommend against adding the Pods directory to your .gitignore. However 33 | # you should judge for yourself, the pros and cons are mentioned at: 34 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 35 | # 36 | # Pods/ 37 | 38 | # Carthage 39 | # 40 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 41 | # Carthage/Checkouts 42 | 43 | Carthage/Build 44 | 45 | # fastlane 46 | # 47 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 48 | # screenshots whenever they are needed. 49 | # For more information about the recommended setup visit: 50 | # https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md 51 | 52 | fastlane/report.xml 53 | fastlane/screenshots 54 | -------------------------------------------------------------------------------- /CDD/CDDContext.h: -------------------------------------------------------------------------------- 1 | // 2 | // CDDContext.h 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/3. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "NSObject+CDD.h" 11 | 12 | @class CDDContext; 13 | 14 | //DataHandler owns data source, handle data changes 15 | @interface CDDDataHandler : NSObject 16 | @property (nonatomic, weak) CDDContext* weakContext; 17 | @end 18 | 19 | //BusinessObject takes care of all business logic 20 | @interface CDDBusinessObject : NSObject 21 | @property (nonatomic, weak) CDDContext* weakContext; 22 | @property (nonatomic, weak) UIViewController* baseController; 23 | 24 | @end 25 | 26 | 27 | 28 | //Context bridges everything automatically, no need to pass it around manually 29 | @interface CDDContext : NSObject 30 | 31 | @property (nonatomic, strong, readonly) CDDDataHandler* dataHandler;//handle viewModel change 32 | @property (nonatomic, strong, readonly) CDDBusinessObject* businessObject;//handle business logic 33 | 34 | - (instancetype)init UNAVAILABLE_ATTRIBUTE; 35 | + (instancetype)new UNAVAILABLE_ATTRIBUTE; 36 | 37 | + (void)enableCDDContext; 38 | 39 | - (instancetype)initWithDataHandler:(CDDDataHandler*)dataHandler withBusinessObject:(CDDBusinessObject*)businessObject NS_DESIGNATED_INITIALIZER; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /CDD/CDDContext.m: -------------------------------------------------------------------------------- 1 | // 2 | // CDDContext.m 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/3. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #import "CDDContext.h" 10 | #import "UIView+CDD.h" 11 | 12 | @implementation CDDDataHandler 13 | @end 14 | 15 | @implementation CDDBusinessObject 16 | @end 17 | 18 | @implementation CDDContext 19 | 20 | + (void)enableCDDContext 21 | { 22 | [UIView prepareUIViewForCDD]; 23 | } 24 | 25 | - (instancetype)initWithDataHandler:(CDDDataHandler*)dataHandler withBusinessObject:(CDDBusinessObject*)businessObject 26 | { 27 | self = [super init]; 28 | 29 | _dataHandler = dataHandler; 30 | _dataHandler.weakContext = self; 31 | 32 | _businessObject = businessObject; 33 | _businessObject.weakContext = self; 34 | 35 | return self; 36 | } 37 | 38 | - (void)dealloc 39 | { 40 | NSLog(@"context being released"); 41 | } 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /CDD/CDDMutableArray.h: -------------------------------------------------------------------------------- 1 | // 2 | // CDDMutableArray.h 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/18. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class CDDMutableArray; 12 | 13 | @protocol CDDMutableArrayDelegate 14 | 15 | - (void)didAddObject:(id)anObject withinArr:(CDDMutableArray*)arr; 16 | - (void)didRemoveObject:(id)anObject withinArr:(CDDMutableArray*)arr; 17 | 18 | @end 19 | 20 | @interface CDDMutableArray : NSMutableArray 21 | 22 | - (void)addArrayObserver:(id)observer; 23 | - (void)removeArrayObserver:(id)observer; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /CDD/CDDMutableArray.m: -------------------------------------------------------------------------------- 1 | // 2 | // CDDMutableArray.m 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/18. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #define SEMA_W(sema) dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER); 10 | #define SEMA_S(sema) dispatch_semaphore_signal(sema); 11 | 12 | #import "CDDMutableArray.h" 13 | 14 | @interface CDDMutableArrayObserverProxy : NSObject 15 | @property (nonatomic, weak) id realObserver; 16 | @end 17 | @implementation CDDMutableArrayObserverProxy 18 | @end 19 | 20 | @interface CDDMutableArray () 21 | @property (nonatomic, strong) NSMutableArray* arr; 22 | @property (nonatomic, strong) NSMutableArray* observers; 23 | @property (nonatomic, strong) dispatch_semaphore_t sema_arr; 24 | @property (nonatomic, strong) dispatch_semaphore_t sema_observer; 25 | @end 26 | 27 | @implementation CDDMutableArray 28 | 29 | - (instancetype)init 30 | { 31 | self = [super init]; 32 | if (self) { 33 | self.arr = [NSMutableArray new]; 34 | self.observers = [NSMutableArray new]; 35 | self.sema_arr = dispatch_semaphore_create(1); 36 | self.sema_observer = dispatch_semaphore_create(1); 37 | } 38 | return self; 39 | } 40 | 41 | - (void)addObject:(id)anObject 42 | { 43 | SEMA_W(_sema_arr) 44 | [_arr addObject:anObject]; 45 | SEMA_S(_sema_arr) 46 | 47 | SEMA_W(_sema_observer) 48 | for (CDDMutableArrayObserverProxy* ob in self.observers) { 49 | if ([ob.realObserver respondsToSelector:@selector(didAddObject:withinArr:)]) { 50 | [ob.realObserver didAddObject:anObject withinArr:self]; 51 | } 52 | } 53 | SEMA_S(_sema_observer) 54 | } 55 | 56 | - (void)removeObject:(id)anObject 57 | { 58 | SEMA_W(_sema_arr) 59 | [_arr removeObject:anObject]; 60 | SEMA_S(_sema_arr) 61 | 62 | SEMA_W(_sema_observer) 63 | for (CDDMutableArrayObserverProxy* ob in self.observers) { 64 | if ([ob.realObserver respondsToSelector:@selector(didRemoveObject:withinArr:)]) { 65 | [ob.realObserver didRemoveObject:anObject withinArr:self]; 66 | } 67 | } 68 | SEMA_S(_sema_observer) 69 | } 70 | 71 | - (void)addArrayObserver:(id)observer 72 | { 73 | if (observer && 74 | [observer conformsToProtocol:@protocol(CDDMutableArrayDelegate)]) { 75 | 76 | SEMA_W(_sema_observer) 77 | 78 | BOOL contains = false; 79 | for (CDDMutableArrayObserverProxy* proxy in self.observers) { 80 | if (proxy.realObserver == observer) { 81 | contains = true; 82 | } 83 | } 84 | if (contains == false) { 85 | CDDMutableArrayObserverProxy* proxy = [CDDMutableArrayObserverProxy new]; 86 | proxy.realObserver = observer; 87 | [self.observers addObject:proxy]; 88 | } 89 | 90 | SEMA_S(_sema_observer) 91 | } 92 | } 93 | 94 | - (void)removeArrayObserver:(id)observer 95 | { 96 | if (observer && 97 | [observer conformsToProtocol:@protocol(CDDMutableArrayDelegate)]) { 98 | 99 | SEMA_W(_sema_observer) 100 | 101 | CDDMutableArrayObserverProxy* targetProxy = nil; 102 | for (CDDMutableArrayObserverProxy* proxy in self.observers) { 103 | if (proxy.realObserver == observer) { 104 | targetProxy = proxy; 105 | } 106 | } 107 | 108 | if (targetProxy != nil) { 109 | [self.observers removeObject:targetProxy]; 110 | } 111 | 112 | SEMA_S(_sema_observer) 113 | } 114 | } 115 | 116 | #pragma mark- NSMutableArray methods 117 | 118 | - (NSUInteger)count { 119 | SEMA_W(_sema_arr) 120 | NSUInteger c = _arr.count; 121 | SEMA_S(_sema_arr) 122 | return c; 123 | } 124 | 125 | - (id)objectAtIndex:(NSUInteger)index { 126 | SEMA_W(_sema_arr) 127 | id obj = [_arr objectAtIndex:index]; 128 | SEMA_S(_sema_arr) 129 | return obj; 130 | } 131 | 132 | - (BOOL)containsObject:(id)anObject { 133 | SEMA_W(_sema_arr) 134 | BOOL contains = [_arr containsObject:anObject]; 135 | SEMA_S(_sema_arr) 136 | return contains; 137 | } 138 | 139 | - (void)dealloc 140 | { 141 | [self.observers removeAllObjects]; 142 | } 143 | 144 | @end 145 | -------------------------------------------------------------------------------- /CDD/NSObject+CDD.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+CDD.h 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/4. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class CDDContext; 12 | 13 | @interface NSObject (CDD) 14 | 15 | @property (nonatomic, strong) CDDContext* context; 16 | 17 | + (void)swizzleInstanceSelector:(SEL)oldSel withSelector:(SEL)newSel; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /CDD/NSObject+CDD.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+CDD.m 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/4. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #import "NSObject+CDD.h" 10 | #import "CDDContext.h" 11 | #import 12 | 13 | @implementation NSObject (CDD) 14 | @dynamic context; 15 | 16 | - (void)setContext:(CDDContext*)object { 17 | objc_setAssociatedObject(self, @selector(context), object, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 18 | } 19 | 20 | - (CDDContext*)context { 21 | return objc_getAssociatedObject(self, @selector(context)); 22 | } 23 | 24 | + (void)swizzleInstanceSelector:(SEL)oldSel withSelector:(SEL)newSel 25 | { 26 | Method oldMethod = class_getInstanceMethod(self, oldSel); 27 | Method newMethod = class_getInstanceMethod(self, newSel); 28 | if (!oldMethod || !newMethod) 29 | { 30 | return; 31 | } 32 | 33 | class_addMethod(self, 34 | oldSel, 35 | class_getMethodImplementation(self, oldSel), 36 | method_getTypeEncoding(oldMethod)); 37 | class_addMethod(self, 38 | newSel, 39 | class_getMethodImplementation(self, newSel), 40 | method_getTypeEncoding(newMethod)); 41 | 42 | method_exchangeImplementations(class_getInstanceMethod(self, oldSel), 43 | class_getInstanceMethod(self, newSel)); 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /CDD/UIView+CDD.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+CDD.h 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/4. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIView (CDD) 12 | 13 | + (void)prepareUIViewForCDD; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /CDD/UIView+CDD.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+CDD.m 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/4. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #import "UIView+CDD.h" 10 | #import "NSObject+CDD.h" 11 | 12 | @implementation UIView (CDD) 13 | 14 | + (void)prepareUIViewForCDD 15 | { 16 | [self swizzleInstanceSelector:@selector(didAddSubview:) withSelector:@selector(newDidAddSubview:)]; 17 | } 18 | 19 | - (void)newDidAddSubview:(UIView*)view 20 | { 21 | [self newDidAddSubview:view]; 22 | 23 | [self buildViewContextFromSuper:view]; 24 | } 25 | 26 | - (void)buildViewContextFromSuper:(UIView*)view 27 | { 28 | CFTimeInterval start = CACurrentMediaTime(); 29 | 30 | if (view.context == nil) { 31 | UIView* sprView = view.superview; 32 | while (sprView != nil) { 33 | if (sprView.context != nil) { 34 | view.context = sprView.context; 35 | 36 | [self buildViewContextForChildren:view withContext:view.context]; 37 | break; 38 | } 39 | 40 | sprView = sprView.superview; 41 | } 42 | } 43 | 44 | NSLog(@"buildViewContextFromSuper costs: %f ms", (CACurrentMediaTime()-start)*1000); 45 | } 46 | 47 | - (void)buildViewContextForChildren:(UIView*)view withContext:(CDDContext*)context 48 | { 49 | for (UIView* subview in view.subviews) { 50 | subview.context = context; 51 | 52 | [self buildViewContextForChildren:subview withContext:context]; 53 | } 54 | } 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /CDDDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CDDDemo.xcodeproj/project.xcworkspace/xcuserdata/gaofeng.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/music4kid/CDD/150305431e56b30b5746644b681a3869d7cabd8d/CDDDemo.xcodeproj/project.xcworkspace/xcuserdata/gaofeng.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /CDDDemo.xcodeproj/xcuserdata/gaofeng.xcuserdatad/xcschemes/CDDDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 43 | 49 | 50 | 51 | 52 | 53 | 59 | 60 | 61 | 62 | 63 | 64 | 74 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 95 | 101 | 102 | 103 | 104 | 106 | 107 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /CDDDemo.xcodeproj/xcuserdata/gaofeng.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | CDDDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 67109AB01C6228AF00C7251E 16 | 17 | primary 18 | 19 | 20 | 67109AC91C6228AF00C7251E 21 | 22 | primary 23 | 24 | 25 | 67109AD41C6228AF00C7251E 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /CDDDemo.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /CDDDemo.xcworkspace/xcuserdata/gaofeng.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/music4kid/CDD/150305431e56b30b5746644b681a3869d7cabd8d/CDDDemo.xcworkspace/xcuserdata/gaofeng.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /CDDDemo.xcworkspace/xcuserdata/gaofeng.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /CDDDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/3. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow* window; 14 | @property (nonatomic, strong) UINavigationController* rootNav; 15 | 16 | 17 | @end 18 | 19 | -------------------------------------------------------------------------------- /CDDDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/3. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "ViewController.h" 11 | #import "CDDContext.h" 12 | 13 | @interface AppDelegate () 14 | 15 | @end 16 | 17 | @implementation AppDelegate 18 | 19 | 20 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 21 | // Override point for customization after application launch. 22 | 23 | [CDDContext enableCDDContext]; 24 | 25 | ViewController* ctrl = [ViewController new]; 26 | self.rootNav = [[UINavigationController alloc] initWithRootViewController:ctrl]; 27 | 28 | 29 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 30 | self.window.rootViewController = self.rootNav; 31 | self.window.backgroundColor = [UIColor grayColor]; 32 | [self.window makeKeyAndVisible]; 33 | 34 | 35 | return YES; 36 | } 37 | 38 | - (void)applicationWillResignActive:(UIApplication *)application { 39 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 40 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 41 | } 42 | 43 | - (void)applicationDidEnterBackground:(UIApplication *)application { 44 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 45 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 46 | } 47 | 48 | - (void)applicationWillEnterForeground:(UIApplication *)application { 49 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 50 | } 51 | 52 | - (void)applicationDidBecomeActive:(UIApplication *)application { 53 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 54 | } 55 | 56 | - (void)applicationWillTerminate:(UIApplication *)application { 57 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 58 | } 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /CDDDemo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "83.5x83.5", 66 | "scale" : "2x" 67 | } 68 | ], 69 | "info" : { 70 | "version" : 1, 71 | "author" : "xcode" 72 | } 73 | } -------------------------------------------------------------------------------- /CDDDemo/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /CDDDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /CDDDemo/CDDDemoBusinessObject.h: -------------------------------------------------------------------------------- 1 | // 2 | // CDDDemoBusinessObject.h 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/4. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "CDDDemoBusinessObjectProtocol.h" 11 | #import "CDDContext.h" 12 | 13 | @interface CDDDemoBusinessObject : CDDBusinessObject 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /CDDDemo/CDDDemoBusinessObject.m: -------------------------------------------------------------------------------- 1 | // 2 | // CDDDemoBusinessObject.m 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/4. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #import "CDDDemoBusinessObject.h" 10 | #import "CDDUserDetailController.h" 11 | #import "ChatMessageText.h" 12 | #import "CDDDemoDataHandlerProtocol.h" 13 | #import "UserProfile.h" 14 | 15 | @implementation CDDDemoBusinessObject 16 | 17 | - (void)sendTextMessage:(NSString *)text 18 | { 19 | UserProfile* user = [UserProfile new]; 20 | user.userId = @1; 21 | user.userName = @"MrPeak"; 22 | user.avatarUrl = @"http://tp2.sinaimg.cn/1993445913/180/40110322733/1"; 23 | 24 | ChatMessageText* msg = [ChatMessageText new]; 25 | msg.content = text; 26 | msg.isLeft = false; 27 | msg.msgType = @(ChatMsgType_Text); 28 | msg.renderHeight = 58; 29 | msg.fromUser = user; 30 | 31 | //ignore db access here, since we don't have a service layer, let's pretend msg is saved to db automatically... 32 | id handler = (id)self.weakContext.dataHandler; 33 | [handler insertNewMessage:msg]; 34 | } 35 | 36 | - (void)gotoUserDetailView:(UserProfile*)user 37 | { 38 | CDDUserDetailController* ctrl = [CDDUserDetailController new]; 39 | ctrl.user = user; 40 | [self.baseController.navigationController pushViewController:ctrl animated:true]; 41 | } 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /CDDDemo/CDDDemoBusinessObjectProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // CDDDemoBusinessObjectProtocol.h 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/4. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #ifndef CDDDemoBusinessObjectProtocol_h 10 | #define CDDDemoBusinessObjectProtocol_h 11 | 12 | @class UserProfile; 13 | 14 | @protocol CDDDemoBusinessObjectProtocol 15 | 16 | - (void)sendTextMessage:(NSString*)text; 17 | 18 | - (void)gotoUserDetailView:(UserProfile*)user; 19 | 20 | @end 21 | 22 | #endif /* CDDDemoBusinessObjectProtocol_h */ 23 | -------------------------------------------------------------------------------- /CDDDemo/CDDDemoController.h: -------------------------------------------------------------------------------- 1 | // 2 | // CDDDemoController.h 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/4. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CDDDemoController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /CDDDemo/CDDDemoController.m: -------------------------------------------------------------------------------- 1 | // 2 | // CDDDemoController.m 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/4. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #import "CDDDemoController.h" 10 | #import "NSObject+CDD.h" 11 | 12 | #import "CDDDemoDataHandler.h" 13 | #import "CDDDemoBusinessObject.h" 14 | 15 | #import "CDDDemoView.h" 16 | #import "ChatMessageText.h" 17 | #import "UserProfile.h" 18 | 19 | @interface CDDDemoController () 20 | @property (nonatomic, strong) CDDDemoView* customView; 21 | @end 22 | 23 | @implementation CDDDemoController 24 | 25 | - (void)viewDidLoad { 26 | [super viewDidLoad]; 27 | // Do any additional setup after loading the view. 28 | 29 | self.title = @"CDDDemo"; 30 | 31 | [self initContext]; 32 | 33 | //create custom view 34 | self.customView = [[CDDDemoView alloc] initWithFrame:self.view.bounds]; 35 | self.view = _customView; 36 | _customView.context = self.context; 37 | [_customView buildDemoView]; 38 | } 39 | 40 | - (void)initContext 41 | { 42 | CDDDemoDataHandler* handler = [CDDDemoDataHandler new]; 43 | CDDDemoBusinessObject* bo = [CDDDemoBusinessObject new]; 44 | bo.baseController = self; 45 | 46 | self.context = [[CDDContext alloc] initWithDataHandler:handler withBusinessObject:bo]; 47 | 48 | UserProfile* user = [UserProfile new]; 49 | user.userId = @1; 50 | user.userName = @"MrPeak"; 51 | user.avatarUrl = @"http://tp2.sinaimg.cn/1993445913/180/40110322733/1"; 52 | 53 | //mock data source, view models should be constructed from raw models 54 | for (int i = 0; i < 100; i ++) { 55 | ChatMessageText* msg = [ChatMessageText new]; 56 | 57 | msg.content = [NSString stringWithFormat:@"www.mrpeak.cn:%d", i]; 58 | msg.isLeft = i%2==0?true:false; 59 | msg.msgType = @(ChatMsgType_Text); 60 | msg.renderHeight = 58; 61 | msg.fromUser = user; 62 | 63 | [handler insertNewMessage:msg]; 64 | } 65 | } 66 | 67 | - (void)dealloc 68 | { 69 | NSLog(@"being released"); 70 | } 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /CDDDemo/CDDDemoDataHandler.h: -------------------------------------------------------------------------------- 1 | // 2 | // CDDDemoDataHandler.h 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/4. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "CDDDemoDataHandlerProtocol.h" 11 | #import "CDDContext.h" 12 | #import "CDDMutableArray.h" 13 | 14 | @class ChatMessageBase; 15 | 16 | @interface CDDDemoDataHandler : CDDDataHandler 17 | 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /CDDDemo/CDDDemoDataHandler.m: -------------------------------------------------------------------------------- 1 | // 2 | // CDDDemoDataHandler.m 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/4. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #import "CDDDemoDataHandler.h" 10 | #import "ChatMessageBase.h" 11 | 12 | @interface CDDDemoDataHandler () 13 | @property (nonatomic, strong) CDDMutableArray* messages; 14 | @end 15 | 16 | @implementation CDDDemoDataHandler 17 | 18 | - (instancetype)init 19 | { 20 | self = [super init]; 21 | if (self) { 22 | self.messages = [CDDMutableArray new]; 23 | } 24 | return self; 25 | } 26 | 27 | - (CDDMutableArray*)getMessages 28 | { 29 | return self.messages; 30 | } 31 | 32 | - (void)insertNewMessage:(ChatMessageBase*)msg 33 | { 34 | [_messages addObject:msg]; 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /CDDDemo/CDDDemoDataHandlerProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // CDDDemoDataHandlerProtocol.h 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/4. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #ifndef CDDDemoDataHandlerProtocol_h 10 | #define CDDDemoDataHandlerProtocol_h 11 | 12 | @class CDDMutableArray; 13 | @class ChatMessageBase; 14 | 15 | @protocol CDDDemoDataHandlerProtocol 16 | 17 | - (CDDMutableArray*)getMessages; 18 | - (void)insertNewMessage:(ChatMessageBase*)msg; 19 | 20 | @end 21 | 22 | #endif /* CDDDemoDataHandlerProtocol_h */ 23 | -------------------------------------------------------------------------------- /CDDDemo/CDDDemoInputView.h: -------------------------------------------------------------------------------- 1 | // 2 | // CDDDemoInputView.h 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/4. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CDDDemoInputView : UIView 12 | 13 | - (void)initInputView; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /CDDDemo/CDDDemoInputView.m: -------------------------------------------------------------------------------- 1 | // 2 | // CDDDemoInputView.m 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/4. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #import "CDDDemoInputView.h" 10 | #import 11 | #import "CDDDemoBusinessObjectProtocol.h" 12 | #import "CDDContext.h" 13 | 14 | @interface CDDDemoInputView () 15 | @property (nonatomic, strong) UITextView* textView; 16 | @property (nonatomic, strong) UIButton* btnSend; 17 | 18 | 19 | @end 20 | 21 | @implementation CDDDemoInputView 22 | 23 | - (instancetype)initWithFrame:(CGRect)frame 24 | { 25 | self = [super initWithFrame:frame]; 26 | if (self) { 27 | self.backgroundColor = [UIColor lightGrayColor]; 28 | } 29 | return self; 30 | } 31 | 32 | - (void)initInputView 33 | { 34 | self.btnSend = [UIButton new]; 35 | [_btnSend addTarget:self action:@selector(btnSendClick) forControlEvents:UIControlEventTouchUpInside]; 36 | [_btnSend setTitle:@"Send" forState:UIControlStateNormal]; 37 | [self addSubview:_btnSend]; 38 | [_btnSend makeConstraints:^(MASConstraintMaker *make) { 39 | make.width.equalTo(80); 40 | make.height.equalTo(40); 41 | make.right.equalTo(self).offset(-4); 42 | make.centerY.equalTo(self); 43 | }]; 44 | 45 | self.textView = [UITextView new]; 46 | _textView.font = [UIFont systemFontOfSize:16]; 47 | [self addSubview:_textView]; 48 | [_textView makeConstraints:^(MASConstraintMaker *make) { 49 | make.left.equalTo(self).offset(4); 50 | make.right.equalTo(_btnSend.left).offset(-4); 51 | make.height.equalTo(40); 52 | make.centerY.equalTo(self); 53 | }]; 54 | } 55 | 56 | - (void)btnSendClick 57 | { 58 | NSString* text = self.textView.text; 59 | 60 | if ([self.context.businessObject respondsToSelector:@selector(sendTextMessage:)]) { 61 | id bo = (id)self.context.businessObject; 62 | [bo sendTextMessage:text]; 63 | } 64 | 65 | self.textView.text = nil; 66 | } 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /CDDDemo/CDDDemoView.h: -------------------------------------------------------------------------------- 1 | // 2 | // CDDDemoView.h 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/4. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CDDDemoView : UIView 12 | 13 | - (void)buildDemoView; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /CDDDemo/CDDDemo_Prefix.h: -------------------------------------------------------------------------------- 1 | // 2 | // CCDDemo_Prefix.h 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/4. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #ifdef __OBJC__ 10 | 11 | #import 12 | 13 | //define this constant if you want to use Masonry without the 'mas_' prefix 14 | #define MAS_SHORTHAND 15 | 16 | //define this constant if you want to enable auto-boxing for default syntax 17 | #define MAS_SHORTHAND_GLOBALS 18 | 19 | #endif 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /CDDDemo/CDDUserDetailBusinessObject.h: -------------------------------------------------------------------------------- 1 | // 2 | // CDDUserDetailBusinessObject.h 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/16. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #import "CDDContext.h" 10 | #import "CDDUserDetailBusinessObjectProtocol.h" 11 | 12 | @interface CDDUserDetailBusinessObject : CDDBusinessObject 13 | 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /CDDDemo/CDDUserDetailBusinessObject.m: -------------------------------------------------------------------------------- 1 | // 2 | // CDDUserDetailBusinessObject.m 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/16. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #import "CDDUserDetailBusinessObject.h" 10 | #import "CDDUserDetailDataHandlerProtocol.h" 11 | #import "UserProfile.h" 12 | 13 | @implementation CDDUserDetailBusinessObject 14 | 15 | - (void)changeUserName:(NSString*)name 16 | { 17 | id handler = (id)self.weakContext.dataHandler; 18 | UserProfile* user = [handler getUserProfile]; 19 | user.userName = name; 20 | } 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /CDDDemo/CDDUserDetailBusinessObjectProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // CDDUserDetailBusinessObjectProtocol.h 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/18. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol CDDUserDetailBusinessObjectProtocol 12 | 13 | - (void)changeUserName:(NSString*)name; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /CDDDemo/CDDUserDetailController.h: -------------------------------------------------------------------------------- 1 | // 2 | // CDDUserDetailController.h 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/16. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class UserProfile; 12 | 13 | @interface CDDUserDetailController : UIViewController 14 | 15 | @property (nonatomic, strong) UserProfile* user; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /CDDDemo/CDDUserDetailController.m: -------------------------------------------------------------------------------- 1 | // 2 | // CDDUserDetailController.m 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/16. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #import "CDDUserDetailController.h" 10 | #import "CDDUserDetailView.h" 11 | #import "CDDUserDetailDataHandler.h" 12 | #import "CDDUserDetailBusinessObject.h" 13 | 14 | @interface CDDUserDetailController () 15 | @property (nonatomic, strong) CDDUserDetailView* customView; 16 | @end 17 | 18 | @implementation CDDUserDetailController 19 | 20 | - (void)viewDidLoad { 21 | [super viewDidLoad]; 22 | // Do any additional setup after loading the view. 23 | 24 | self.title = @"CDDUserDetail"; 25 | 26 | [self initContext]; 27 | 28 | //create custom view 29 | self.customView = [[CDDUserDetailView alloc] initWithFrame:self.view.bounds]; 30 | self.view = _customView; 31 | _customView.context = self.context; 32 | [_customView initDetailView]; 33 | } 34 | 35 | - (void)initContext 36 | { 37 | CDDUserDetailDataHandler* handler = [CDDUserDetailDataHandler new]; 38 | [handler setUserProfile:self.user]; 39 | CDDUserDetailBusinessObject* bo = [CDDUserDetailBusinessObject new]; 40 | bo.baseController = self; 41 | 42 | self.context = [[CDDContext alloc] initWithDataHandler:handler withBusinessObject:bo]; 43 | } 44 | 45 | - (void)dealloc 46 | { 47 | NSLog(@"being released"); 48 | } 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /CDDDemo/CDDUserDetailDataHandler.h: -------------------------------------------------------------------------------- 1 | // 2 | // CDDUserDetailDataHandler.h 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/16. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #import "CDDContext.h" 10 | #import "CDDUserDetailDataHandlerProtocol.h" 11 | 12 | @class UserProfile; 13 | 14 | @interface CDDUserDetailDataHandler : CDDDataHandler 15 | 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /CDDDemo/CDDUserDetailDataHandler.m: -------------------------------------------------------------------------------- 1 | // 2 | // CDDUserDetailDataHandler.m 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/16. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #import "CDDUserDetailDataHandler.h" 10 | 11 | @interface CDDUserDetailDataHandler () 12 | @property (nonatomic, strong) UserProfile* user; 13 | @end 14 | 15 | @implementation CDDUserDetailDataHandler 16 | 17 | - (void)setUserProfile:(UserProfile*)user 18 | { 19 | self.user = user; 20 | } 21 | 22 | - (UserProfile*)getUserProfile 23 | { 24 | return self.user; 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /CDDDemo/CDDUserDetailDataHandlerProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // CDDUserDetailDataHandlerProtocol.h 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/18. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class UserProfile; 12 | 13 | @protocol CDDUserDetailDataHandlerProtocol 14 | 15 | - (void)setUserProfile:(UserProfile*)user; 16 | - (UserProfile*)getUserProfile; 17 | 18 | @end -------------------------------------------------------------------------------- /CDDDemo/CDDUserDetailView.h: -------------------------------------------------------------------------------- 1 | // 2 | // CDDUserDetailView.h 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/16. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CDDUserDetailView : UIView 12 | 13 | - (void)initDetailView; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /CDDDemo/CDDUserDetailView.m: -------------------------------------------------------------------------------- 1 | // 2 | // CDDUserDetailView.m 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/16. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #import "CDDUserDetailView.h" 10 | #import 11 | #import "CDDUserDetailBusinessObjectProtocol.h" 12 | #import "CDDUserDetailDataHandlerProtocol.h" 13 | #import 14 | #import "UserProfile.h" 15 | #import "CDDContext.h" 16 | 17 | @interface CDDUserDetailView () 18 | @property (nonatomic, strong) UILabel* lbName; 19 | @property (nonatomic, strong) UIButton* btnChange; 20 | 21 | @end 22 | 23 | @implementation CDDUserDetailView 24 | 25 | - (instancetype)initWithFrame:(CGRect)frame 26 | { 27 | self = [super initWithFrame:frame]; 28 | if (self) { 29 | self.backgroundColor = [UIColor colorWithWhite:0.9 alpha:1.0]; 30 | } 31 | return self; 32 | } 33 | 34 | - (void)initDetailView 35 | { 36 | self.lbName = [UILabel new]; 37 | _lbName.backgroundColor = [UIColor clearColor]; 38 | _lbName.font = [UIFont systemFontOfSize:16]; 39 | _lbName.textColor = [UIColor blackColor]; 40 | _lbName.textAlignment = NSTextAlignmentCenter; 41 | [self addSubview:_lbName]; 42 | 43 | [_lbName mas_makeConstraints:^(MASConstraintMaker *make) { 44 | make.top.equalTo(self).offset(150); 45 | make.centerX.equalTo(self); 46 | make.width.equalTo(self); 47 | make.height.equalTo(18); 48 | }]; 49 | 50 | self.btnChange = [UIButton new]; 51 | _btnChange.backgroundColor = [UIColor darkGrayColor]; 52 | [_btnChange setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 53 | [_btnChange setTitle:@"Change" forState:UIControlStateNormal]; 54 | [self addSubview:_btnChange]; 55 | [_btnChange addTarget:self action:@selector(btnChangeClick:) forControlEvents:UIControlEventTouchUpInside]; 56 | 57 | [_btnChange makeConstraints:^(MASConstraintMaker *make) { 58 | make.top.equalTo(_lbName.bottom).offset(20); 59 | make.centerX.equalTo(self); 60 | make.width.equalTo(120); 61 | make.height.equalTo(60); 62 | }]; 63 | 64 | 65 | id handler = (id)self.context.dataHandler; 66 | 67 | //observe value change 68 | __weak __typeof(self) weakSelf = self; 69 | [self.KVOController unobserveAll]; 70 | 71 | [self.KVOController observe:[handler getUserProfile] keyPath:@"userName" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionInitial block:^(id observer, id object, NSDictionary *change) { 72 | dispatch_async(dispatch_get_main_queue(), ^{ 73 | [weakSelf detectUserNameChange:change]; 74 | }); 75 | }]; 76 | } 77 | 78 | - (void)detectUserNameChange:(NSDictionary*)info 79 | { 80 | NSString* name = info[NSKeyValueChangeNewKey]; 81 | _lbName.text = name; 82 | } 83 | 84 | - (void)btnChangeClick:(id)sender 85 | { 86 | id bo = (id)self.context.businessObject; 87 | NSString* randomName = [NSString stringWithFormat:@"MrPeak-%d", arc4random()%1000]; 88 | if ([bo respondsToSelector:@selector(changeUserName:)]) { 89 | [bo changeUserName:randomName]; 90 | } 91 | } 92 | 93 | @end 94 | -------------------------------------------------------------------------------- /CDDDemo/ChatMessageBase.h: -------------------------------------------------------------------------------- 1 | // 2 | // ChatMessageBase.h 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/4. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef enum : NSUInteger { 12 | ChatMsgType_Text = 0, 13 | ChatMsgType_Image, 14 | ChatMsgType_Voice, 15 | } ChatMsgType; 16 | 17 | @class UserProfile; 18 | 19 | @interface ChatMessageBase : NSObject 20 | 21 | @property (nonatomic, strong) NSNumber* msgType; 22 | @property (nonatomic, strong) UserProfile* fromUser; 23 | 24 | 25 | @property (nonatomic, assign) float renderWidth; 26 | @property (nonatomic, assign) float renderHeight; 27 | @property (nonatomic, assign) BOOL isLeft;//message position, left or right. 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /CDDDemo/ChatMessageBase.m: -------------------------------------------------------------------------------- 1 | // 2 | // ChatMessageBase.m 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/4. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #import "ChatMessageBase.h" 10 | 11 | @implementation ChatMessageBase 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /CDDDemo/ChatMessageText.h: -------------------------------------------------------------------------------- 1 | // 2 | // ChatMessageText.h 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/4. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #import "ChatMessageBase.h" 10 | 11 | @interface ChatMessageText : ChatMessageBase 12 | 13 | @property (nonatomic, strong) NSString* content; 14 | 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /CDDDemo/ChatMessageText.m: -------------------------------------------------------------------------------- 1 | // 2 | // ChatMessageText.m 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/4. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #import "ChatMessageText.h" 10 | 11 | @implementation ChatMessageText 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /CDDDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | LaunchScreen 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | NSAppTransportSecurity 47 | 48 | NSAllowsArbitraryLoads 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /CDDDemo/MessageCellBase.h: -------------------------------------------------------------------------------- 1 | // 2 | // MessageCellBase.h 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/4. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "ChatMessageBase.h" 11 | 12 | @interface MessageCellBase : UITableViewCell 13 | 14 | @property (nonatomic, strong) ChatMessageBase* chatMsg; 15 | 16 | + (NSMutableDictionary*)getRegisteredRenderCellMap; 17 | + (void)registerRenderCell:(Class)cellClass messageType:(int)mtype; 18 | 19 | + (float)calculteRenderCellHeight:(ChatMessageBase*)msg; 20 | + (Class)getRenderClassByMessageType:(int)msgType; 21 | 22 | - (void)doMessageRendering; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /CDDDemo/MessageCellBase.m: -------------------------------------------------------------------------------- 1 | // 2 | // MessageCellBase.m 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/4. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #import "MessageCellBase.h" 10 | 11 | @implementation MessageCellBase 12 | 13 | static NSMutableDictionary* registeredRenderCellMap = NULL; 14 | 15 | + (NSMutableDictionary*)getRegisteredRenderCellMap 16 | { 17 | return registeredRenderCellMap; 18 | } 19 | 20 | + (void)registerRenderCell:(Class)cellClass messageType:(int)mtype 21 | { 22 | if (!registeredRenderCellMap) { 23 | registeredRenderCellMap = [NSMutableDictionary new]; 24 | } 25 | NSString* className = NSStringFromClass(cellClass); 26 | [registeredRenderCellMap setObject:className forKey:[NSNumber numberWithInt:mtype]]; 27 | } 28 | 29 | + (float)calculteRenderCellHeight:(ChatMessageBase*)msg 30 | { 31 | return 0; 32 | } 33 | 34 | + (Class)getRenderClassByMessageType:(int)msgType 35 | { 36 | Class renderClass = NULL; 37 | NSMutableDictionary* renderMap = [MessageCellBase getRegisteredRenderCellMap]; 38 | NSString* className = [renderMap objectForKey:[NSNumber numberWithInt:msgType]]; 39 | if (!className) { 40 | className = @"CCMessageCellUnknown"; 41 | } 42 | renderClass = NSClassFromString(className); 43 | return renderClass; 44 | } 45 | 46 | - (void)doMessageRendering 47 | { 48 | 49 | } 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /CDDDemo/MessageCellText.h: -------------------------------------------------------------------------------- 1 | // 2 | // MessageCellText.h 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/4. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #import "MessageCellBase.h" 10 | 11 | @interface MessageCellText : MessageCellBase 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /CDDDemo/MessageCellText.m: -------------------------------------------------------------------------------- 1 | // 2 | // MessageCellText.m 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/4. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #import "MessageCellText.h" 10 | #import "ChatMessageText.h" 11 | #import 12 | #import 13 | #import "CDDContext.h" 14 | #import "CDDDemoBusinessObjectProtocol.h" 15 | #import "UserProfile.h" 16 | #import 17 | 18 | #define kMessageCellTextAvatarSize 48 19 | 20 | @interface MessageCellText () 21 | 22 | @property (nonatomic, strong) UIImageView* imgCellBg; 23 | @property (nonatomic, strong) UIButton* imgAvatar; 24 | @property (nonatomic, strong) UILabel* lbFromName; 25 | @property (nonatomic, strong) UILabel* lbContent; 26 | 27 | @end 28 | 29 | @implementation MessageCellText 30 | 31 | + (void)load 32 | { 33 | [super registerRenderCell:[self class] messageType:ChatMsgType_Text]; 34 | } 35 | 36 | - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier 37 | { 38 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; 39 | if (self) { 40 | 41 | self.imgCellBg = [UIImageView new]; 42 | _imgCellBg.backgroundColor = [UIColor clearColor]; 43 | [self.contentView addSubview:_imgCellBg]; 44 | 45 | self.imgAvatar = [UIButton new]; 46 | _imgAvatar.backgroundColor = [UIColor clearColor]; 47 | [self.contentView addSubview:_imgAvatar]; 48 | [_imgAvatar addTarget:self action:@selector(btnAvatarClicked:) forControlEvents:UIControlEventTouchUpInside]; 49 | 50 | self.lbFromName = [UILabel new]; 51 | _lbFromName.backgroundColor = [UIColor clearColor]; 52 | _lbFromName.font = [UIFont systemFontOfSize:11]; 53 | _lbFromName.textColor = [UIColor grayColor]; 54 | _lbFromName.textAlignment = NSTextAlignmentRight; 55 | [self.contentView addSubview:_lbFromName]; 56 | 57 | self.lbContent = [UILabel new]; 58 | _lbContent.backgroundColor = [UIColor clearColor]; 59 | _lbContent.font = [UIFont systemFontOfSize:16]; 60 | _lbContent.textColor = [UIColor blackColor]; 61 | _lbContent.textAlignment = NSTextAlignmentRight; 62 | [self.contentView addSubview:_lbContent]; 63 | 64 | } 65 | return self; 66 | } 67 | 68 | + (float)calculteRenderCellHeight:(ChatMessageBase*)msg 69 | { 70 | int height = 0; 71 | 72 | height = 48+10; 73 | 74 | return height; 75 | } 76 | 77 | - (void)doMessageRendering 78 | { 79 | ChatMessageText* msg = (ChatMessageText*)self.chatMsg; 80 | 81 | //do layout 82 | [_imgAvatar makeConstraints:^(MASConstraintMaker *make) { 83 | make.width.equalTo(kMessageCellTextAvatarSize); 84 | make.height.equalTo(kMessageCellTextAvatarSize); 85 | make.right.equalTo(self.contentView).offset(-10); 86 | make.top.equalTo(self.contentView); 87 | }]; 88 | 89 | [_lbFromName makeConstraints:^(MASConstraintMaker *make) { 90 | make.right.equalTo(_imgAvatar.left).offset(-10); 91 | make.top.equalTo(_imgAvatar.top); 92 | make.height.equalTo(12); 93 | make.width.equalTo(100); 94 | }]; 95 | 96 | [_lbContent makeConstraints:^(MASConstraintMaker *make) { 97 | make.right.equalTo(_imgAvatar.left).offset(-10); 98 | make.top.equalTo(_lbFromName.top).offset(10); 99 | make.height.equalTo(17); 100 | make.width.equalTo(200); 101 | }]; 102 | 103 | _lbContent.text = msg.content; 104 | [_imgAvatar sd_setImageWithURL:[NSURL URLWithString:msg.fromUser.avatarUrl] forState:UIControlStateNormal]; 105 | 106 | 107 | //observe value change 108 | __weak __typeof(self) weakSelf = self; 109 | [self.KVOController unobserveAll]; 110 | 111 | [self.KVOController observe:msg.fromUser keyPath:@"userName" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionInitial block:^(id observer, id object, NSDictionary *change) { 112 | dispatch_async(dispatch_get_main_queue(), ^{ 113 | [weakSelf detectUserNameChange:change]; 114 | }); 115 | }]; 116 | } 117 | 118 | - (void)detectUserNameChange:(NSDictionary*)info 119 | { 120 | NSString* name = info[NSKeyValueChangeNewKey]; 121 | _lbFromName.text = name; 122 | } 123 | 124 | - (void)btnAvatarClicked:(id)sender 125 | { 126 | if ([self.context.businessObject respondsToSelector:@selector(gotoUserDetailView:)]) { 127 | id bo = (id)self.context.businessObject; 128 | [bo gotoUserDetailView:self.chatMsg.fromUser]; 129 | } 130 | } 131 | 132 | @end 133 | -------------------------------------------------------------------------------- /CDDDemo/UserProfile.h: -------------------------------------------------------------------------------- 1 | // 2 | // UserProfile.h 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/18. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UserProfile : NSObject 12 | 13 | @property (nonatomic, strong) NSNumber* userId; 14 | @property (nonatomic, strong) NSString* userName; 15 | @property (nonatomic, strong) NSString* avatarUrl; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /CDDDemo/UserProfile.m: -------------------------------------------------------------------------------- 1 | // 2 | // UserProfile.m 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/18. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #import "UserProfile.h" 10 | 11 | @implementation UserProfile 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /CDDDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/3. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /CDDDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/3. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import 11 | #import "CDDDemoController.h" 12 | 13 | @interface ViewController () 14 | 15 | @end 16 | 17 | @implementation ViewController 18 | 19 | - (void)viewDidLoad { 20 | [super viewDidLoad]; 21 | // Do any additional setup after loading the view, typically from a nib. 22 | 23 | self.view.backgroundColor = [UIColor whiteColor]; 24 | 25 | int btnWidth = 100; 26 | int btnHeight = 100; 27 | 28 | UIButton* btn = UIButton.new; 29 | [btn setTitle:@"Demo" forState:UIControlStateNormal]; 30 | [btn setBackgroundColor:[UIColor purpleColor]]; 31 | [btn addTarget:self action:@selector(gotoDemoController) forControlEvents:UIControlEventTouchUpInside]; 32 | [self.view addSubview:btn]; 33 | 34 | [btn makeConstraints:^(MASConstraintMaker *make) { 35 | make.centerX.equalTo(self.view); 36 | make.centerY.equalTo(self.view); 37 | make.width.equalTo(btnWidth); 38 | make.height.equalTo(btnHeight); 39 | }]; 40 | } 41 | 42 | - (void)didReceiveMemoryWarning { 43 | [super didReceiveMemoryWarning]; 44 | // Dispose of any resources that can be recreated. 45 | } 46 | 47 | - (void)gotoDemoController 48 | { 49 | CDDDemoController* ctrl = [CDDDemoController new]; 50 | [self.navigationController pushViewController:ctrl animated:true]; 51 | } 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /CDDDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // CDDDemo 4 | // 5 | // Created by gao feng on 16/2/3. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /CDDDemoTests/CDDDemoTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // CDDDemoTests.m 3 | // CDDDemoTests 4 | // 5 | // Created by gao feng on 16/2/3. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CDDDemoTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation CDDDemoTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /CDDDemoTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /CDDDemoUITests/CDDDemoUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // CDDDemoUITests.m 3 | // CDDDemoUITests 4 | // 5 | // Created by gao feng on 16/2/3. 6 | // Copyright © 2016年 gao feng. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CDDDemoUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation CDDDemoUITests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | 22 | // In UI tests it is usually best to stop immediately when a failure occurs. 23 | self.continueAfterFailure = NO; 24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 25 | [[[XCUIApplication alloc] init] launch]; 26 | 27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 28 | } 29 | 30 | - (void)tearDown { 31 | // Put teardown code here. This method is called after the invocation of each test method in the class. 32 | [super tearDown]; 33 | } 34 | 35 | - (void)testExample { 36 | // Use recording to get started writing UI tests. 37 | // Use XCTAssert and related functions to verify your tests produce the correct results. 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /CDDDemoUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 gao feng 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '8.0' 3 | # Uncomment this line if you're using Swift 4 | # use_frameworks! 5 | 6 | target 'CDDDemo' do 7 | pod 'Masonry', '~> 0.6.3' 8 | pod 'SDWebImage', '~> 3.7.3' 9 | pod 'KVOController', '~> 1.0.3' 10 | end 11 | 12 | target 'CDDDemoTests' do 13 | 14 | end 15 | 16 | target 'CDDDemoUITests' do 17 | 18 | end 19 | 20 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - KVOController (1.0.3) 3 | - Masonry (0.6.3) 4 | - SDWebImage (3.7.3): 5 | - SDWebImage/Core (= 3.7.3) 6 | - SDWebImage/Core (3.7.3) 7 | 8 | DEPENDENCIES: 9 | - KVOController (~> 1.0.3) 10 | - Masonry (~> 0.6.3) 11 | - SDWebImage (~> 3.7.3) 12 | 13 | SPEC CHECKSUMS: 14 | KVOController: 9fd8f0343670994e4b6f9f0b31f5a45663f3e1cf 15 | Masonry: ff105a956abcd19a618b2028b121cb638d7a8e2f 16 | SDWebImage: 1d2b1a1efda1ade1b00b6f8498865f8ddedc8a84 17 | 18 | COCOAPODS: 0.39.0 19 | -------------------------------------------------------------------------------- /Pods/Headers/Private/KVOController/FBKVOController.h: -------------------------------------------------------------------------------- 1 | ../../../KVOController/FBKVOController/FBKVOController.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/MASCompositeConstraint.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASCompositeConstraint.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/MASConstraint+Private.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASConstraint+Private.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/MASConstraint.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASConstraint.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/MASConstraintMaker.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASConstraintMaker.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/MASLayoutConstraint.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASLayoutConstraint.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/MASUtilities.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASUtilities.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/MASViewAttribute.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASViewAttribute.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/MASViewConstraint.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASViewConstraint.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/Masonry.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/Masonry.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/NSArray+MASAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/NSArray+MASAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/NSArray+MASShorthandAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/NSArray+MASShorthandAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/NSLayoutConstraint+MASDebugAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/NSLayoutConstraint+MASDebugAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/View+MASAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/View+MASAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/View+MASShorthandAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/View+MASShorthandAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Masonry/ViewController+MASAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/ViewController+MASAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Private/SDWebImage/NSData+ImageContentType.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/NSData+ImageContentType.h -------------------------------------------------------------------------------- /Pods/Headers/Private/SDWebImage/SDImageCache.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDImageCache.h -------------------------------------------------------------------------------- /Pods/Headers/Private/SDWebImage/SDWebImageCompat.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageCompat.h -------------------------------------------------------------------------------- /Pods/Headers/Private/SDWebImage/SDWebImageDecoder.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageDecoder.h -------------------------------------------------------------------------------- /Pods/Headers/Private/SDWebImage/SDWebImageDownloader.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageDownloader.h -------------------------------------------------------------------------------- /Pods/Headers/Private/SDWebImage/SDWebImageDownloaderOperation.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageDownloaderOperation.h -------------------------------------------------------------------------------- /Pods/Headers/Private/SDWebImage/SDWebImageManager.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageManager.h -------------------------------------------------------------------------------- /Pods/Headers/Private/SDWebImage/SDWebImageOperation.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageOperation.h -------------------------------------------------------------------------------- /Pods/Headers/Private/SDWebImage/SDWebImagePrefetcher.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImagePrefetcher.h -------------------------------------------------------------------------------- /Pods/Headers/Private/SDWebImage/UIButton+WebCache.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIButton+WebCache.h -------------------------------------------------------------------------------- /Pods/Headers/Private/SDWebImage/UIImage+GIF.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIImage+GIF.h -------------------------------------------------------------------------------- /Pods/Headers/Private/SDWebImage/UIImage+MultiFormat.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIImage+MultiFormat.h -------------------------------------------------------------------------------- /Pods/Headers/Private/SDWebImage/UIImageView+HighlightedWebCache.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIImageView+HighlightedWebCache.h -------------------------------------------------------------------------------- /Pods/Headers/Private/SDWebImage/UIImageView+WebCache.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIImageView+WebCache.h -------------------------------------------------------------------------------- /Pods/Headers/Private/SDWebImage/UIView+WebCacheOperation.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIView+WebCacheOperation.h -------------------------------------------------------------------------------- /Pods/Headers/Public/KVOController/FBKVOController.h: -------------------------------------------------------------------------------- 1 | ../../../KVOController/FBKVOController/FBKVOController.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/MASCompositeConstraint.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASCompositeConstraint.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/MASConstraint+Private.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASConstraint+Private.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/MASConstraint.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASConstraint.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/MASConstraintMaker.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASConstraintMaker.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/MASLayoutConstraint.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASLayoutConstraint.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/MASUtilities.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASUtilities.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/MASViewAttribute.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASViewAttribute.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/MASViewConstraint.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/MASViewConstraint.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/Masonry.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/Masonry.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/NSArray+MASAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/NSArray+MASAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/NSArray+MASShorthandAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/NSArray+MASShorthandAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/NSLayoutConstraint+MASDebugAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/NSLayoutConstraint+MASDebugAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/View+MASAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/View+MASAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/View+MASShorthandAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/View+MASShorthandAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Masonry/ViewController+MASAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Masonry/Masonry/ViewController+MASAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Public/SDWebImage/NSData+ImageContentType.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/NSData+ImageContentType.h -------------------------------------------------------------------------------- /Pods/Headers/Public/SDWebImage/SDImageCache.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDImageCache.h -------------------------------------------------------------------------------- /Pods/Headers/Public/SDWebImage/SDWebImageCompat.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageCompat.h -------------------------------------------------------------------------------- /Pods/Headers/Public/SDWebImage/SDWebImageDecoder.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageDecoder.h -------------------------------------------------------------------------------- /Pods/Headers/Public/SDWebImage/SDWebImageDownloader.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageDownloader.h -------------------------------------------------------------------------------- /Pods/Headers/Public/SDWebImage/SDWebImageDownloaderOperation.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageDownloaderOperation.h -------------------------------------------------------------------------------- /Pods/Headers/Public/SDWebImage/SDWebImageManager.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageManager.h -------------------------------------------------------------------------------- /Pods/Headers/Public/SDWebImage/SDWebImageOperation.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImageOperation.h -------------------------------------------------------------------------------- /Pods/Headers/Public/SDWebImage/SDWebImagePrefetcher.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/SDWebImagePrefetcher.h -------------------------------------------------------------------------------- /Pods/Headers/Public/SDWebImage/UIButton+WebCache.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIButton+WebCache.h -------------------------------------------------------------------------------- /Pods/Headers/Public/SDWebImage/UIImage+GIF.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIImage+GIF.h -------------------------------------------------------------------------------- /Pods/Headers/Public/SDWebImage/UIImage+MultiFormat.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIImage+MultiFormat.h -------------------------------------------------------------------------------- /Pods/Headers/Public/SDWebImage/UIImageView+HighlightedWebCache.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIImageView+HighlightedWebCache.h -------------------------------------------------------------------------------- /Pods/Headers/Public/SDWebImage/UIImageView+WebCache.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIImageView+WebCache.h -------------------------------------------------------------------------------- /Pods/Headers/Public/SDWebImage/UIView+WebCacheOperation.h: -------------------------------------------------------------------------------- 1 | ../../../SDWebImage/SDWebImage/UIView+WebCacheOperation.h -------------------------------------------------------------------------------- /Pods/KVOController/LICENSE: -------------------------------------------------------------------------------- 1 | BSD License 2 | 3 | For KVOController software 4 | 5 | Copyright (c) 2014, Facebook, Inc. All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 10 | * Redistributions of source code must retain the above copyright notice, this 11 | list of conditions and the following disclaimer. 12 | 13 | * Redistributions in binary form must reproduce the above copyright notice, 14 | this list of conditions and the following disclaimer in the documentation 15 | and/or other materials provided with the distribution. 16 | 17 | * Neither the name Facebook nor the names of its contributors may be used to 18 | endorse or promote products derived from this software without specific 19 | prior written permission. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 22 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 23 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 25 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 27 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 28 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | -------------------------------------------------------------------------------- /Pods/KVOController/README.md: -------------------------------------------------------------------------------- 1 | # [KVOController](https://github.com/facebook/KVOController) 2 | [![Build Status](https://travis-ci.org/facebook/KVOController.png?branch=master)](https://travis-ci.org/facebook/KVOController) 3 | [![Version](https://cocoapod-badges.herokuapp.com/v/KVOController/badge.png)](http://cocoadocs.org/docsets/KVOController) 4 | [![Platform](https://cocoapod-badges.herokuapp.com/p/KVOController/badge.png)](http://cocoadocs.org/docsets/KVOController) 5 | 6 | Key-value observing is a particularly useful technique for communicating between layers in a Model-View-Controller application. KVOController builds on Cocoa's time-tested key-value observing implementation. It offers a simple, modern API, that is also thread safe. Benefits include: 7 | 8 | - Notification using blocks, custom actions, or NSKeyValueObserving callback. 9 | - No exceptions on observer removal. 10 | - Implicit observer removal on controller dealloc. 11 | - Thread-safety with special guards against observer resurrection – [rdar://15985376](http://openradar.appspot.com/radar?id=5305010728468480). 12 | 13 | For more information on KVO, see Apple's [Introduction to Key-Value Observing](https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/KeyValueObserving/KeyValueObserving.html). 14 | 15 | ## Usage 16 | 17 | Example apps for iOS and OS X are included with the project. Here is one simple usage pattern: 18 | 19 | ```objective-c 20 | // create KVO controller with observer 21 | FBKVOController *KVOController = [FBKVOController controllerWithObserver:self]; 22 | 23 | // observe clock date property 24 | [KVOController observe:clock keyPath:@"date" options:NSKeyValueObservingOptionInitial|NSKeyValueObservingOptionNew block:^(ClockView *clockView, Clock *clock, NSDictionary *change) { 25 | 26 | // update clock view with new value 27 | clockView.date = change[NSKeyValueChangeNewKey]; 28 | }]; 29 | ``` 30 | 31 | While simple, the above example is complete. A clock view creates a KVO controller to observe the clock date property. A block callback is used to handle initial and change notification. Unobservation happens implicitly on controller deallocation. 32 | 33 | To automatically remove observers on observer dealloc, add a strong reference between observer and KVO controller. 34 | 35 | ```objective-c 36 | // Observer with KVO controller instance variable 37 | @implementation ClockView 38 | { 39 | FBKVOController *_KVOController; 40 | } 41 | 42 | - (id)init 43 | { 44 | ... 45 | // create KVO controller with observer 46 | FBKVOController *KVOController = [FBKVOController controllerWithObserver:self]; 47 | 48 | // add strong reference from observer to KVO controller 49 | _KVOController = KVOController; 50 | 51 | ``` 52 | Note: the observer specified must support weak references. The zeroing weak reference guards against notification of a deallocated observer instance. 53 | 54 | ## Prerequisites 55 | 56 | KVOController takes advantage of recent Objective-C runtime advances, including ARC and weak collections. It requires: 57 | 58 | - iOS 6 or later. 59 | - OS X 10.7 or later. 60 | 61 | ## Installation 62 | 63 | To install using CocoaPods, add the following to your project Podfile: 64 | 65 | ```ruby 66 | pod 'KVOController' 67 | ``` 68 | 69 | Alternatively, drag and drop FBKVOController.h and FBKVOController.m into your Xcode project, agreeing to copy files if needed. For iOS applications, you can choose to link against the static library target of the KVOController project. 70 | 71 | Having installed using CocoaPods, add the following to import in Objective-C: 72 | ```objective-c 73 | #import 74 | ``` 75 | 76 | ## Testing 77 | 78 | The unit tests included use CocoaPods for managing dependencies. Install CocoaPods if you haven't already done so. Then, at the command line, navigate to the root KVOController directory and type: 79 | 80 | ```sh 81 | pod install 82 | ``` 83 | 84 | This will install and add test dependencies on OCHamcrest and OCMockito. Re-open the Xcode KVOController workspace and Test, ⌘U. 85 | 86 | ## Licence 87 | 88 | KVOController is released under a BSD License. See LICENSE file for details. 89 | -------------------------------------------------------------------------------- /Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - KVOController (1.0.3) 3 | - Masonry (0.6.3) 4 | - SDWebImage (3.7.3): 5 | - SDWebImage/Core (= 3.7.3) 6 | - SDWebImage/Core (3.7.3) 7 | 8 | DEPENDENCIES: 9 | - KVOController (~> 1.0.3) 10 | - Masonry (~> 0.6.3) 11 | - SDWebImage (~> 3.7.3) 12 | 13 | SPEC CHECKSUMS: 14 | KVOController: 9fd8f0343670994e4b6f9f0b31f5a45663f3e1cf 15 | Masonry: ff105a956abcd19a618b2028b121cb638d7a8e2f 16 | SDWebImage: 1d2b1a1efda1ade1b00b6f8498865f8ddedc8a84 17 | 18 | COCOAPODS: 0.39.0 19 | -------------------------------------------------------------------------------- /Pods/Masonry/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011-2012 Masonry Team - https://github.com/Masonry 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/MASCompositeConstraint.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASCompositeConstraint.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 21/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASConstraint.h" 10 | #import "MASUtilities.h" 11 | 12 | /** 13 | * A group of MASConstraint objects 14 | */ 15 | @interface MASCompositeConstraint : MASConstraint 16 | 17 | /** 18 | * Creates a composite with a predefined array of children 19 | * 20 | * @param children child MASConstraints 21 | * 22 | * @return a composite constraint 23 | */ 24 | - (id)initWithChildren:(NSArray *)children; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/MASCompositeConstraint.m: -------------------------------------------------------------------------------- 1 | // 2 | // MASCompositeConstraint.m 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 21/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASCompositeConstraint.h" 10 | #import "MASConstraint+Private.h" 11 | 12 | @interface MASCompositeConstraint () 13 | 14 | @property (nonatomic, strong) id mas_key; 15 | @property (nonatomic, strong) NSMutableArray *childConstraints; 16 | 17 | @end 18 | 19 | @implementation MASCompositeConstraint 20 | 21 | - (id)initWithChildren:(NSArray *)children { 22 | self = [super init]; 23 | if (!self) return nil; 24 | 25 | _childConstraints = [children mutableCopy]; 26 | for (MASConstraint *constraint in _childConstraints) { 27 | constraint.delegate = self; 28 | } 29 | 30 | return self; 31 | } 32 | 33 | #pragma mark - MASConstraintDelegate 34 | 35 | - (void)constraint:(MASConstraint *)constraint shouldBeReplacedWithConstraint:(MASConstraint *)replacementConstraint { 36 | NSUInteger index = [self.childConstraints indexOfObject:constraint]; 37 | NSAssert(index != NSNotFound, @"Could not find constraint %@", constraint); 38 | [self.childConstraints replaceObjectAtIndex:index withObject:replacementConstraint]; 39 | } 40 | 41 | - (MASConstraint *)constraint:(MASConstraint __unused *)constraint addConstraintWithLayoutAttribute:(NSLayoutAttribute)layoutAttribute { 42 | id strongDelegate = self.delegate; 43 | MASConstraint *newConstraint = [strongDelegate constraint:self addConstraintWithLayoutAttribute:layoutAttribute]; 44 | newConstraint.delegate = self; 45 | [self.childConstraints addObject:newConstraint]; 46 | return newConstraint; 47 | } 48 | 49 | #pragma mark - NSLayoutConstraint multiplier proxies 50 | 51 | - (MASConstraint * (^)(CGFloat))multipliedBy { 52 | return ^id(CGFloat multiplier) { 53 | for (MASConstraint *constraint in self.childConstraints) { 54 | constraint.multipliedBy(multiplier); 55 | } 56 | return self; 57 | }; 58 | } 59 | 60 | - (MASConstraint * (^)(CGFloat))dividedBy { 61 | return ^id(CGFloat divider) { 62 | for (MASConstraint *constraint in self.childConstraints) { 63 | constraint.dividedBy(divider); 64 | } 65 | return self; 66 | }; 67 | } 68 | 69 | #pragma mark - MASLayoutPriority proxy 70 | 71 | - (MASConstraint * (^)(MASLayoutPriority))priority { 72 | return ^id(MASLayoutPriority priority) { 73 | for (MASConstraint *constraint in self.childConstraints) { 74 | constraint.priority(priority); 75 | } 76 | return self; 77 | }; 78 | } 79 | 80 | #pragma mark - NSLayoutRelation proxy 81 | 82 | - (MASConstraint * (^)(id, NSLayoutRelation))equalToWithRelation { 83 | return ^id(id attr, NSLayoutRelation relation) { 84 | for (MASConstraint *constraint in self.childConstraints.copy) { 85 | constraint.equalToWithRelation(attr, relation); 86 | } 87 | return self; 88 | }; 89 | } 90 | 91 | #pragma mark - attribute chaining 92 | 93 | - (MASConstraint *)addConstraintWithLayoutAttribute:(NSLayoutAttribute)layoutAttribute { 94 | [self constraint:self addConstraintWithLayoutAttribute:layoutAttribute]; 95 | return self; 96 | } 97 | 98 | #pragma mark - Animator proxy 99 | 100 | #if TARGET_OS_MAC && !TARGET_OS_IPHONE 101 | 102 | - (MASConstraint *)animator { 103 | for (MASConstraint *constraint in self.childConstraints) { 104 | [constraint animator]; 105 | } 106 | return self; 107 | } 108 | 109 | #endif 110 | 111 | #pragma mark - debug helpers 112 | 113 | - (MASConstraint * (^)(id))key { 114 | return ^id(id key) { 115 | self.mas_key = key; 116 | int i = 0; 117 | for (MASConstraint *constraint in self.childConstraints) { 118 | constraint.key([NSString stringWithFormat:@"%@[%d]", key, i++]); 119 | } 120 | return self; 121 | }; 122 | } 123 | 124 | #pragma mark - NSLayoutConstraint constant setters 125 | 126 | - (void)setInsets:(MASEdgeInsets)insets { 127 | for (MASConstraint *constraint in self.childConstraints) { 128 | constraint.insets = insets; 129 | } 130 | } 131 | 132 | - (void)setOffset:(CGFloat)offset { 133 | for (MASConstraint *constraint in self.childConstraints) { 134 | constraint.offset = offset; 135 | } 136 | } 137 | 138 | - (void)setSizeOffset:(CGSize)sizeOffset { 139 | for (MASConstraint *constraint in self.childConstraints) { 140 | constraint.sizeOffset = sizeOffset; 141 | } 142 | } 143 | 144 | - (void)setCenterOffset:(CGPoint)centerOffset { 145 | for (MASConstraint *constraint in self.childConstraints) { 146 | constraint.centerOffset = centerOffset; 147 | } 148 | } 149 | 150 | #pragma mark - MASConstraint 151 | 152 | - (void)activate { 153 | for (MASConstraint *constraint in self.childConstraints) { 154 | [constraint activate]; 155 | } 156 | } 157 | 158 | - (void)deactivate { 159 | for (MASConstraint *constraint in self.childConstraints) { 160 | [constraint deactivate]; 161 | } 162 | } 163 | 164 | - (void)install { 165 | for (MASConstraint *constraint in self.childConstraints) { 166 | constraint.updateExisting = self.updateExisting; 167 | [constraint install]; 168 | } 169 | } 170 | 171 | - (void)uninstall { 172 | for (MASConstraint *constraint in self.childConstraints) { 173 | [constraint uninstall]; 174 | } 175 | } 176 | 177 | @end 178 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/MASConstraint+Private.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASConstraint+Private.h 3 | // Masonry 4 | // 5 | // Created by Nick Tymchenko on 29/04/14. 6 | // Copyright (c) 2014 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASConstraint.h" 10 | 11 | @protocol MASConstraintDelegate; 12 | 13 | 14 | @interface MASConstraint () 15 | 16 | /** 17 | * Whether or not to check for an existing constraint instead of adding constraint 18 | */ 19 | @property (nonatomic, assign) BOOL updateExisting; 20 | 21 | /** 22 | * Usually MASConstraintMaker but could be a parent MASConstraint 23 | */ 24 | @property (nonatomic, weak) id delegate; 25 | 26 | /** 27 | * Based on a provided value type, is equal to calling: 28 | * NSNumber - setOffset: 29 | * NSValue with CGPoint - setPointOffset: 30 | * NSValue with CGSize - setSizeOffset: 31 | * NSValue with MASEdgeInsets - setInsets: 32 | */ 33 | - (void)setLayoutConstantWithValue:(NSValue *)value; 34 | 35 | @end 36 | 37 | 38 | @interface MASConstraint (Abstract) 39 | 40 | /** 41 | * Sets the constraint relation to given NSLayoutRelation 42 | * returns a block which accepts one of the following: 43 | * MASViewAttribute, UIView, NSValue, NSArray 44 | * see readme for more details. 45 | */ 46 | - (MASConstraint * (^)(id, NSLayoutRelation))equalToWithRelation; 47 | 48 | /** 49 | * Override to set a custom chaining behaviour 50 | */ 51 | - (MASConstraint *)addConstraintWithLayoutAttribute:(NSLayoutAttribute)layoutAttribute; 52 | 53 | @end 54 | 55 | 56 | @protocol MASConstraintDelegate 57 | 58 | /** 59 | * Notifies the delegate when the constraint needs to be replaced with another constraint. For example 60 | * A MASViewConstraint may turn into a MASCompositeConstraint when an array is passed to one of the equality blocks 61 | */ 62 | - (void)constraint:(MASConstraint *)constraint shouldBeReplacedWithConstraint:(MASConstraint *)replacementConstraint; 63 | 64 | - (MASConstraint *)constraint:(MASConstraint *)constraint addConstraintWithLayoutAttribute:(NSLayoutAttribute)layoutAttribute; 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/MASConstraintMaker.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASConstraintBuilder.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 20/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASConstraint.h" 10 | #import "MASUtilities.h" 11 | 12 | typedef NS_OPTIONS(NSInteger, MASAttribute) { 13 | MASAttributeLeft = 1 << NSLayoutAttributeLeft, 14 | MASAttributeRight = 1 << NSLayoutAttributeRight, 15 | MASAttributeTop = 1 << NSLayoutAttributeTop, 16 | MASAttributeBottom = 1 << NSLayoutAttributeBottom, 17 | MASAttributeLeading = 1 << NSLayoutAttributeLeading, 18 | MASAttributeTrailing = 1 << NSLayoutAttributeTrailing, 19 | MASAttributeWidth = 1 << NSLayoutAttributeWidth, 20 | MASAttributeHeight = 1 << NSLayoutAttributeHeight, 21 | MASAttributeCenterX = 1 << NSLayoutAttributeCenterX, 22 | MASAttributeCenterY = 1 << NSLayoutAttributeCenterY, 23 | MASAttributeBaseline = 1 << NSLayoutAttributeBaseline, 24 | 25 | #if TARGET_OS_IPHONE 26 | 27 | MASAttributeLeftMargin = 1 << NSLayoutAttributeLeftMargin, 28 | MASAttributeRightMargin = 1 << NSLayoutAttributeRightMargin, 29 | MASAttributeTopMargin = 1 << NSLayoutAttributeTopMargin, 30 | MASAttributeBottomMargin = 1 << NSLayoutAttributeBottomMargin, 31 | MASAttributeLeadingMargin = 1 << NSLayoutAttributeLeadingMargin, 32 | MASAttributeTrailingMargin = 1 << NSLayoutAttributeTrailingMargin, 33 | MASAttributeCenterXWithinMargins = 1 << NSLayoutAttributeCenterXWithinMargins, 34 | MASAttributeCenterYWithinMargins = 1 << NSLayoutAttributeCenterYWithinMargins, 35 | 36 | #endif 37 | 38 | }; 39 | 40 | /** 41 | * Provides factory methods for creating MASConstraints. 42 | * Constraints are collected until they are ready to be installed 43 | * 44 | */ 45 | @interface MASConstraintMaker : NSObject 46 | 47 | /** 48 | * The following properties return a new MASViewConstraint 49 | * with the first item set to the makers associated view and the appropriate MASViewAttribute 50 | */ 51 | @property (nonatomic, strong, readonly) MASConstraint *left; 52 | @property (nonatomic, strong, readonly) MASConstraint *top; 53 | @property (nonatomic, strong, readonly) MASConstraint *right; 54 | @property (nonatomic, strong, readonly) MASConstraint *bottom; 55 | @property (nonatomic, strong, readonly) MASConstraint *leading; 56 | @property (nonatomic, strong, readonly) MASConstraint *trailing; 57 | @property (nonatomic, strong, readonly) MASConstraint *width; 58 | @property (nonatomic, strong, readonly) MASConstraint *height; 59 | @property (nonatomic, strong, readonly) MASConstraint *centerX; 60 | @property (nonatomic, strong, readonly) MASConstraint *centerY; 61 | @property (nonatomic, strong, readonly) MASConstraint *baseline; 62 | 63 | #if TARGET_OS_IPHONE 64 | 65 | @property (nonatomic, strong, readonly) MASConstraint *leftMargin; 66 | @property (nonatomic, strong, readonly) MASConstraint *rightMargin; 67 | @property (nonatomic, strong, readonly) MASConstraint *topMargin; 68 | @property (nonatomic, strong, readonly) MASConstraint *bottomMargin; 69 | @property (nonatomic, strong, readonly) MASConstraint *leadingMargin; 70 | @property (nonatomic, strong, readonly) MASConstraint *trailingMargin; 71 | @property (nonatomic, strong, readonly) MASConstraint *centerXWithinMargins; 72 | @property (nonatomic, strong, readonly) MASConstraint *centerYWithinMargins; 73 | 74 | #endif 75 | 76 | /** 77 | * Returns a block which creates a new MASCompositeConstraint with the first item set 78 | * to the makers associated view and children corresponding to the set bits in the 79 | * MASAttribute parameter. Combine multiple attributes via binary-or. 80 | */ 81 | @property (nonatomic, strong, readonly) MASConstraint *(^attributes)(MASAttribute attrs); 82 | 83 | /** 84 | * Creates a MASCompositeConstraint with type MASCompositeConstraintTypeEdges 85 | * which generates the appropriate MASViewConstraint children (top, left, bottom, right) 86 | * with the first item set to the makers associated view 87 | */ 88 | @property (nonatomic, strong, readonly) MASConstraint *edges; 89 | 90 | /** 91 | * Creates a MASCompositeConstraint with type MASCompositeConstraintTypeSize 92 | * which generates the appropriate MASViewConstraint children (width, height) 93 | * with the first item set to the makers associated view 94 | */ 95 | @property (nonatomic, strong, readonly) MASConstraint *size; 96 | 97 | /** 98 | * Creates a MASCompositeConstraint with type MASCompositeConstraintTypeCenter 99 | * which generates the appropriate MASViewConstraint children (centerX, centerY) 100 | * with the first item set to the makers associated view 101 | */ 102 | @property (nonatomic, strong, readonly) MASConstraint *center; 103 | 104 | /** 105 | * Whether or not to check for an existing constraint instead of adding constraint 106 | */ 107 | @property (nonatomic, assign) BOOL updateExisting; 108 | 109 | /** 110 | * Whether or not to remove existing constraints prior to installing 111 | */ 112 | @property (nonatomic, assign) BOOL removeExisting; 113 | 114 | /** 115 | * initialises the maker with a default view 116 | * 117 | * @param view any MASConstrait are created with this view as the first item 118 | * 119 | * @return a new MASConstraintMaker 120 | */ 121 | - (id)initWithView:(MAS_VIEW *)view; 122 | 123 | /** 124 | * Calls install method on any MASConstraints which have been created by this maker 125 | * 126 | * @return an array of all the installed MASConstraints 127 | */ 128 | - (NSArray *)install; 129 | 130 | - (MASConstraint * (^)(dispatch_block_t))group; 131 | 132 | @end 133 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/MASLayoutConstraint.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASLayoutConstraint.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 3/08/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "MASUtilities.h" 10 | 11 | /** 12 | * When you are debugging or printing the constraints attached to a view this subclass 13 | * makes it easier to identify which constraints have been created via Masonry 14 | */ 15 | @interface MASLayoutConstraint : NSLayoutConstraint 16 | 17 | /** 18 | * a key to associate with this constraint 19 | */ 20 | @property (nonatomic, strong) id mas_key; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/MASLayoutConstraint.m: -------------------------------------------------------------------------------- 1 | // 2 | // MASLayoutConstraint.m 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 3/08/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "MASLayoutConstraint.h" 10 | 11 | @implementation MASLayoutConstraint 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/MASViewAttribute.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASAttribute.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 21/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASUtilities.h" 10 | 11 | /** 12 | * An immutable tuple which stores the view and the related NSLayoutAttribute. 13 | * Describes part of either the left or right hand side of a constraint equation 14 | */ 15 | @interface MASViewAttribute : NSObject 16 | 17 | /** 18 | * The view which the reciever relates to. Can be nil if item is not a view. 19 | */ 20 | @property (nonatomic, weak, readonly) MAS_VIEW *view; 21 | 22 | /** 23 | * The item which the reciever relates to. 24 | */ 25 | @property (nonatomic, weak, readonly) id item; 26 | 27 | /** 28 | * The attribute which the reciever relates to 29 | */ 30 | @property (nonatomic, assign, readonly) NSLayoutAttribute layoutAttribute; 31 | 32 | /** 33 | * Convenience initializer. 34 | */ 35 | - (id)initWithView:(MAS_VIEW *)view layoutAttribute:(NSLayoutAttribute)layoutAttribute; 36 | 37 | /** 38 | * The designated initializer. 39 | */ 40 | - (id)initWithView:(MAS_VIEW *)view item:(id)item layoutAttribute:(NSLayoutAttribute)layoutAttribute; 41 | 42 | /** 43 | * Determine whether the layoutAttribute is a size attribute 44 | * 45 | * @return YES if layoutAttribute is equal to NSLayoutAttributeWidth or NSLayoutAttributeHeight 46 | */ 47 | - (BOOL)isSizeAttribute; 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/MASViewAttribute.m: -------------------------------------------------------------------------------- 1 | // 2 | // MASAttribute.m 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 21/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASViewAttribute.h" 10 | 11 | @implementation MASViewAttribute 12 | 13 | - (id)initWithView:(MAS_VIEW *)view layoutAttribute:(NSLayoutAttribute)layoutAttribute { 14 | self = [self initWithView:view item:view layoutAttribute:layoutAttribute]; 15 | return self; 16 | } 17 | 18 | - (id)initWithView:(MAS_VIEW *)view item:(id)item layoutAttribute:(NSLayoutAttribute)layoutAttribute { 19 | self = [super init]; 20 | if (!self) return nil; 21 | 22 | _view = view; 23 | _item = item; 24 | _layoutAttribute = layoutAttribute; 25 | 26 | return self; 27 | } 28 | 29 | - (BOOL)isSizeAttribute { 30 | return self.layoutAttribute == NSLayoutAttributeWidth 31 | || self.layoutAttribute == NSLayoutAttributeHeight; 32 | } 33 | 34 | - (BOOL)isEqual:(MASViewAttribute *)viewAttribute { 35 | if ([viewAttribute isKindOfClass:self.class]) { 36 | return self.view == viewAttribute.view 37 | && self.layoutAttribute == viewAttribute.layoutAttribute; 38 | } 39 | return [super isEqual:viewAttribute]; 40 | } 41 | 42 | - (NSUInteger)hash { 43 | return MAS_NSUINTROTATE([self.view hash], MAS_NSUINT_BIT / 2) ^ self.layoutAttribute; 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/MASViewConstraint.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASConstraint.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 20/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASViewAttribute.h" 10 | #import "MASConstraint.h" 11 | #import "MASLayoutConstraint.h" 12 | #import "MASUtilities.h" 13 | 14 | /** 15 | * A single constraint. 16 | * Contains the attributes neccessary for creating a NSLayoutConstraint and adding it to the appropriate view 17 | */ 18 | @interface MASViewConstraint : MASConstraint 19 | 20 | /** 21 | * First item/view and first attribute of the NSLayoutConstraint 22 | */ 23 | @property (nonatomic, strong, readonly) MASViewAttribute *firstViewAttribute; 24 | 25 | /** 26 | * Second item/view and second attribute of the NSLayoutConstraint 27 | */ 28 | @property (nonatomic, strong, readonly) MASViewAttribute *secondViewAttribute; 29 | 30 | /** 31 | * initialises the MASViewConstraint with the first part of the equation 32 | * 33 | * @param firstViewAttribute view.mas_left, view.mas_width etc. 34 | * 35 | * @return a new view constraint 36 | */ 37 | - (id)initWithFirstViewAttribute:(MASViewAttribute *)firstViewAttribute; 38 | 39 | /** 40 | * Returns all MASViewConstraints installed with this view as a first item. 41 | * 42 | * @param view A view to retrieve constraints for. 43 | * 44 | * @return An array of MASViewConstraints. 45 | */ 46 | + (NSArray *)installedConstraintsForView:(MAS_VIEW *)view; 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/Masonry.h: -------------------------------------------------------------------------------- 1 | // 2 | // Masonry.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 20/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for Masonry. 12 | FOUNDATION_EXPORT double MasonryVersionNumber; 13 | 14 | //! Project version string for Masonry. 15 | FOUNDATION_EXPORT const unsigned char MasonryVersionString[]; 16 | 17 | #import "MASUtilities.h" 18 | #import "View+MASAdditions.h" 19 | #import "View+MASShorthandAdditions.h" 20 | #import "ViewController+MASAdditions.h" 21 | #import "NSArray+MASAdditions.h" 22 | #import "NSArray+MASShorthandAdditions.h" 23 | #import "MASConstraint.h" 24 | #import "MASCompositeConstraint.h" 25 | #import "MASViewAttribute.h" 26 | #import "MASViewConstraint.h" 27 | #import "MASConstraintMaker.h" 28 | #import "MASLayoutConstraint.h" 29 | #import "NSLayoutConstraint+MASDebugAdditions.h" 30 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/NSArray+MASAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray+MASAdditions.h 3 | // 4 | // 5 | // Created by Daniel Hammond on 11/26/13. 6 | // 7 | // 8 | 9 | #import "MASUtilities.h" 10 | #import "MASConstraintMaker.h" 11 | #import "MASViewAttribute.h" 12 | 13 | typedef NS_ENUM(NSUInteger, MASAxisType) { 14 | MASAxisTypeHorizontal, 15 | MASAxisTypeVertical 16 | }; 17 | 18 | @interface NSArray (MASAdditions) 19 | 20 | /** 21 | * Creates a MASConstraintMaker with each view in the callee. 22 | * Any constraints defined are added to the view or the appropriate superview once the block has finished executing on each view 23 | * 24 | * @param block scope within which you can build up the constraints which you wish to apply to each view. 25 | * 26 | * @return Array of created MASConstraints 27 | */ 28 | - (NSArray *)mas_makeConstraints:(void (^)(MASConstraintMaker *make))block; 29 | 30 | /** 31 | * Creates a MASConstraintMaker with each view in the callee. 32 | * Any constraints defined are added to each view or the appropriate superview once the block has finished executing on each view. 33 | * If an existing constraint exists then it will be updated instead. 34 | * 35 | * @param block scope within which you can build up the constraints which you wish to apply to each view. 36 | * 37 | * @return Array of created/updated MASConstraints 38 | */ 39 | - (NSArray *)mas_updateConstraints:(void (^)(MASConstraintMaker *make))block; 40 | 41 | /** 42 | * Creates a MASConstraintMaker with each view in the callee. 43 | * Any constraints defined are added to each view or the appropriate superview once the block has finished executing on each view. 44 | * All constraints previously installed for the views will be removed. 45 | * 46 | * @param block scope within which you can build up the constraints which you wish to apply to each view. 47 | * 48 | * @return Array of created/updated MASConstraints 49 | */ 50 | - (NSArray *)mas_remakeConstraints:(void (^)(MASConstraintMaker *make))block; 51 | 52 | /** 53 | * distribute with fixed spacing 54 | * 55 | * @param axisType which axis to distribute items along 56 | * @param fixedSpacing the spacing between each item 57 | * @param leadSpacing the spacing before the first item and the container 58 | * @param tailSpacing the spacing after the last item and the container 59 | */ 60 | - (void)mas_distributeViewsAlongAxis:(MASAxisType)axisType withFixedSpacing:(CGFloat)fixedSpacing leadSpacing:(CGFloat)leadSpacing tailSpacing:(CGFloat)tailSpacing; 61 | 62 | /** 63 | * distribute with fixed item size 64 | * 65 | * @param axisType which axis to distribute items along 66 | * @param fixedItemLength the fixed length of each item 67 | * @param leadSpacing the spacing before the first item and the container 68 | * @param tailSpacing the spacing after the last item and the container 69 | */ 70 | - (void)mas_distributeViewsAlongAxis:(MASAxisType)axisType withFixedItemLength:(CGFloat)fixedItemLength leadSpacing:(CGFloat)leadSpacing tailSpacing:(CGFloat)tailSpacing; 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/NSArray+MASShorthandAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray+MASShorthandAdditions.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 22/07/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "NSArray+MASAdditions.h" 10 | 11 | #ifdef MAS_SHORTHAND 12 | 13 | /** 14 | * Shorthand array additions without the 'mas_' prefixes, 15 | * only enabled if MAS_SHORTHAND is defined 16 | */ 17 | @interface NSArray (MASShorthandAdditions) 18 | 19 | - (NSArray *)makeConstraints:(void(^)(MASConstraintMaker *make))block; 20 | - (NSArray *)updateConstraints:(void(^)(MASConstraintMaker *make))block; 21 | - (NSArray *)remakeConstraints:(void(^)(MASConstraintMaker *make))block; 22 | 23 | @end 24 | 25 | @implementation NSArray (MASShorthandAdditions) 26 | 27 | - (NSArray *)makeConstraints:(void(^)(MASConstraintMaker *))block { 28 | return [self mas_makeConstraints:block]; 29 | } 30 | 31 | - (NSArray *)updateConstraints:(void(^)(MASConstraintMaker *))block { 32 | return [self mas_updateConstraints:block]; 33 | } 34 | 35 | - (NSArray *)remakeConstraints:(void(^)(MASConstraintMaker *))block { 36 | return [self mas_remakeConstraints:block]; 37 | } 38 | 39 | @end 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/NSLayoutConstraint+MASDebugAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSLayoutConstraint+MASDebugAdditions.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 3/08/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "MASUtilities.h" 10 | 11 | /** 12 | * makes debug and log output of NSLayoutConstraints more readable 13 | */ 14 | @interface NSLayoutConstraint (MASDebugAdditions) 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/NSLayoutConstraint+MASDebugAdditions.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSLayoutConstraint+MASDebugAdditions.m 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 3/08/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "NSLayoutConstraint+MASDebugAdditions.h" 10 | #import "MASConstraint.h" 11 | #import "MASLayoutConstraint.h" 12 | 13 | @implementation NSLayoutConstraint (MASDebugAdditions) 14 | 15 | #pragma mark - description maps 16 | 17 | + (NSDictionary *)layoutRelationDescriptionsByValue { 18 | static dispatch_once_t once; 19 | static NSDictionary *descriptionMap; 20 | dispatch_once(&once, ^{ 21 | descriptionMap = @{ 22 | @(NSLayoutRelationEqual) : @"==", 23 | @(NSLayoutRelationGreaterThanOrEqual) : @">=", 24 | @(NSLayoutRelationLessThanOrEqual) : @"<=", 25 | }; 26 | }); 27 | return descriptionMap; 28 | } 29 | 30 | + (NSDictionary *)layoutAttributeDescriptionsByValue { 31 | static dispatch_once_t once; 32 | static NSDictionary *descriptionMap; 33 | dispatch_once(&once, ^{ 34 | descriptionMap = @{ 35 | @(NSLayoutAttributeTop) : @"top", 36 | @(NSLayoutAttributeLeft) : @"left", 37 | @(NSLayoutAttributeBottom) : @"bottom", 38 | @(NSLayoutAttributeRight) : @"right", 39 | @(NSLayoutAttributeLeading) : @"leading", 40 | @(NSLayoutAttributeTrailing) : @"trailing", 41 | @(NSLayoutAttributeWidth) : @"width", 42 | @(NSLayoutAttributeHeight) : @"height", 43 | @(NSLayoutAttributeCenterX) : @"centerX", 44 | @(NSLayoutAttributeCenterY) : @"centerY", 45 | @(NSLayoutAttributeBaseline) : @"baseline", 46 | 47 | #if TARGET_OS_IPHONE 48 | @(NSLayoutAttributeLeftMargin) : @"leftMargin", 49 | @(NSLayoutAttributeRightMargin) : @"rightMargin", 50 | @(NSLayoutAttributeTopMargin) : @"topMargin", 51 | @(NSLayoutAttributeBottomMargin) : @"bottomMargin", 52 | @(NSLayoutAttributeLeadingMargin) : @"leadingMargin", 53 | @(NSLayoutAttributeTrailingMargin) : @"trailingMargin", 54 | @(NSLayoutAttributeCenterXWithinMargins) : @"centerXWithinMargins", 55 | @(NSLayoutAttributeCenterYWithinMargins) : @"centerYWithinMargins", 56 | #endif 57 | 58 | }; 59 | 60 | }); 61 | return descriptionMap; 62 | } 63 | 64 | 65 | + (NSDictionary *)layoutPriorityDescriptionsByValue { 66 | static dispatch_once_t once; 67 | static NSDictionary *descriptionMap; 68 | dispatch_once(&once, ^{ 69 | #if TARGET_OS_IPHONE 70 | descriptionMap = @{ 71 | @(MASLayoutPriorityDefaultHigh) : @"high", 72 | @(MASLayoutPriorityDefaultLow) : @"low", 73 | @(MASLayoutPriorityDefaultMedium) : @"medium", 74 | @(MASLayoutPriorityRequired) : @"required", 75 | @(MASLayoutPriorityFittingSizeLevel) : @"fitting size", 76 | }; 77 | #elif TARGET_OS_MAC 78 | descriptionMap = @{ 79 | @(MASLayoutPriorityDefaultHigh) : @"high", 80 | @(MASLayoutPriorityDragThatCanResizeWindow) : @"drag can resize window", 81 | @(MASLayoutPriorityDefaultMedium) : @"medium", 82 | @(MASLayoutPriorityWindowSizeStayPut) : @"window size stay put", 83 | @(MASLayoutPriorityDragThatCannotResizeWindow) : @"drag cannot resize window", 84 | @(MASLayoutPriorityDefaultLow) : @"low", 85 | @(MASLayoutPriorityFittingSizeCompression) : @"fitting size", 86 | @(MASLayoutPriorityRequired) : @"required", 87 | }; 88 | #endif 89 | }); 90 | return descriptionMap; 91 | } 92 | 93 | #pragma mark - description override 94 | 95 | + (NSString *)descriptionForObject:(id)obj { 96 | if ([obj respondsToSelector:@selector(mas_key)] && [obj mas_key]) { 97 | return [NSString stringWithFormat:@"%@:%@", [obj class], [obj mas_key]]; 98 | } 99 | return [NSString stringWithFormat:@"%@:%p", [obj class], obj]; 100 | } 101 | 102 | - (NSString *)description { 103 | NSMutableString *description = [[NSMutableString alloc] initWithString:@"<"]; 104 | 105 | [description appendString:[self.class descriptionForObject:self]]; 106 | 107 | [description appendFormat:@" %@", [self.class descriptionForObject:self.firstItem]]; 108 | if (self.firstAttribute != NSLayoutAttributeNotAnAttribute) { 109 | [description appendFormat:@".%@", [self.class.layoutAttributeDescriptionsByValue objectForKey:@(self.firstAttribute)]]; 110 | } 111 | 112 | [description appendFormat:@" %@", [self.class.layoutRelationDescriptionsByValue objectForKey:@(self.relation)]]; 113 | 114 | if (self.secondItem) { 115 | [description appendFormat:@" %@", [self.class descriptionForObject:self.secondItem]]; 116 | } 117 | if (self.secondAttribute != NSLayoutAttributeNotAnAttribute) { 118 | [description appendFormat:@".%@", [self.class.layoutAttributeDescriptionsByValue objectForKey:@(self.secondAttribute)]]; 119 | } 120 | 121 | if (self.multiplier != 1) { 122 | [description appendFormat:@" * %g", self.multiplier]; 123 | } 124 | 125 | if (self.secondAttribute == NSLayoutAttributeNotAnAttribute) { 126 | [description appendFormat:@" %g", self.constant]; 127 | } else { 128 | if (self.constant) { 129 | [description appendFormat:@" %@ %g", (self.constant < 0 ? @"-" : @"+"), ABS(self.constant)]; 130 | } 131 | } 132 | 133 | if (self.priority != MASLayoutPriorityRequired) { 134 | [description appendFormat:@" ^%@", [self.class.layoutPriorityDescriptionsByValue objectForKey:@(self.priority)] ?: [NSNumber numberWithDouble:self.priority]]; 135 | } 136 | 137 | [description appendString:@">"]; 138 | return description; 139 | } 140 | 141 | @end 142 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/View+MASAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+MASAdditions.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 20/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASUtilities.h" 10 | #import "MASConstraintMaker.h" 11 | #import "MASViewAttribute.h" 12 | 13 | /** 14 | * Provides constraint maker block 15 | * and convience methods for creating MASViewAttribute which are view + NSLayoutAttribute pairs 16 | */ 17 | @interface MAS_VIEW (MASAdditions) 18 | 19 | /** 20 | * following properties return a new MASViewAttribute with current view and appropriate NSLayoutAttribute 21 | */ 22 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_left; 23 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_top; 24 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_right; 25 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_bottom; 26 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_leading; 27 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_trailing; 28 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_width; 29 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_height; 30 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_centerX; 31 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_centerY; 32 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_baseline; 33 | @property (nonatomic, strong, readonly) MASViewAttribute *(^mas_attribute)(NSLayoutAttribute attr); 34 | 35 | #if TARGET_OS_IPHONE 36 | 37 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_leftMargin; 38 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_rightMargin; 39 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_topMargin; 40 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_bottomMargin; 41 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_leadingMargin; 42 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_trailingMargin; 43 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_centerXWithinMargins; 44 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_centerYWithinMargins; 45 | 46 | #endif 47 | 48 | /** 49 | * a key to associate with this view 50 | */ 51 | @property (nonatomic, strong) id mas_key; 52 | 53 | /** 54 | * Finds the closest common superview between this view and another view 55 | * 56 | * @param view other view 57 | * 58 | * @return returns nil if common superview could not be found 59 | */ 60 | - (instancetype)mas_closestCommonSuperview:(MAS_VIEW *)view; 61 | 62 | /** 63 | * Creates a MASConstraintMaker with the callee view. 64 | * Any constraints defined are added to the view or the appropriate superview once the block has finished executing 65 | * 66 | * @param block scope within which you can build up the constraints which you wish to apply to the view. 67 | * 68 | * @return Array of created MASConstraints 69 | */ 70 | - (NSArray *)mas_makeConstraints:(void(^)(MASConstraintMaker *make))block; 71 | 72 | /** 73 | * Creates a MASConstraintMaker with the callee view. 74 | * Any constraints defined are added to the view or the appropriate superview once the block has finished executing. 75 | * If an existing constraint exists then it will be updated instead. 76 | * 77 | * @param block scope within which you can build up the constraints which you wish to apply to the view. 78 | * 79 | * @return Array of created/updated MASConstraints 80 | */ 81 | - (NSArray *)mas_updateConstraints:(void(^)(MASConstraintMaker *make))block; 82 | 83 | /** 84 | * Creates a MASConstraintMaker with the callee view. 85 | * Any constraints defined are added to the view or the appropriate superview once the block has finished executing. 86 | * All constraints previously installed for the view will be removed. 87 | * 88 | * @param block scope within which you can build up the constraints which you wish to apply to the view. 89 | * 90 | * @return Array of created/updated MASConstraints 91 | */ 92 | - (NSArray *)mas_remakeConstraints:(void(^)(MASConstraintMaker *make))block; 93 | 94 | @end 95 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/View+MASAdditions.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+MASAdditions.m 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 20/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import "View+MASAdditions.h" 10 | #import 11 | 12 | @implementation MAS_VIEW (MASAdditions) 13 | 14 | - (NSArray *)mas_makeConstraints:(void(^)(MASConstraintMaker *))block { 15 | self.translatesAutoresizingMaskIntoConstraints = NO; 16 | MASConstraintMaker *constraintMaker = [[MASConstraintMaker alloc] initWithView:self]; 17 | block(constraintMaker); 18 | return [constraintMaker install]; 19 | } 20 | 21 | - (NSArray *)mas_updateConstraints:(void(^)(MASConstraintMaker *))block { 22 | self.translatesAutoresizingMaskIntoConstraints = NO; 23 | MASConstraintMaker *constraintMaker = [[MASConstraintMaker alloc] initWithView:self]; 24 | constraintMaker.updateExisting = YES; 25 | block(constraintMaker); 26 | return [constraintMaker install]; 27 | } 28 | 29 | - (NSArray *)mas_remakeConstraints:(void(^)(MASConstraintMaker *make))block { 30 | self.translatesAutoresizingMaskIntoConstraints = NO; 31 | MASConstraintMaker *constraintMaker = [[MASConstraintMaker alloc] initWithView:self]; 32 | constraintMaker.removeExisting = YES; 33 | block(constraintMaker); 34 | return [constraintMaker install]; 35 | } 36 | 37 | #pragma mark - NSLayoutAttribute properties 38 | 39 | - (MASViewAttribute *)mas_left { 40 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeLeft]; 41 | } 42 | 43 | - (MASViewAttribute *)mas_top { 44 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeTop]; 45 | } 46 | 47 | - (MASViewAttribute *)mas_right { 48 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeRight]; 49 | } 50 | 51 | - (MASViewAttribute *)mas_bottom { 52 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeBottom]; 53 | } 54 | 55 | - (MASViewAttribute *)mas_leading { 56 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeLeading]; 57 | } 58 | 59 | - (MASViewAttribute *)mas_trailing { 60 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeTrailing]; 61 | } 62 | 63 | - (MASViewAttribute *)mas_width { 64 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeWidth]; 65 | } 66 | 67 | - (MASViewAttribute *)mas_height { 68 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeHeight]; 69 | } 70 | 71 | - (MASViewAttribute *)mas_centerX { 72 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeCenterX]; 73 | } 74 | 75 | - (MASViewAttribute *)mas_centerY { 76 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeCenterY]; 77 | } 78 | 79 | - (MASViewAttribute *)mas_baseline { 80 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeBaseline]; 81 | } 82 | 83 | - (MASViewAttribute *(^)(NSLayoutAttribute))mas_attribute 84 | { 85 | return ^(NSLayoutAttribute attr) { 86 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:attr]; 87 | }; 88 | } 89 | 90 | #if TARGET_OS_IPHONE 91 | 92 | - (MASViewAttribute *)mas_leftMargin { 93 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeLeftMargin]; 94 | } 95 | 96 | - (MASViewAttribute *)mas_rightMargin { 97 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeRightMargin]; 98 | } 99 | 100 | - (MASViewAttribute *)mas_topMargin { 101 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeTopMargin]; 102 | } 103 | 104 | - (MASViewAttribute *)mas_bottomMargin { 105 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeBottomMargin]; 106 | } 107 | 108 | - (MASViewAttribute *)mas_leadingMargin { 109 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeLeadingMargin]; 110 | } 111 | 112 | - (MASViewAttribute *)mas_trailingMargin { 113 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeTrailingMargin]; 114 | } 115 | 116 | - (MASViewAttribute *)mas_centerXWithinMargins { 117 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeCenterXWithinMargins]; 118 | } 119 | 120 | - (MASViewAttribute *)mas_centerYWithinMargins { 121 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeCenterYWithinMargins]; 122 | } 123 | 124 | #endif 125 | 126 | #pragma mark - associated properties 127 | 128 | - (id)mas_key { 129 | return objc_getAssociatedObject(self, @selector(mas_key)); 130 | } 131 | 132 | - (void)setMas_key:(id)key { 133 | objc_setAssociatedObject(self, @selector(mas_key), key, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 134 | } 135 | 136 | #pragma mark - heirachy 137 | 138 | - (instancetype)mas_closestCommonSuperview:(MAS_VIEW *)view { 139 | MAS_VIEW *closestCommonSuperview = nil; 140 | 141 | MAS_VIEW *secondViewSuperview = view; 142 | while (!closestCommonSuperview && secondViewSuperview) { 143 | MAS_VIEW *firstViewSuperview = self; 144 | while (!closestCommonSuperview && firstViewSuperview) { 145 | if (secondViewSuperview == firstViewSuperview) { 146 | closestCommonSuperview = secondViewSuperview; 147 | } 148 | firstViewSuperview = firstViewSuperview.superview; 149 | } 150 | secondViewSuperview = secondViewSuperview.superview; 151 | } 152 | return closestCommonSuperview; 153 | } 154 | 155 | @end 156 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/View+MASShorthandAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+MASShorthandAdditions.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 22/07/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "View+MASAdditions.h" 10 | 11 | #ifdef MAS_SHORTHAND 12 | 13 | /** 14 | * Shorthand view additions without the 'mas_' prefixes, 15 | * only enabled if MAS_SHORTHAND is defined 16 | */ 17 | @interface MAS_VIEW (MASShorthandAdditions) 18 | 19 | @property (nonatomic, strong, readonly) MASViewAttribute *left; 20 | @property (nonatomic, strong, readonly) MASViewAttribute *top; 21 | @property (nonatomic, strong, readonly) MASViewAttribute *right; 22 | @property (nonatomic, strong, readonly) MASViewAttribute *bottom; 23 | @property (nonatomic, strong, readonly) MASViewAttribute *leading; 24 | @property (nonatomic, strong, readonly) MASViewAttribute *trailing; 25 | @property (nonatomic, strong, readonly) MASViewAttribute *width; 26 | @property (nonatomic, strong, readonly) MASViewAttribute *height; 27 | @property (nonatomic, strong, readonly) MASViewAttribute *centerX; 28 | @property (nonatomic, strong, readonly) MASViewAttribute *centerY; 29 | @property (nonatomic, strong, readonly) MASViewAttribute *baseline; 30 | @property (nonatomic, strong, readonly) MASViewAttribute *(^attribute)(NSLayoutAttribute attr); 31 | 32 | #if TARGET_OS_IPHONE 33 | 34 | @property (nonatomic, strong, readonly) MASViewAttribute *leftMargin; 35 | @property (nonatomic, strong, readonly) MASViewAttribute *rightMargin; 36 | @property (nonatomic, strong, readonly) MASViewAttribute *topMargin; 37 | @property (nonatomic, strong, readonly) MASViewAttribute *bottomMargin; 38 | @property (nonatomic, strong, readonly) MASViewAttribute *leadingMargin; 39 | @property (nonatomic, strong, readonly) MASViewAttribute *trailingMargin; 40 | @property (nonatomic, strong, readonly) MASViewAttribute *centerXWithinMargins; 41 | @property (nonatomic, strong, readonly) MASViewAttribute *centerYWithinMargins; 42 | 43 | #endif 44 | 45 | - (NSArray *)makeConstraints:(void(^)(MASConstraintMaker *make))block; 46 | - (NSArray *)updateConstraints:(void(^)(MASConstraintMaker *make))block; 47 | - (NSArray *)remakeConstraints:(void(^)(MASConstraintMaker *make))block; 48 | 49 | @end 50 | 51 | #define MAS_ATTR_FORWARD(attr) \ 52 | - (MASViewAttribute *)attr { \ 53 | return [self mas_##attr]; \ 54 | } 55 | 56 | @implementation MAS_VIEW (MASShorthandAdditions) 57 | 58 | MAS_ATTR_FORWARD(top); 59 | MAS_ATTR_FORWARD(left); 60 | MAS_ATTR_FORWARD(bottom); 61 | MAS_ATTR_FORWARD(right); 62 | MAS_ATTR_FORWARD(leading); 63 | MAS_ATTR_FORWARD(trailing); 64 | MAS_ATTR_FORWARD(width); 65 | MAS_ATTR_FORWARD(height); 66 | MAS_ATTR_FORWARD(centerX); 67 | MAS_ATTR_FORWARD(centerY); 68 | MAS_ATTR_FORWARD(baseline); 69 | 70 | #if TARGET_OS_IPHONE 71 | 72 | MAS_ATTR_FORWARD(leftMargin); 73 | MAS_ATTR_FORWARD(rightMargin); 74 | MAS_ATTR_FORWARD(topMargin); 75 | MAS_ATTR_FORWARD(bottomMargin); 76 | MAS_ATTR_FORWARD(leadingMargin); 77 | MAS_ATTR_FORWARD(trailingMargin); 78 | MAS_ATTR_FORWARD(centerXWithinMargins); 79 | MAS_ATTR_FORWARD(centerYWithinMargins); 80 | 81 | #endif 82 | 83 | - (MASViewAttribute *(^)(NSLayoutAttribute))attribute { 84 | return [self mas_attribute]; 85 | } 86 | 87 | - (NSArray *)makeConstraints:(void(^)(MASConstraintMaker *))block { 88 | return [self mas_makeConstraints:block]; 89 | } 90 | 91 | - (NSArray *)updateConstraints:(void(^)(MASConstraintMaker *))block { 92 | return [self mas_updateConstraints:block]; 93 | } 94 | 95 | - (NSArray *)remakeConstraints:(void(^)(MASConstraintMaker *))block { 96 | return [self mas_remakeConstraints:block]; 97 | } 98 | 99 | @end 100 | 101 | #endif 102 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/ViewController+MASAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+MASAdditions.h 3 | // Masonry 4 | // 5 | // Created by Craig Siemens on 2015-06-23. 6 | // 7 | // 8 | 9 | #import "MASUtilities.h" 10 | #import "MASConstraintMaker.h" 11 | #import "MASViewAttribute.h" 12 | 13 | #ifdef MAS_VIEW_CONTROLLER 14 | 15 | @interface MAS_VIEW_CONTROLLER (MASAdditions) 16 | 17 | /** 18 | * following properties return a new MASViewAttribute with appropriate UILayoutGuide and NSLayoutAttribute 19 | */ 20 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_topLayoutGuide; 21 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_bottomLayoutGuide; 22 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_topLayoutGuideTop; 23 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_topLayoutGuideBottom; 24 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_bottomLayoutGuideTop; 25 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_bottomLayoutGuideBottom; 26 | 27 | 28 | @end 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/ViewController+MASAdditions.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+MASAdditions.m 3 | // Masonry 4 | // 5 | // Created by Craig Siemens on 2015-06-23. 6 | // 7 | // 8 | 9 | #import "ViewController+MASAdditions.h" 10 | 11 | #ifdef MAS_VIEW_CONTROLLER 12 | 13 | @implementation MAS_VIEW_CONTROLLER (MASAdditions) 14 | 15 | - (MASViewAttribute *)mas_topLayoutGuide { 16 | return [[MASViewAttribute alloc] initWithView:self.view item:self.topLayoutGuide layoutAttribute:NSLayoutAttributeBottom]; 17 | } 18 | - (MASViewAttribute *)mas_topLayoutGuideTop { 19 | return [[MASViewAttribute alloc] initWithView:self.view item:self.topLayoutGuide layoutAttribute:NSLayoutAttributeTop]; 20 | } 21 | - (MASViewAttribute *)mas_topLayoutGuideBottom { 22 | return [[MASViewAttribute alloc] initWithView:self.view item:self.topLayoutGuide layoutAttribute:NSLayoutAttributeBottom]; 23 | } 24 | 25 | - (MASViewAttribute *)mas_bottomLayoutGuide { 26 | return [[MASViewAttribute alloc] initWithView:self.view item:self.bottomLayoutGuide layoutAttribute:NSLayoutAttributeTop]; 27 | } 28 | - (MASViewAttribute *)mas_bottomLayoutGuideTop { 29 | return [[MASViewAttribute alloc] initWithView:self.view item:self.bottomLayoutGuide layoutAttribute:NSLayoutAttributeTop]; 30 | } 31 | - (MASViewAttribute *)mas_bottomLayoutGuideBottom { 32 | return [[MASViewAttribute alloc] initWithView:self.view item:self.bottomLayoutGuide layoutAttribute:NSLayoutAttributeBottom]; 33 | } 34 | 35 | 36 | 37 | @end 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/gaofeng.xcuserdatad/xcschemes/KVOController.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/gaofeng.xcuserdatad/xcschemes/Masonry.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/gaofeng.xcuserdatad/xcschemes/Pods-CDDDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/gaofeng.xcuserdatad/xcschemes/SDWebImage.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/gaofeng.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | KVOController.xcscheme 8 | 9 | isShown 10 | 11 | 12 | Masonry.xcscheme 13 | 14 | isShown 15 | 16 | 17 | Pods-CDDDemo.xcscheme 18 | 19 | isShown 20 | 21 | 22 | SDWebImage.xcscheme 23 | 24 | isShown 25 | 26 | 27 | 28 | SuppressBuildableAutocreation 29 | 30 | 53480ED0BE09FF49E34B1702D485CAAB 31 | 32 | primary 33 | 34 | 35 | ABEE25DF53551353473553415F70D9CD 36 | 37 | primary 38 | 39 | 40 | D99D9886C4ED76589ECA4E5E2F468175 41 | 42 | primary 43 | 44 | 45 | E38DB1C1ADA98FE6BA604D726D1DE3C1 46 | 47 | primary 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /Pods/SDWebImage/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 Olivier Poitrey 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished 8 | to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | 21 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/NSData+ImageContentType.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Fabrice Aneche on 06/01/14. 3 | // Copyright (c) 2014 Dailymotion. All rights reserved. 4 | // 5 | 6 | #import 7 | 8 | @interface NSData (ImageContentType) 9 | 10 | /** 11 | * Compute the content type for an image data 12 | * 13 | * @param data the input data 14 | * 15 | * @return the content type as string (i.e. image/jpeg, image/gif) 16 | */ 17 | + (NSString *)sd_contentTypeForImageData:(NSData *)data; 18 | 19 | @end 20 | 21 | 22 | @interface NSData (ImageContentTypeDeprecated) 23 | 24 | + (NSString *)contentTypeForImageData:(NSData *)data __deprecated_msg("Use `sd_contentTypeForImageData:`"); 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/NSData+ImageContentType.m: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Fabrice Aneche on 06/01/14. 3 | // Copyright (c) 2014 Dailymotion. All rights reserved. 4 | // 5 | 6 | #import "NSData+ImageContentType.h" 7 | 8 | 9 | @implementation NSData (ImageContentType) 10 | 11 | + (NSString *)sd_contentTypeForImageData:(NSData *)data { 12 | uint8_t c; 13 | [data getBytes:&c length:1]; 14 | switch (c) { 15 | case 0xFF: 16 | return @"image/jpeg"; 17 | case 0x89: 18 | return @"image/png"; 19 | case 0x47: 20 | return @"image/gif"; 21 | case 0x49: 22 | case 0x4D: 23 | return @"image/tiff"; 24 | case 0x52: 25 | // R as RIFF for WEBP 26 | if ([data length] < 12) { 27 | return nil; 28 | } 29 | 30 | NSString *testString = [[NSString alloc] initWithData:[data subdataWithRange:NSMakeRange(0, 12)] encoding:NSASCIIStringEncoding]; 31 | if ([testString hasPrefix:@"RIFF"] && [testString hasSuffix:@"WEBP"]) { 32 | return @"image/webp"; 33 | } 34 | 35 | return nil; 36 | } 37 | return nil; 38 | } 39 | 40 | @end 41 | 42 | 43 | @implementation NSData (ImageContentTypeDeprecated) 44 | 45 | + (NSString *)contentTypeForImageData:(NSData *)data { 46 | return [self sd_contentTypeForImageData:data]; 47 | } 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDWebImageCompat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * (c) Jamie Pinkham 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | */ 9 | 10 | #import 11 | 12 | #ifdef __OBJC_GC__ 13 | #error SDWebImage does not support Objective-C Garbage Collection 14 | #endif 15 | 16 | #if __IPHONE_OS_VERSION_MIN_REQUIRED != 20000 && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_5_0 17 | #error SDWebImage doesn't support Deployement Target version < 5.0 18 | #endif 19 | 20 | #if !TARGET_OS_IPHONE 21 | #import 22 | #ifndef UIImage 23 | #define UIImage NSImage 24 | #endif 25 | #ifndef UIImageView 26 | #define UIImageView NSImageView 27 | #endif 28 | #else 29 | 30 | #import 31 | 32 | #endif 33 | 34 | #ifndef NS_ENUM 35 | #define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type 36 | #endif 37 | 38 | #ifndef NS_OPTIONS 39 | #define NS_OPTIONS(_type, _name) enum _name : _type _name; enum _name : _type 40 | #endif 41 | 42 | #if OS_OBJECT_USE_OBJC 43 | #undef SDDispatchQueueRelease 44 | #undef SDDispatchQueueSetterSementics 45 | #define SDDispatchQueueRelease(q) 46 | #define SDDispatchQueueSetterSementics strong 47 | #else 48 | #undef SDDispatchQueueRelease 49 | #undef SDDispatchQueueSetterSementics 50 | #define SDDispatchQueueRelease(q) (dispatch_release(q)) 51 | #define SDDispatchQueueSetterSementics assign 52 | #endif 53 | 54 | extern UIImage *SDScaledImageForKey(NSString *key, UIImage *image); 55 | 56 | typedef void(^SDWebImageNoParamsBlock)(); 57 | 58 | extern NSString *const SDWebImageErrorDomain; 59 | 60 | #define dispatch_main_sync_safe(block)\ 61 | if ([NSThread isMainThread]) {\ 62 | block();\ 63 | } else {\ 64 | dispatch_sync(dispatch_get_main_queue(), block);\ 65 | } 66 | 67 | #define dispatch_main_async_safe(block)\ 68 | if ([NSThread isMainThread]) {\ 69 | block();\ 70 | } else {\ 71 | dispatch_async(dispatch_get_main_queue(), block);\ 72 | } 73 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDWebImageCompat.m: -------------------------------------------------------------------------------- 1 | // 2 | // SDWebImageCompat.m 3 | // SDWebImage 4 | // 5 | // Created by Olivier Poitrey on 11/12/12. 6 | // Copyright (c) 2012 Dailymotion. All rights reserved. 7 | // 8 | 9 | #import "SDWebImageCompat.h" 10 | 11 | #if !__has_feature(objc_arc) 12 | #error SDWebImage is ARC only. Either turn on ARC for the project or use -fobjc-arc flag 13 | #endif 14 | 15 | inline UIImage *SDScaledImageForKey(NSString *key, UIImage *image) { 16 | if (!image) { 17 | return nil; 18 | } 19 | 20 | if ([image.images count] > 0) { 21 | NSMutableArray *scaledImages = [NSMutableArray array]; 22 | 23 | for (UIImage *tempImage in image.images) { 24 | [scaledImages addObject:SDScaledImageForKey(key, tempImage)]; 25 | } 26 | 27 | return [UIImage animatedImageWithImages:scaledImages duration:image.duration]; 28 | } 29 | else { 30 | if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) { 31 | CGFloat scale = 1.0; 32 | if (key.length >= 8) { 33 | NSRange range = [key rangeOfString:@"@2x."]; 34 | if (range.location != NSNotFound) { 35 | scale = 2.0; 36 | } 37 | 38 | range = [key rangeOfString:@"@3x."]; 39 | if (range.location != NSNotFound) { 40 | scale = 3.0; 41 | } 42 | } 43 | 44 | UIImage *scaledImage = [[UIImage alloc] initWithCGImage:image.CGImage scale:scale orientation:image.imageOrientation]; 45 | image = scaledImage; 46 | } 47 | return image; 48 | } 49 | } 50 | 51 | NSString *const SDWebImageErrorDomain = @"SDWebImageErrorDomain"; 52 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDWebImageDecoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * Created by james on 9/28/11. 6 | * 7 | * For the full copyright and license information, please view the LICENSE 8 | * file that was distributed with this source code. 9 | */ 10 | 11 | #import 12 | #import "SDWebImageCompat.h" 13 | 14 | @interface UIImage (ForceDecode) 15 | 16 | + (UIImage *)decodedImageWithImage:(UIImage *)image; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDWebImageDecoder.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * Created by james on 9/28/11. 6 | * 7 | * For the full copyright and license information, please view the LICENSE 8 | * file that was distributed with this source code. 9 | */ 10 | 11 | #import "SDWebImageDecoder.h" 12 | 13 | @implementation UIImage (ForceDecode) 14 | 15 | + (UIImage *)decodedImageWithImage:(UIImage *)image { 16 | if (image.images) { 17 | // Do not decode animated images 18 | return image; 19 | } 20 | 21 | CGImageRef imageRef = image.CGImage; 22 | CGSize imageSize = CGSizeMake(CGImageGetWidth(imageRef), CGImageGetHeight(imageRef)); 23 | CGRect imageRect = (CGRect){.origin = CGPointZero, .size = imageSize}; 24 | 25 | CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); 26 | CGBitmapInfo bitmapInfo = CGImageGetBitmapInfo(imageRef); 27 | 28 | int infoMask = (bitmapInfo & kCGBitmapAlphaInfoMask); 29 | BOOL anyNonAlpha = (infoMask == kCGImageAlphaNone || 30 | infoMask == kCGImageAlphaNoneSkipFirst || 31 | infoMask == kCGImageAlphaNoneSkipLast); 32 | 33 | // CGBitmapContextCreate doesn't support kCGImageAlphaNone with RGB. 34 | // https://developer.apple.com/library/mac/#qa/qa1037/_index.html 35 | if (infoMask == kCGImageAlphaNone && CGColorSpaceGetNumberOfComponents(colorSpace) > 1) { 36 | // Unset the old alpha info. 37 | bitmapInfo &= ~kCGBitmapAlphaInfoMask; 38 | 39 | // Set noneSkipFirst. 40 | bitmapInfo |= kCGImageAlphaNoneSkipFirst; 41 | } 42 | // Some PNGs tell us they have alpha but only 3 components. Odd. 43 | else if (!anyNonAlpha && CGColorSpaceGetNumberOfComponents(colorSpace) == 3) { 44 | // Unset the old alpha info. 45 | bitmapInfo &= ~kCGBitmapAlphaInfoMask; 46 | bitmapInfo |= kCGImageAlphaPremultipliedFirst; 47 | } 48 | 49 | // It calculates the bytes-per-row based on the bitsPerComponent and width arguments. 50 | CGContextRef context = CGBitmapContextCreate(NULL, 51 | imageSize.width, 52 | imageSize.height, 53 | CGImageGetBitsPerComponent(imageRef), 54 | 0, 55 | colorSpace, 56 | bitmapInfo); 57 | CGColorSpaceRelease(colorSpace); 58 | 59 | // If failed, return undecompressed image 60 | if (!context) return image; 61 | 62 | CGContextDrawImage(context, imageRect, imageRef); 63 | CGImageRef decompressedImageRef = CGBitmapContextCreateImage(context); 64 | 65 | CGContextRelease(context); 66 | 67 | UIImage *decompressedImage = [UIImage imageWithCGImage:decompressedImageRef scale:image.scale orientation:image.imageOrientation]; 68 | CGImageRelease(decompressedImageRef); 69 | return decompressedImage; 70 | } 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDWebImageDownloaderOperation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | #import "SDWebImageDownloader.h" 11 | #import "SDWebImageOperation.h" 12 | 13 | extern NSString *const SDWebImageDownloadStartNotification; 14 | extern NSString *const SDWebImageDownloadReceiveResponseNotification; 15 | extern NSString *const SDWebImageDownloadStopNotification; 16 | extern NSString *const SDWebImageDownloadFinishNotification; 17 | 18 | @interface SDWebImageDownloaderOperation : NSOperation 19 | 20 | /** 21 | * The request used by the operation's connection. 22 | */ 23 | @property (strong, nonatomic, readonly) NSURLRequest *request; 24 | 25 | 26 | @property (assign, nonatomic) BOOL shouldDecompressImages; 27 | 28 | /** 29 | * Whether the URL connection should consult the credential storage for authenticating the connection. `YES` by default. 30 | * 31 | * This is the value that is returned in the `NSURLConnectionDelegate` method `-connectionShouldUseCredentialStorage:`. 32 | */ 33 | @property (nonatomic, assign) BOOL shouldUseCredentialStorage; 34 | 35 | /** 36 | * The credential used for authentication challenges in `-connection:didReceiveAuthenticationChallenge:`. 37 | * 38 | * This will be overridden by any shared credentials that exist for the username or password of the request URL, if present. 39 | */ 40 | @property (nonatomic, strong) NSURLCredential *credential; 41 | 42 | /** 43 | * The SDWebImageDownloaderOptions for the receiver. 44 | */ 45 | @property (assign, nonatomic, readonly) SDWebImageDownloaderOptions options; 46 | 47 | /** 48 | * The expected size of data. 49 | */ 50 | @property (assign, nonatomic) NSInteger expectedSize; 51 | 52 | /** 53 | * The response returned by the operation's connection. 54 | */ 55 | @property (strong, nonatomic) NSURLResponse *response; 56 | 57 | /** 58 | * Initializes a `SDWebImageDownloaderOperation` object 59 | * 60 | * @see SDWebImageDownloaderOperation 61 | * 62 | * @param request the URL request 63 | * @param options downloader options 64 | * @param progressBlock the block executed when a new chunk of data arrives. 65 | * @note the progress block is executed on a background queue 66 | * @param completedBlock the block executed when the download is done. 67 | * @note the completed block is executed on the main queue for success. If errors are found, there is a chance the block will be executed on a background queue 68 | * @param cancelBlock the block executed if the download (operation) is cancelled 69 | * 70 | * @return the initialized instance 71 | */ 72 | - (id)initWithRequest:(NSURLRequest *)request 73 | options:(SDWebImageDownloaderOptions)options 74 | progress:(SDWebImageDownloaderProgressBlock)progressBlock 75 | completed:(SDWebImageDownloaderCompletedBlock)completedBlock 76 | cancelled:(SDWebImageNoParamsBlock)cancelBlock; 77 | 78 | @end 79 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDWebImageOperation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | 11 | @protocol SDWebImageOperation 12 | 13 | - (void)cancel; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDWebImagePrefetcher.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | #import "SDWebImageManager.h" 11 | 12 | @class SDWebImagePrefetcher; 13 | 14 | @protocol SDWebImagePrefetcherDelegate 15 | 16 | @optional 17 | 18 | /** 19 | * Called when an image was prefetched. 20 | * 21 | * @param imagePrefetcher The current image prefetcher 22 | * @param imageURL The image url that was prefetched 23 | * @param finishedCount The total number of images that were prefetched (successful or not) 24 | * @param totalCount The total number of images that were to be prefetched 25 | */ 26 | - (void)imagePrefetcher:(SDWebImagePrefetcher *)imagePrefetcher didPrefetchURL:(NSURL *)imageURL finishedCount:(NSUInteger)finishedCount totalCount:(NSUInteger)totalCount; 27 | 28 | /** 29 | * Called when all images are prefetched. 30 | * @param imagePrefetcher The current image prefetcher 31 | * @param totalCount The total number of images that were prefetched (whether successful or not) 32 | * @param skippedCount The total number of images that were skipped 33 | */ 34 | - (void)imagePrefetcher:(SDWebImagePrefetcher *)imagePrefetcher didFinishWithTotalCount:(NSUInteger)totalCount skippedCount:(NSUInteger)skippedCount; 35 | 36 | @end 37 | 38 | typedef void(^SDWebImagePrefetcherProgressBlock)(NSUInteger noOfFinishedUrls, NSUInteger noOfTotalUrls); 39 | typedef void(^SDWebImagePrefetcherCompletionBlock)(NSUInteger noOfFinishedUrls, NSUInteger noOfSkippedUrls); 40 | 41 | /** 42 | * Prefetch some URLs in the cache for future use. Images are downloaded in low priority. 43 | */ 44 | @interface SDWebImagePrefetcher : NSObject 45 | 46 | /** 47 | * The web image manager 48 | */ 49 | @property (strong, nonatomic, readonly) SDWebImageManager *manager; 50 | 51 | /** 52 | * Maximum number of URLs to prefetch at the same time. Defaults to 3. 53 | */ 54 | @property (nonatomic, assign) NSUInteger maxConcurrentDownloads; 55 | 56 | /** 57 | * SDWebImageOptions for prefetcher. Defaults to SDWebImageLowPriority. 58 | */ 59 | @property (nonatomic, assign) SDWebImageOptions options; 60 | 61 | /** 62 | * Queue options for Prefetcher. Defaults to Main Queue. 63 | */ 64 | @property (nonatomic, assign) dispatch_queue_t prefetcherQueue; 65 | 66 | @property (weak, nonatomic) id delegate; 67 | 68 | /** 69 | * Return the global image prefetcher instance. 70 | */ 71 | + (SDWebImagePrefetcher *)sharedImagePrefetcher; 72 | 73 | /** 74 | * Assign list of URLs to let SDWebImagePrefetcher to queue the prefetching, 75 | * currently one image is downloaded at a time, 76 | * and skips images for failed downloads and proceed to the next image in the list 77 | * 78 | * @param urls list of URLs to prefetch 79 | */ 80 | - (void)prefetchURLs:(NSArray *)urls; 81 | 82 | /** 83 | * Assign list of URLs to let SDWebImagePrefetcher to queue the prefetching, 84 | * currently one image is downloaded at a time, 85 | * and skips images for failed downloads and proceed to the next image in the list 86 | * 87 | * @param urls list of URLs to prefetch 88 | * @param progressBlock block to be called when progress updates; 89 | * first parameter is the number of completed (successful or not) requests, 90 | * second parameter is the total number of images originally requested to be prefetched 91 | * @param completionBlock block to be called when prefetching is completed 92 | * first param is the number of completed (successful or not) requests, 93 | * second parameter is the number of skipped requests 94 | */ 95 | - (void)prefetchURLs:(NSArray *)urls progress:(SDWebImagePrefetcherProgressBlock)progressBlock completed:(SDWebImagePrefetcherCompletionBlock)completionBlock; 96 | 97 | /** 98 | * Remove and cancel queued list 99 | */ 100 | - (void)cancelPrefetching; 101 | 102 | 103 | @end 104 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/SDWebImagePrefetcher.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImagePrefetcher.h" 10 | 11 | #if (!defined(DEBUG) && !defined (SD_VERBOSE)) || defined(SD_LOG_NONE) 12 | #define NSLog(...) 13 | #endif 14 | 15 | @interface SDWebImagePrefetcher () 16 | 17 | @property (strong, nonatomic) SDWebImageManager *manager; 18 | @property (strong, nonatomic) NSArray *prefetchURLs; 19 | @property (assign, nonatomic) NSUInteger requestedCount; 20 | @property (assign, nonatomic) NSUInteger skippedCount; 21 | @property (assign, nonatomic) NSUInteger finishedCount; 22 | @property (assign, nonatomic) NSTimeInterval startedTime; 23 | @property (copy, nonatomic) SDWebImagePrefetcherCompletionBlock completionBlock; 24 | @property (copy, nonatomic) SDWebImagePrefetcherProgressBlock progressBlock; 25 | 26 | @end 27 | 28 | @implementation SDWebImagePrefetcher 29 | 30 | + (SDWebImagePrefetcher *)sharedImagePrefetcher { 31 | static dispatch_once_t once; 32 | static id instance; 33 | dispatch_once(&once, ^{ 34 | instance = [self new]; 35 | }); 36 | return instance; 37 | } 38 | 39 | - (id)init { 40 | if ((self = [super init])) { 41 | _manager = [SDWebImageManager new]; 42 | _options = SDWebImageLowPriority; 43 | _prefetcherQueue = dispatch_get_main_queue(); 44 | self.maxConcurrentDownloads = 3; 45 | } 46 | return self; 47 | } 48 | 49 | - (void)setMaxConcurrentDownloads:(NSUInteger)maxConcurrentDownloads { 50 | self.manager.imageDownloader.maxConcurrentDownloads = maxConcurrentDownloads; 51 | } 52 | 53 | - (NSUInteger)maxConcurrentDownloads { 54 | return self.manager.imageDownloader.maxConcurrentDownloads; 55 | } 56 | 57 | - (void)startPrefetchingAtIndex:(NSUInteger)index { 58 | if (index >= self.prefetchURLs.count) return; 59 | self.requestedCount++; 60 | [self.manager downloadImageWithURL:self.prefetchURLs[index] options:self.options progress:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) { 61 | if (!finished) return; 62 | self.finishedCount++; 63 | 64 | if (image) { 65 | if (self.progressBlock) { 66 | self.progressBlock(self.finishedCount,[self.prefetchURLs count]); 67 | } 68 | NSLog(@"Prefetched %@ out of %@", @(self.finishedCount), @(self.prefetchURLs.count)); 69 | } 70 | else { 71 | if (self.progressBlock) { 72 | self.progressBlock(self.finishedCount,[self.prefetchURLs count]); 73 | } 74 | NSLog(@"Prefetched %@ out of %@ (Failed)", @(self.finishedCount), @(self.prefetchURLs.count)); 75 | 76 | // Add last failed 77 | self.skippedCount++; 78 | } 79 | if ([self.delegate respondsToSelector:@selector(imagePrefetcher:didPrefetchURL:finishedCount:totalCount:)]) { 80 | [self.delegate imagePrefetcher:self 81 | didPrefetchURL:self.prefetchURLs[index] 82 | finishedCount:self.finishedCount 83 | totalCount:self.prefetchURLs.count 84 | ]; 85 | } 86 | if (self.prefetchURLs.count > self.requestedCount) { 87 | dispatch_async(self.prefetcherQueue, ^{ 88 | [self startPrefetchingAtIndex:self.requestedCount]; 89 | }); 90 | } 91 | else if (self.finishedCount == self.requestedCount) { 92 | [self reportStatus]; 93 | if (self.completionBlock) { 94 | self.completionBlock(self.finishedCount, self.skippedCount); 95 | self.completionBlock = nil; 96 | } 97 | self.progressBlock = nil; 98 | } 99 | }]; 100 | } 101 | 102 | - (void)reportStatus { 103 | NSUInteger total = [self.prefetchURLs count]; 104 | NSLog(@"Finished prefetching (%@ successful, %@ skipped, timeElasped %.2f)", @(total - self.skippedCount), @(self.skippedCount), CFAbsoluteTimeGetCurrent() - self.startedTime); 105 | if ([self.delegate respondsToSelector:@selector(imagePrefetcher:didFinishWithTotalCount:skippedCount:)]) { 106 | [self.delegate imagePrefetcher:self 107 | didFinishWithTotalCount:(total - self.skippedCount) 108 | skippedCount:self.skippedCount 109 | ]; 110 | } 111 | } 112 | 113 | - (void)prefetchURLs:(NSArray *)urls { 114 | [self prefetchURLs:urls progress:nil completed:nil]; 115 | } 116 | 117 | - (void)prefetchURLs:(NSArray *)urls progress:(SDWebImagePrefetcherProgressBlock)progressBlock completed:(SDWebImagePrefetcherCompletionBlock)completionBlock { 118 | [self cancelPrefetching]; // Prevent duplicate prefetch request 119 | self.startedTime = CFAbsoluteTimeGetCurrent(); 120 | self.prefetchURLs = urls; 121 | self.completionBlock = completionBlock; 122 | self.progressBlock = progressBlock; 123 | 124 | if(urls.count == 0){ 125 | if(completionBlock){ 126 | completionBlock(0,0); 127 | } 128 | }else{ 129 | // Starts prefetching from the very first image on the list with the max allowed concurrency 130 | NSUInteger listCount = self.prefetchURLs.count; 131 | for (NSUInteger i = 0; i < self.maxConcurrentDownloads && self.requestedCount < listCount; i++) { 132 | [self startPrefetchingAtIndex:i]; 133 | } 134 | } 135 | } 136 | 137 | - (void)cancelPrefetching { 138 | self.prefetchURLs = nil; 139 | self.skippedCount = 0; 140 | self.requestedCount = 0; 141 | self.finishedCount = 0; 142 | [self.manager cancelAll]; 143 | } 144 | 145 | @end 146 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/UIImage+GIF.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+GIF.h 3 | // LBGIFImage 4 | // 5 | // Created by Laurin Brandner on 06.01.12. 6 | // Copyright (c) 2012 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIImage (GIF) 12 | 13 | + (UIImage *)sd_animatedGIFNamed:(NSString *)name; 14 | 15 | + (UIImage *)sd_animatedGIFWithData:(NSData *)data; 16 | 17 | - (UIImage *)sd_animatedImageByScalingAndCroppingToSize:(CGSize)size; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/UIImage+GIF.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+GIF.m 3 | // LBGIFImage 4 | // 5 | // Created by Laurin Brandner on 06.01.12. 6 | // Copyright (c) 2012 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "UIImage+GIF.h" 10 | #import 11 | 12 | @implementation UIImage (GIF) 13 | 14 | + (UIImage *)sd_animatedGIFWithData:(NSData *)data { 15 | if (!data) { 16 | return nil; 17 | } 18 | 19 | CGImageSourceRef source = CGImageSourceCreateWithData((__bridge CFDataRef)data, NULL); 20 | 21 | size_t count = CGImageSourceGetCount(source); 22 | 23 | UIImage *animatedImage; 24 | 25 | if (count <= 1) { 26 | animatedImage = [[UIImage alloc] initWithData:data]; 27 | } 28 | else { 29 | NSMutableArray *images = [NSMutableArray array]; 30 | 31 | NSTimeInterval duration = 0.0f; 32 | 33 | for (size_t i = 0; i < count; i++) { 34 | CGImageRef image = CGImageSourceCreateImageAtIndex(source, i, NULL); 35 | 36 | duration += [self sd_frameDurationAtIndex:i source:source]; 37 | 38 | [images addObject:[UIImage imageWithCGImage:image scale:[UIScreen mainScreen].scale orientation:UIImageOrientationUp]]; 39 | 40 | CGImageRelease(image); 41 | } 42 | 43 | if (!duration) { 44 | duration = (1.0f / 10.0f) * count; 45 | } 46 | 47 | animatedImage = [UIImage animatedImageWithImages:images duration:duration]; 48 | } 49 | 50 | CFRelease(source); 51 | 52 | return animatedImage; 53 | } 54 | 55 | + (float)sd_frameDurationAtIndex:(NSUInteger)index source:(CGImageSourceRef)source { 56 | float frameDuration = 0.1f; 57 | CFDictionaryRef cfFrameProperties = CGImageSourceCopyPropertiesAtIndex(source, index, nil); 58 | NSDictionary *frameProperties = (__bridge NSDictionary *)cfFrameProperties; 59 | NSDictionary *gifProperties = frameProperties[(NSString *)kCGImagePropertyGIFDictionary]; 60 | 61 | NSNumber *delayTimeUnclampedProp = gifProperties[(NSString *)kCGImagePropertyGIFUnclampedDelayTime]; 62 | if (delayTimeUnclampedProp) { 63 | frameDuration = [delayTimeUnclampedProp floatValue]; 64 | } 65 | else { 66 | 67 | NSNumber *delayTimeProp = gifProperties[(NSString *)kCGImagePropertyGIFDelayTime]; 68 | if (delayTimeProp) { 69 | frameDuration = [delayTimeProp floatValue]; 70 | } 71 | } 72 | 73 | // Many annoying ads specify a 0 duration to make an image flash as quickly as possible. 74 | // We follow Firefox's behavior and use a duration of 100 ms for any frames that specify 75 | // a duration of <= 10 ms. See and 76 | // for more information. 77 | 78 | if (frameDuration < 0.011f) { 79 | frameDuration = 0.100f; 80 | } 81 | 82 | CFRelease(cfFrameProperties); 83 | return frameDuration; 84 | } 85 | 86 | + (UIImage *)sd_animatedGIFNamed:(NSString *)name { 87 | CGFloat scale = [UIScreen mainScreen].scale; 88 | 89 | if (scale > 1.0f) { 90 | NSString *retinaPath = [[NSBundle mainBundle] pathForResource:[name stringByAppendingString:@"@2x"] ofType:@"gif"]; 91 | 92 | NSData *data = [NSData dataWithContentsOfFile:retinaPath]; 93 | 94 | if (data) { 95 | return [UIImage sd_animatedGIFWithData:data]; 96 | } 97 | 98 | NSString *path = [[NSBundle mainBundle] pathForResource:name ofType:@"gif"]; 99 | 100 | data = [NSData dataWithContentsOfFile:path]; 101 | 102 | if (data) { 103 | return [UIImage sd_animatedGIFWithData:data]; 104 | } 105 | 106 | return [UIImage imageNamed:name]; 107 | } 108 | else { 109 | NSString *path = [[NSBundle mainBundle] pathForResource:name ofType:@"gif"]; 110 | 111 | NSData *data = [NSData dataWithContentsOfFile:path]; 112 | 113 | if (data) { 114 | return [UIImage sd_animatedGIFWithData:data]; 115 | } 116 | 117 | return [UIImage imageNamed:name]; 118 | } 119 | } 120 | 121 | - (UIImage *)sd_animatedImageByScalingAndCroppingToSize:(CGSize)size { 122 | if (CGSizeEqualToSize(self.size, size) || CGSizeEqualToSize(size, CGSizeZero)) { 123 | return self; 124 | } 125 | 126 | CGSize scaledSize = size; 127 | CGPoint thumbnailPoint = CGPointZero; 128 | 129 | CGFloat widthFactor = size.width / self.size.width; 130 | CGFloat heightFactor = size.height / self.size.height; 131 | CGFloat scaleFactor = (widthFactor > heightFactor) ? widthFactor : heightFactor; 132 | scaledSize.width = self.size.width * scaleFactor; 133 | scaledSize.height = self.size.height * scaleFactor; 134 | 135 | if (widthFactor > heightFactor) { 136 | thumbnailPoint.y = (size.height - scaledSize.height) * 0.5; 137 | } 138 | else if (widthFactor < heightFactor) { 139 | thumbnailPoint.x = (size.width - scaledSize.width) * 0.5; 140 | } 141 | 142 | NSMutableArray *scaledImages = [NSMutableArray array]; 143 | 144 | UIGraphicsBeginImageContextWithOptions(size, NO, 0.0); 145 | 146 | for (UIImage *image in self.images) { 147 | [image drawInRect:CGRectMake(thumbnailPoint.x, thumbnailPoint.y, scaledSize.width, scaledSize.height)]; 148 | UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); 149 | 150 | [scaledImages addObject:newImage]; 151 | } 152 | 153 | UIGraphicsEndImageContext(); 154 | 155 | return [UIImage animatedImageWithImages:scaledImages duration:self.duration]; 156 | } 157 | 158 | @end 159 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/UIImage+MultiFormat.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+MultiFormat.h 3 | // SDWebImage 4 | // 5 | // Created by Olivier Poitrey on 07/06/13. 6 | // Copyright (c) 2013 Dailymotion. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIImage (MultiFormat) 12 | 13 | + (UIImage *)sd_imageWithData:(NSData *)data; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/UIImage+MultiFormat.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+MultiFormat.m 3 | // SDWebImage 4 | // 5 | // Created by Olivier Poitrey on 07/06/13. 6 | // Copyright (c) 2013 Dailymotion. All rights reserved. 7 | // 8 | 9 | #import "UIImage+MultiFormat.h" 10 | #import "UIImage+GIF.h" 11 | #import "NSData+ImageContentType.h" 12 | #import 13 | 14 | #ifdef SD_WEBP 15 | #import "UIImage+WebP.h" 16 | #endif 17 | 18 | @implementation UIImage (MultiFormat) 19 | 20 | + (UIImage *)sd_imageWithData:(NSData *)data { 21 | if (!data) { 22 | return nil; 23 | } 24 | 25 | UIImage *image; 26 | NSString *imageContentType = [NSData sd_contentTypeForImageData:data]; 27 | if ([imageContentType isEqualToString:@"image/gif"]) { 28 | image = [UIImage sd_animatedGIFWithData:data]; 29 | } 30 | #ifdef SD_WEBP 31 | else if ([imageContentType isEqualToString:@"image/webp"]) 32 | { 33 | image = [UIImage sd_imageWithWebPData:data]; 34 | } 35 | #endif 36 | else { 37 | image = [[UIImage alloc] initWithData:data]; 38 | UIImageOrientation orientation = [self sd_imageOrientationFromImageData:data]; 39 | if (orientation != UIImageOrientationUp) { 40 | image = [UIImage imageWithCGImage:image.CGImage 41 | scale:image.scale 42 | orientation:orientation]; 43 | } 44 | } 45 | 46 | 47 | return image; 48 | } 49 | 50 | 51 | +(UIImageOrientation)sd_imageOrientationFromImageData:(NSData *)imageData { 52 | UIImageOrientation result = UIImageOrientationUp; 53 | CGImageSourceRef imageSource = CGImageSourceCreateWithData((__bridge CFDataRef)imageData, NULL); 54 | if (imageSource) { 55 | CFDictionaryRef properties = CGImageSourceCopyPropertiesAtIndex(imageSource, 0, NULL); 56 | if (properties) { 57 | CFTypeRef val; 58 | int exifOrientation; 59 | val = CFDictionaryGetValue(properties, kCGImagePropertyOrientation); 60 | if (val) { 61 | CFNumberGetValue(val, kCFNumberIntType, &exifOrientation); 62 | result = [self sd_exifOrientationToiOSOrientation:exifOrientation]; 63 | } // else - if it's not set it remains at up 64 | CFRelease((CFTypeRef) properties); 65 | } else { 66 | //NSLog(@"NO PROPERTIES, FAIL"); 67 | } 68 | CFRelease(imageSource); 69 | } 70 | return result; 71 | } 72 | 73 | #pragma mark EXIF orientation tag converter 74 | // Convert an EXIF image orientation to an iOS one. 75 | // reference see here: http://sylvana.net/jpegcrop/exif_orientation.html 76 | + (UIImageOrientation) sd_exifOrientationToiOSOrientation:(int)exifOrientation { 77 | UIImageOrientation orientation = UIImageOrientationUp; 78 | switch (exifOrientation) { 79 | case 1: 80 | orientation = UIImageOrientationUp; 81 | break; 82 | 83 | case 3: 84 | orientation = UIImageOrientationDown; 85 | break; 86 | 87 | case 8: 88 | orientation = UIImageOrientationLeft; 89 | break; 90 | 91 | case 6: 92 | orientation = UIImageOrientationRight; 93 | break; 94 | 95 | case 2: 96 | orientation = UIImageOrientationUpMirrored; 97 | break; 98 | 99 | case 4: 100 | orientation = UIImageOrientationDownMirrored; 101 | break; 102 | 103 | case 5: 104 | orientation = UIImageOrientationLeftMirrored; 105 | break; 106 | 107 | case 7: 108 | orientation = UIImageOrientationRightMirrored; 109 | break; 110 | default: 111 | break; 112 | } 113 | return orientation; 114 | } 115 | 116 | 117 | 118 | @end 119 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/UIImageView+HighlightedWebCache.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | #import "SDWebImageCompat.h" 11 | #import "SDWebImageManager.h" 12 | 13 | /** 14 | * Integrates SDWebImage async downloading and caching of remote images with UIImageView for highlighted state. 15 | */ 16 | @interface UIImageView (HighlightedWebCache) 17 | 18 | /** 19 | * Set the imageView `highlightedImage` with an `url`. 20 | * 21 | * The download is asynchronous and cached. 22 | * 23 | * @param url The url for the image. 24 | */ 25 | - (void)sd_setHighlightedImageWithURL:(NSURL *)url; 26 | 27 | /** 28 | * Set the imageView `highlightedImage` with an `url` and custom options. 29 | * 30 | * The download is asynchronous and cached. 31 | * 32 | * @param url The url for the image. 33 | * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. 34 | */ 35 | - (void)sd_setHighlightedImageWithURL:(NSURL *)url options:(SDWebImageOptions)options; 36 | 37 | /** 38 | * Set the imageView `highlightedImage` with an `url`. 39 | * 40 | * The download is asynchronous and cached. 41 | * 42 | * @param url The url for the image. 43 | * @param completedBlock A block called when operation has been completed. This block has no return value 44 | * and takes the requested UIImage as first parameter. In case of error the image parameter 45 | * is nil and the second parameter may contain an NSError. The third parameter is a Boolean 46 | * indicating if the image was retrived from the local cache or from the network. 47 | * The fourth parameter is the original image url. 48 | */ 49 | - (void)sd_setHighlightedImageWithURL:(NSURL *)url completed:(SDWebImageCompletionBlock)completedBlock; 50 | 51 | /** 52 | * Set the imageView `highlightedImage` with an `url` and custom options. 53 | * 54 | * The download is asynchronous and cached. 55 | * 56 | * @param url The url for the image. 57 | * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. 58 | * @param completedBlock A block called when operation has been completed. This block has no return value 59 | * and takes the requested UIImage as first parameter. In case of error the image parameter 60 | * is nil and the second parameter may contain an NSError. The third parameter is a Boolean 61 | * indicating if the image was retrived from the local cache or from the network. 62 | * The fourth parameter is the original image url. 63 | */ 64 | - (void)sd_setHighlightedImageWithURL:(NSURL *)url options:(SDWebImageOptions)options completed:(SDWebImageCompletionBlock)completedBlock; 65 | 66 | /** 67 | * Set the imageView `highlightedImage` with an `url` and custom options. 68 | * 69 | * The download is asynchronous and cached. 70 | * 71 | * @param url The url for the image. 72 | * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. 73 | * @param progressBlock A block called while image is downloading 74 | * @param completedBlock A block called when operation has been completed. This block has no return value 75 | * and takes the requested UIImage as first parameter. In case of error the image parameter 76 | * is nil and the second parameter may contain an NSError. The third parameter is a Boolean 77 | * indicating if the image was retrived from the local cache or from the network. 78 | * The fourth parameter is the original image url. 79 | */ 80 | - (void)sd_setHighlightedImageWithURL:(NSURL *)url options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletionBlock)completedBlock; 81 | 82 | /** 83 | * Cancel the current download 84 | */ 85 | - (void)sd_cancelCurrentHighlightedImageLoad; 86 | 87 | @end 88 | 89 | 90 | @interface UIImageView (HighlightedWebCacheDeprecated) 91 | 92 | - (void)setHighlightedImageWithURL:(NSURL *)url __deprecated_msg("Method deprecated. Use `sd_setHighlightedImageWithURL:`"); 93 | - (void)setHighlightedImageWithURL:(NSURL *)url options:(SDWebImageOptions)options __deprecated_msg("Method deprecated. Use `sd_setHighlightedImageWithURL:options:`"); 94 | - (void)setHighlightedImageWithURL:(NSURL *)url completed:(SDWebImageCompletedBlock)completedBlock __deprecated_msg("Method deprecated. Use `sd_setHighlightedImageWithURL:completed:`"); 95 | - (void)setHighlightedImageWithURL:(NSURL *)url options:(SDWebImageOptions)options completed:(SDWebImageCompletedBlock)completedBlock __deprecated_msg("Method deprecated. Use `sd_setHighlightedImageWithURL:options:completed:`"); 96 | - (void)setHighlightedImageWithURL:(NSURL *)url options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletedBlock)completedBlock __deprecated_msg("Method deprecated. Use `sd_setHighlightedImageWithURL:options:progress:completed:`"); 97 | 98 | - (void)cancelCurrentHighlightedImageLoad __deprecated_msg("Use `sd_cancelCurrentHighlightedImageLoad`"); 99 | 100 | @end 101 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/UIImageView+HighlightedWebCache.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "UIImageView+HighlightedWebCache.h" 10 | #import "UIView+WebCacheOperation.h" 11 | 12 | #define UIImageViewHighlightedWebCacheOperationKey @"highlightedImage" 13 | 14 | @implementation UIImageView (HighlightedWebCache) 15 | 16 | - (void)sd_setHighlightedImageWithURL:(NSURL *)url { 17 | [self sd_setHighlightedImageWithURL:url options:0 progress:nil completed:nil]; 18 | } 19 | 20 | - (void)sd_setHighlightedImageWithURL:(NSURL *)url options:(SDWebImageOptions)options { 21 | [self sd_setHighlightedImageWithURL:url options:options progress:nil completed:nil]; 22 | } 23 | 24 | - (void)sd_setHighlightedImageWithURL:(NSURL *)url completed:(SDWebImageCompletionBlock)completedBlock { 25 | [self sd_setHighlightedImageWithURL:url options:0 progress:nil completed:completedBlock]; 26 | } 27 | 28 | - (void)sd_setHighlightedImageWithURL:(NSURL *)url options:(SDWebImageOptions)options completed:(SDWebImageCompletionBlock)completedBlock { 29 | [self sd_setHighlightedImageWithURL:url options:options progress:nil completed:completedBlock]; 30 | } 31 | 32 | - (void)sd_setHighlightedImageWithURL:(NSURL *)url options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletionBlock)completedBlock { 33 | [self sd_cancelCurrentHighlightedImageLoad]; 34 | 35 | if (url) { 36 | __weak __typeof(self)wself = self; 37 | id operation = [SDWebImageManager.sharedManager downloadImageWithURL:url options:options progress:progressBlock completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) { 38 | if (!wself) return; 39 | dispatch_main_sync_safe (^ 40 | { 41 | if (!wself) return; 42 | if (image) { 43 | wself.highlightedImage = image; 44 | [wself setNeedsLayout]; 45 | } 46 | if (completedBlock && finished) { 47 | completedBlock(image, error, cacheType, url); 48 | } 49 | }); 50 | }]; 51 | [self sd_setImageLoadOperation:operation forKey:UIImageViewHighlightedWebCacheOperationKey]; 52 | } else { 53 | dispatch_main_async_safe(^{ 54 | NSError *error = [NSError errorWithDomain:SDWebImageErrorDomain code:-1 userInfo:@{NSLocalizedDescriptionKey : @"Trying to load a nil url"}]; 55 | if (completedBlock) { 56 | completedBlock(nil, error, SDImageCacheTypeNone, url); 57 | } 58 | }); 59 | } 60 | } 61 | 62 | - (void)sd_cancelCurrentHighlightedImageLoad { 63 | [self sd_cancelImageLoadOperationWithKey:UIImageViewHighlightedWebCacheOperationKey]; 64 | } 65 | 66 | @end 67 | 68 | 69 | @implementation UIImageView (HighlightedWebCacheDeprecated) 70 | 71 | - (void)setHighlightedImageWithURL:(NSURL *)url { 72 | [self sd_setHighlightedImageWithURL:url options:0 progress:nil completed:nil]; 73 | } 74 | 75 | - (void)setHighlightedImageWithURL:(NSURL *)url options:(SDWebImageOptions)options { 76 | [self sd_setHighlightedImageWithURL:url options:options progress:nil completed:nil]; 77 | } 78 | 79 | - (void)setHighlightedImageWithURL:(NSURL *)url completed:(SDWebImageCompletedBlock)completedBlock { 80 | [self sd_setHighlightedImageWithURL:url options:0 progress:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) { 81 | if (completedBlock) { 82 | completedBlock(image, error, cacheType); 83 | } 84 | }]; 85 | } 86 | 87 | - (void)setHighlightedImageWithURL:(NSURL *)url options:(SDWebImageOptions)options completed:(SDWebImageCompletedBlock)completedBlock { 88 | [self sd_setHighlightedImageWithURL:url options:options progress:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) { 89 | if (completedBlock) { 90 | completedBlock(image, error, cacheType); 91 | } 92 | }]; 93 | } 94 | 95 | - (void)setHighlightedImageWithURL:(NSURL *)url options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletedBlock)completedBlock { 96 | [self sd_setHighlightedImageWithURL:url options:0 progress:progressBlock completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) { 97 | if (completedBlock) { 98 | completedBlock(image, error, cacheType); 99 | } 100 | }]; 101 | } 102 | 103 | - (void)cancelCurrentHighlightedImageLoad { 104 | [self sd_cancelCurrentHighlightedImageLoad]; 105 | } 106 | 107 | @end 108 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/UIView+WebCacheOperation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | #import "SDWebImageManager.h" 11 | 12 | @interface UIView (WebCacheOperation) 13 | 14 | /** 15 | * Set the image load operation (storage in a UIView based dictionary) 16 | * 17 | * @param operation the operation 18 | * @param key key for storing the operation 19 | */ 20 | - (void)sd_setImageLoadOperation:(id)operation forKey:(NSString *)key; 21 | 22 | /** 23 | * Cancel all operations for the current UIView and key 24 | * 25 | * @param key key for identifying the operations 26 | */ 27 | - (void)sd_cancelImageLoadOperationWithKey:(NSString *)key; 28 | 29 | /** 30 | * Just remove the operations corresponding to the current UIView and key without cancelling them 31 | * 32 | * @param key key for identifying the operations 33 | */ 34 | - (void)sd_removeImageLoadOperationWithKey:(NSString *)key; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /Pods/SDWebImage/SDWebImage/UIView+WebCacheOperation.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "UIView+WebCacheOperation.h" 10 | #import "objc/runtime.h" 11 | 12 | static char loadOperationKey; 13 | 14 | @implementation UIView (WebCacheOperation) 15 | 16 | - (NSMutableDictionary *)operationDictionary { 17 | NSMutableDictionary *operations = objc_getAssociatedObject(self, &loadOperationKey); 18 | if (operations) { 19 | return operations; 20 | } 21 | operations = [NSMutableDictionary dictionary]; 22 | objc_setAssociatedObject(self, &loadOperationKey, operations, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 23 | return operations; 24 | } 25 | 26 | - (void)sd_setImageLoadOperation:(id)operation forKey:(NSString *)key { 27 | [self sd_cancelImageLoadOperationWithKey:key]; 28 | NSMutableDictionary *operationDictionary = [self operationDictionary]; 29 | [operationDictionary setObject:operation forKey:key]; 30 | } 31 | 32 | - (void)sd_cancelImageLoadOperationWithKey:(NSString *)key { 33 | // Cancel in progress downloader from queue 34 | NSMutableDictionary *operationDictionary = [self operationDictionary]; 35 | id operations = [operationDictionary objectForKey:key]; 36 | if (operations) { 37 | if ([operations isKindOfClass:[NSArray class]]) { 38 | for (id operation in operations) { 39 | if (operation) { 40 | [operation cancel]; 41 | } 42 | } 43 | } else if ([operations conformsToProtocol:@protocol(SDWebImageOperation)]){ 44 | [(id) operations cancel]; 45 | } 46 | [operationDictionary removeObjectForKey:key]; 47 | } 48 | } 49 | 50 | - (void)sd_removeImageLoadOperationWithKey:(NSString *)key { 51 | NSMutableDictionary *operationDictionary = [self operationDictionary]; 52 | [operationDictionary removeObjectForKey:key]; 53 | } 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /Pods/Target Support Files/KVOController/KVOController-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_KVOController : NSObject 3 | @end 4 | @implementation PodsDummy_KVOController 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/KVOController/KVOController-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /Pods/Target Support Files/KVOController/KVOController.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/KVOController" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/KVOController" "${PODS_ROOT}/Headers/Public/Masonry" "${PODS_ROOT}/Headers/Public/SDWebImage" 3 | PODS_ROOT = ${SRCROOT} 4 | SKIP_INSTALL = YES -------------------------------------------------------------------------------- /Pods/Target Support Files/Masonry/Masonry-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Masonry : NSObject 3 | @end 4 | @implementation PodsDummy_Masonry 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Masonry/Masonry-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Masonry/Masonry.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/Masonry" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/KVOController" "${PODS_ROOT}/Headers/Public/Masonry" "${PODS_ROOT}/Headers/Public/SDWebImage" 3 | OTHER_LDFLAGS = -framework "Foundation" -framework "UIKit" 4 | PODS_ROOT = ${SRCROOT} 5 | SKIP_INSTALL = YES -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-CDDDemo/Pods-CDDDemo-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## KVOController 5 | 6 | BSD License 7 | 8 | For KVOController software 9 | 10 | Copyright (c) 2014, Facebook, Inc. All rights reserved. 11 | 12 | Redistribution and use in source and binary forms, with or without modification, 13 | are permitted provided that the following conditions are met: 14 | 15 | * Redistributions of source code must retain the above copyright notice, this 16 | list of conditions and the following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above copyright notice, 19 | this list of conditions and the following disclaimer in the documentation 20 | and/or other materials provided with the distribution. 21 | 22 | * Neither the name Facebook nor the names of its contributors may be used to 23 | endorse or promote products derived from this software without specific 24 | prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 27 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 28 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 29 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 30 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 31 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 32 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 33 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 35 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | 37 | 38 | ## Masonry 39 | 40 | Copyright (c) 2011-2012 Masonry Team - https://github.com/Masonry 41 | 42 | Permission is hereby granted, free of charge, to any person obtaining a copy 43 | of this software and associated documentation files (the "Software"), to deal 44 | in the Software without restriction, including without limitation the rights 45 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 46 | copies of the Software, and to permit persons to whom the Software is 47 | furnished to do so, subject to the following conditions: 48 | 49 | The above copyright notice and this permission notice shall be included in 50 | all copies or substantial portions of the Software. 51 | 52 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 53 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 54 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 55 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 56 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 57 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 58 | THE SOFTWARE. 59 | 60 | ## SDWebImage 61 | 62 | Copyright (c) 2009 Olivier Poitrey 63 | 64 | Permission is hereby granted, free of charge, to any person obtaining a copy 65 | of this software and associated documentation files (the "Software"), to deal 66 | in the Software without restriction, including without limitation the rights 67 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 68 | copies of the Software, and to permit persons to whom the Software is furnished 69 | to do so, subject to the following conditions: 70 | 71 | The above copyright notice and this permission notice shall be included in all 72 | copies or substantial portions of the Software. 73 | 74 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 75 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 76 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 77 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 78 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 79 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 80 | THE SOFTWARE. 81 | 82 | 83 | Generated by CocoaPods - http://cocoapods.org 84 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-CDDDemo/Pods-CDDDemo-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | BSD License 18 | 19 | For KVOController software 20 | 21 | Copyright (c) 2014, Facebook, Inc. All rights reserved. 22 | 23 | Redistribution and use in source and binary forms, with or without modification, 24 | are permitted provided that the following conditions are met: 25 | 26 | * Redistributions of source code must retain the above copyright notice, this 27 | list of conditions and the following disclaimer. 28 | 29 | * Redistributions in binary form must reproduce the above copyright notice, 30 | this list of conditions and the following disclaimer in the documentation 31 | and/or other materials provided with the distribution. 32 | 33 | * Neither the name Facebook nor the names of its contributors may be used to 34 | endorse or promote products derived from this software without specific 35 | prior written permission. 36 | 37 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 38 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 39 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 40 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 41 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 42 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 43 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 44 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 45 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 46 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 47 | 48 | Title 49 | KVOController 50 | Type 51 | PSGroupSpecifier 52 | 53 | 54 | FooterText 55 | Copyright (c) 2011-2012 Masonry Team - https://github.com/Masonry 56 | 57 | Permission is hereby granted, free of charge, to any person obtaining a copy 58 | of this software and associated documentation files (the "Software"), to deal 59 | in the Software without restriction, including without limitation the rights 60 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 61 | copies of the Software, and to permit persons to whom the Software is 62 | furnished to do so, subject to the following conditions: 63 | 64 | The above copyright notice and this permission notice shall be included in 65 | all copies or substantial portions of the Software. 66 | 67 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 68 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 69 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 70 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 71 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 72 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 73 | THE SOFTWARE. 74 | Title 75 | Masonry 76 | Type 77 | PSGroupSpecifier 78 | 79 | 80 | FooterText 81 | Copyright (c) 2009 Olivier Poitrey <rs@dailymotion.com> 82 | 83 | Permission is hereby granted, free of charge, to any person obtaining a copy 84 | of this software and associated documentation files (the "Software"), to deal 85 | in the Software without restriction, including without limitation the rights 86 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 87 | copies of the Software, and to permit persons to whom the Software is furnished 88 | to do so, subject to the following conditions: 89 | 90 | The above copyright notice and this permission notice shall be included in all 91 | copies or substantial portions of the Software. 92 | 93 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 94 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 95 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 96 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 97 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 98 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 99 | THE SOFTWARE. 100 | 101 | 102 | Title 103 | SDWebImage 104 | Type 105 | PSGroupSpecifier 106 | 107 | 108 | FooterText 109 | Generated by CocoaPods - http://cocoapods.org 110 | Title 111 | 112 | Type 113 | PSGroupSpecifier 114 | 115 | 116 | StringsTable 117 | Acknowledgements 118 | Title 119 | Acknowledgements 120 | 121 | 122 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-CDDDemo/Pods-CDDDemo-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_CDDDemo : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_CDDDemo 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-CDDDemo/Pods-CDDDemo-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 6 | 7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 8 | 9 | install_framework() 10 | { 11 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 12 | local source="${BUILT_PRODUCTS_DIR}/$1" 13 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 14 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 15 | elif [ -r "$1" ]; then 16 | local source="$1" 17 | fi 18 | 19 | local destination="${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 20 | 21 | if [ -L "${source}" ]; then 22 | echo "Symlinked..." 23 | source="$(readlink "${source}")" 24 | fi 25 | 26 | # use filter instead of exclude so missing patterns dont' throw errors 27 | echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 28 | rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 29 | 30 | local basename 31 | basename="$(basename -s .framework "$1")" 32 | binary="${destination}/${basename}.framework/${basename}" 33 | if ! [ -r "$binary" ]; then 34 | binary="${destination}/${basename}" 35 | fi 36 | 37 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 38 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 39 | strip_invalid_archs "$binary" 40 | fi 41 | 42 | # Resign the code if required by the build settings to avoid unstable apps 43 | code_sign_if_enabled "${destination}/$(basename "$1")" 44 | 45 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 46 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 47 | local swift_runtime_libs 48 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) 49 | for lib in $swift_runtime_libs; do 50 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 51 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 52 | code_sign_if_enabled "${destination}/${lib}" 53 | done 54 | fi 55 | } 56 | 57 | # Signs a framework with the provided identity 58 | code_sign_if_enabled() { 59 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 60 | # Use the current code_sign_identitiy 61 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 62 | echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements \"$1\"" 63 | /usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements "$1" 64 | fi 65 | } 66 | 67 | # Strip invalid architectures 68 | strip_invalid_archs() { 69 | binary="$1" 70 | # Get architectures for current file 71 | archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)" 72 | stripped="" 73 | for arch in $archs; do 74 | if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then 75 | # Strip non-valid architectures in-place 76 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1 77 | stripped="$stripped $arch" 78 | fi 79 | done 80 | if [[ "$stripped" ]]; then 81 | echo "Stripped $binary of architectures:$stripped" 82 | fi 83 | } 84 | 85 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-CDDDemo/Pods-CDDDemo-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 5 | 6 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 7 | > "$RESOURCES_TO_COPY" 8 | 9 | XCASSET_FILES=() 10 | 11 | realpath() { 12 | DIRECTORY="$(cd "${1%/*}" && pwd)" 13 | FILENAME="${1##*/}" 14 | echo "$DIRECTORY/$FILENAME" 15 | } 16 | 17 | install_resource() 18 | { 19 | case $1 in 20 | *.storyboard) 21 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc ${PODS_ROOT}/$1 --sdk ${SDKROOT}" 22 | ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" 23 | ;; 24 | *.xib) 25 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib ${PODS_ROOT}/$1 --sdk ${SDKROOT}" 26 | ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" 27 | ;; 28 | *.framework) 29 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 30 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 31 | echo "rsync -av ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 32 | rsync -av "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 33 | ;; 34 | *.xcdatamodel) 35 | echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1"`.mom\"" 36 | xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodel`.mom" 37 | ;; 38 | *.xcdatamodeld) 39 | echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\"" 40 | xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd" 41 | ;; 42 | *.xcmappingmodel) 43 | echo "xcrun mapc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm\"" 44 | xcrun mapc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm" 45 | ;; 46 | *.xcassets) 47 | ABSOLUTE_XCASSET_FILE=$(realpath "${PODS_ROOT}/$1") 48 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 49 | ;; 50 | /*) 51 | echo "$1" 52 | echo "$1" >> "$RESOURCES_TO_COPY" 53 | ;; 54 | *) 55 | echo "${PODS_ROOT}/$1" 56 | echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY" 57 | ;; 58 | esac 59 | } 60 | 61 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 62 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 63 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then 64 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 65 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 66 | fi 67 | rm -f "$RESOURCES_TO_COPY" 68 | 69 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] 70 | then 71 | case "${TARGETED_DEVICE_FAMILY}" in 72 | 1,2) 73 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 74 | ;; 75 | 1) 76 | TARGET_DEVICE_ARGS="--target-device iphone" 77 | ;; 78 | 2) 79 | TARGET_DEVICE_ARGS="--target-device ipad" 80 | ;; 81 | *) 82 | TARGET_DEVICE_ARGS="--target-device mac" 83 | ;; 84 | esac 85 | 86 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 87 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 88 | while read line; do 89 | if [[ $line != "`realpath $PODS_ROOT`*" ]]; then 90 | XCASSET_FILES+=("$line") 91 | fi 92 | done <<<"$OTHER_XCASSETS" 93 | 94 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${IPHONEOS_DEPLOYMENT_TARGET}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 95 | fi 96 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-CDDDemo/Pods-CDDDemo.debug.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/KVOController" "${PODS_ROOT}/Headers/Public/Masonry" "${PODS_ROOT}/Headers/Public/SDWebImage" 3 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/KVOController" -isystem "${PODS_ROOT}/Headers/Public/Masonry" -isystem "${PODS_ROOT}/Headers/Public/SDWebImage" 4 | OTHER_LDFLAGS = $(inherited) -ObjC -l"KVOController" -l"Masonry" -l"SDWebImage" -framework "Foundation" -framework "ImageIO" -framework "UIKit" 5 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-CDDDemo/Pods-CDDDemo.release.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/KVOController" "${PODS_ROOT}/Headers/Public/Masonry" "${PODS_ROOT}/Headers/Public/SDWebImage" 3 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/KVOController" -isystem "${PODS_ROOT}/Headers/Public/Masonry" -isystem "${PODS_ROOT}/Headers/Public/SDWebImage" 4 | OTHER_LDFLAGS = $(inherited) -ObjC -l"KVOController" -l"Masonry" -l"SDWebImage" -framework "Foundation" -framework "ImageIO" -framework "UIKit" 5 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /Pods/Target Support Files/SDWebImage/SDWebImage-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_SDWebImage : NSObject 3 | @end 4 | @implementation PodsDummy_SDWebImage 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/SDWebImage/SDWebImage-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /Pods/Target Support Files/SDWebImage/SDWebImage.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/SDWebImage" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/KVOController" "${PODS_ROOT}/Headers/Public/Masonry" "${PODS_ROOT}/Headers/Public/SDWebImage" 3 | OTHER_LDFLAGS = -framework "ImageIO" 4 | PODS_ROOT = ${SRCROOT} 5 | SKIP_INSTALL = YES --------------------------------------------------------------------------------