Repository: CoderJackyHuang/HYBHelperKit Branch: master Commit: c574b99020a4 Files: 150 Total size: 459.0 KB Directory structure: gitextract_grqcoj_k/ ├── .travis.yml ├── HYBHelperKit/ │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets/ │ │ └── AppIcon.appiconset/ │ │ └── Contents.json │ ├── Base.lproj/ │ │ └── LaunchScreen.storyboard │ ├── Info.plist │ ├── TestViewController1.h │ ├── TestViewController1.m │ ├── ViewController.h │ ├── ViewController.m │ └── main.m ├── HYBHelperKit.podspec ├── HYBHelperKit.xcodeproj/ │ ├── project.pbxproj │ ├── project.xcworkspace/ │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata/ │ │ └── huangyibiao.xcuserdatad/ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata/ │ └── huangyibiao.xcuserdatad/ │ ├── xcdebugger/ │ │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes/ │ ├── HYBHelperKit.xcscheme │ └── xcschememanagement.plist ├── HYBHelperKit.xcworkspace/ │ ├── contents.xcworkspacedata │ └── xcuserdata/ │ └── huangyibiao.xcuserdatad/ │ ├── UserInterfaceState.xcuserstate │ └── xcdebugger/ │ └── Breakpoints_v2.xcbkptlist ├── HYBHelperKitSources/ │ ├── HYBCommonKit.h │ ├── HYBCommonKit.m │ ├── HYBHelperBlocksKit.h │ ├── HYBHelperKit.h │ ├── HYBHelperKitBaseController.h │ ├── HYBHelperKitBaseController.m │ ├── HYBHelperKitBaseURLController.h │ ├── HYBHelperKitBaseURLController.m │ ├── HYBHelperKitTestEntranceController.h │ ├── HYBHelperKitTestEntranceController.m │ ├── HYBHelperMasonryMaker.h │ ├── HYBHelperUIKit.h │ ├── NSArray+HYBHelperKit.h │ ├── NSArray+HYBHelperKit.m │ ├── NSDate+HYBHelperKit.h │ ├── NSDate+HYBHelperKit.m │ ├── NSDictionary+HYBHelperKit.h │ ├── NSDictionary+HYBHelperKit.m │ ├── NSFileManager+HYBHelperKit.h │ ├── NSFileManager+HYBHelperKit.m │ ├── NSMutableArray+HYBHelperKit.h │ ├── NSMutableArray+HYBHelperKit.m │ ├── NSMutableDictionary+HYBHelperKit.h │ ├── NSMutableDictionary+HYBHelperKit.m │ ├── NSNumber+HYBHelperKit.h │ ├── NSNumber+HYBHelperKit.m │ ├── NSObject+HYBHelperKit.h │ ├── NSObject+HYBHelperKit.m │ ├── NSString+HYBHelperKit.h │ ├── NSString+HYBHelperKit.m │ ├── NSTimer+HYBHelperKit.h │ ├── NSTimer+HYBHelperKit.m │ ├── NSUserDefaults+HYBHelperKit.h │ ├── NSUserDefaults+HYBHelperKit.m │ ├── UIActionSheet+HYBHelperKit.h │ ├── UIActionSheet+HYBHelperKit.m │ ├── UIAlertView+HYBHelperKit.h │ ├── UIAlertView+HYBHelperKit.m │ ├── UIButton+HYBHelperBlockKit.h │ ├── UIButton+HYBHelperBlockKit.m │ ├── UICollectionView+HYBMaonsryKit.h │ ├── UICollectionView+HYBMaonsryKit.m │ ├── UIColor+HYBHelperKitUIKit.h │ ├── UIColor+HYBHelperKitUIKit.m │ ├── UIControl+HYBHelperBlockKit.h │ ├── UIControl+HYBHelperBlockKit.m │ ├── UIDevice+HYBHelperKitUIKit.h │ ├── UIDevice+HYBHelperKitUIKit.m │ ├── UIGestureRecognizer+HYBHelperBlockKit.h │ ├── UIGestureRecognizer+HYBHelperBlockKit.m │ ├── UIImageView+HYBMasonryKit.h │ ├── UIImageView+HYBMasonryKit.m │ ├── UILabel+HYBMasonryKit.h │ ├── UILabel+HYBMasonryKit.m │ ├── UIScrollView+HYBMasonryKit.h │ ├── UIScrollView+HYBMasonryKit.m │ ├── UITableView+HYBMasonryKit.h │ ├── UITableView+HYBMasonryKit.m │ ├── UITextField+HYBMasonryKit.h │ ├── UITextField+HYBMasonryKit.m │ ├── UIView+HYBHelperBlockKit.h │ ├── UIView+HYBHelperBlockKit.m │ ├── UIView+HYBHelperKitUIKit.h │ ├── UIView+HYBHelperKitUIKit.m │ ├── UIView+HYBMasonryKit.h │ ├── UIView+HYBMasonryKit.m │ ├── UIWebView+HYBMasonryKit.h │ └── UIWebView+HYBMasonryKit.m ├── HYBHelperKitTests/ │ ├── ArrayTests.m │ ├── DictionaryTests.m │ ├── HYBHelperKitTests.m │ ├── Info.plist │ ├── NSObjectTests.m │ ├── NSStringTests.m │ ├── NSTimerTests.m │ └── NSUserDefaultsTests.m ├── LICENSE ├── Podfile ├── Pods/ │ ├── 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/ │ │ └── huangyibiao.xcuserdatad/ │ │ └── xcschemes/ │ │ ├── Masonry.xcscheme │ │ ├── Pods-HYBHelperKit.xcscheme │ │ ├── Pods-HYBHelperKitTests.xcscheme │ │ └── xcschememanagement.plist │ └── Target Support Files/ │ ├── Masonry/ │ │ ├── Masonry-dummy.m │ │ ├── Masonry-prefix.pch │ │ └── Masonry.xcconfig │ ├── Pods-HYBHelperKit/ │ │ ├── Pods-HYBHelperKit-acknowledgements.markdown │ │ ├── Pods-HYBHelperKit-acknowledgements.plist │ │ ├── Pods-HYBHelperKit-dummy.m │ │ ├── Pods-HYBHelperKit-frameworks.sh │ │ ├── Pods-HYBHelperKit-resources.sh │ │ ├── Pods-HYBHelperKit.debug.xcconfig │ │ └── Pods-HYBHelperKit.release.xcconfig │ └── Pods-HYBHelperKitTests/ │ ├── Pods-HYBHelperKitTests-acknowledgements.markdown │ ├── Pods-HYBHelperKitTests-acknowledgements.plist │ ├── Pods-HYBHelperKitTests-dummy.m │ ├── Pods-HYBHelperKitTests-frameworks.sh │ ├── Pods-HYBHelperKitTests-resources.sh │ ├── Pods-HYBHelperKitTests.debug.xcconfig │ └── Pods-HYBHelperKitTests.release.xcconfig ├── README.md └── codecov.yml ================================================ FILE CONTENTS ================================================ ================================================ FILE: .travis.yml ================================================ language: objective-c xcode_workspace: HYBHelperkit.xcworkspace xcode_scheme: HYBHelperKit script: - date ================================================ FILE: HYBHelperKit/AppDelegate.h ================================================ // // AppDelegate.h // HYBHelperKit // // Created by huangyibiao on 16/6/29. // Copyright © 2016年 huangyibiao. All rights reserved. // #import @interface AppDelegate : UIResponder @property (strong, nonatomic) UIWindow *window; @property (nonatomic, copy) NSString *baseURL; @end ================================================ FILE: HYBHelperKit/AppDelegate.m ================================================ // // AppDelegate.m // HYBHelperKit // // Created by huangyibiao on 16/6/29. // Copyright © 2016年 huangyibiao. All rights reserved. // #import "AppDelegate.h" #import "HYBHelperKit.h" #import "ViewController.h" @interface AppDelegate () @end @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:kScreenBounds]; self.window.backgroundColor = kWhiteColor; BOOL product = NO; if (!product) { HYBHelperKitBaseURLController *vc = [HYBHelperKitBaseURLController createWithBaseURLs:^NSArray *{ return @[@"http://101.200.209.244", @"http://www.huangyibiao.com", ]; } onCallback:^(NSString *result) { self.baseURL = result; // 选好base url后,修改root window UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:[ViewController new]]; self.window.rootViewController = nav; }]; UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc]; self.window.rootViewController = nav; } else { // } [self.window makeKeyAndVisible]; return YES; } - (void)applicationWillResignActive:(UIApplication *)application { // 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. // 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. } - (void)applicationDidEnterBackground:(UIApplication *)application { // 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. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } - (void)applicationWillEnterForeground:(UIApplication *)application { // 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. } - (void)applicationDidBecomeActive:(UIApplication *)application { // 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. } - (void)applicationWillTerminate:(UIApplication *)application { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } @end ================================================ FILE: HYBHelperKit/Assets.xcassets/AppIcon.appiconset/Contents.json ================================================ { "images" : [ { "idiom" : "iphone", "size" : "29x29", "scale" : "2x" }, { "idiom" : "iphone", "size" : "29x29", "scale" : "3x" }, { "idiom" : "iphone", "size" : "40x40", "scale" : "2x" }, { "idiom" : "iphone", "size" : "40x40", "scale" : "3x" }, { "idiom" : "iphone", "size" : "60x60", "scale" : "2x" }, { "idiom" : "iphone", "size" : "60x60", "scale" : "3x" } ], "info" : { "version" : 1, "author" : "xcode" } } ================================================ FILE: HYBHelperKit/Base.lproj/LaunchScreen.storyboard ================================================ ================================================ FILE: HYBHelperKit/Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName $(PRODUCT_NAME) CFBundlePackageType APPL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1 LSRequiresIPhoneOS UILaunchStoryboardName LaunchScreen UIRequiredDeviceCapabilities armv7 UISupportedInterfaceOrientations UIInterfaceOrientationPortrait ================================================ FILE: HYBHelperKit/TestViewController1.h ================================================ // // TestViewController1.h // HYBHelperKit // // Created by huangyibiao on 16/7/9. // Copyright © 2016年 huangyibiao. All rights reserved. // #import "HYBHelperKitBaseController.h" @interface TestViewController1 : HYBHelperKitBaseController @end ================================================ FILE: HYBHelperKit/TestViewController1.m ================================================ // // TestViewController1.m // HYBHelperKit // // Created by huangyibiao on 16/7/9. // Copyright © 2016年 huangyibiao. All rights reserved. // #import "TestViewController1.h" @implementation TestViewController1 - (void)viewDidLoad { [super viewDidLoad]; // [self hyb_setNavTitle:@"测试1"]; // [self hyb_setNavTitle:@"Test2" rightTitle:@"Right button" rightBlock:^(UIButton *sender) { // NSLog(@"clicked"); // }]; // [self.hyb_rightButtonItem setTitleColor:kBlueColor forState:UIControlStateNormal]; // 非系统返回按钮 kWeakObject(self); [self hyb_setNavLeftButtonTitle:@"Back" onCliked:^(UIButton *sender) { [weakObject.navigationController popViewControllerAnimated:YES]; }]; [self.hyb_leftButtonItem setTitleColor:kBlueColor forState:UIControlStateNormal]; // 一行搞定导航条 [self hyb_setNavTitle:@"Test1" rightTitles:@[@"btton1", @"button2"] rightBlock:^(NSUInteger index, UIButton *sender) { NSLog(@"clicked at index: %ld", index); }]; [self.hyb_rightButtonItems enumerateObjectsUsingBlock:^(UIButton * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { [obj setTitleColor:kPurpleColor forState:UIControlStateNormal]; }]; } @end ================================================ FILE: HYBHelperKit/ViewController.h ================================================ // // ViewController.h // HYBHelperKit // // Created by huangyibiao on 16/6/29. // Copyright © 2016年 huangyibiao. All rights reserved. // #import @interface ViewController : UIViewController @end ================================================ FILE: HYBHelperKit/ViewController.m ================================================ // // ViewController.m // HYBHelperKit // // Created by huangyibiao on 16/6/29. // Copyright © 2016年 huangyibiao. All rights reserved. // #import "ViewController.h" #import "HYBHelperKit.h" #import "TestViewController1.h" @interface ViewController () @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; self.view.backgroundColor = kWhiteColor; UIButton *button = [UIButton hyb_buttonWithTitle:@"enter to test" superView:self.view constraints:^(MASConstraintMaker *make) { make.left.mas_offset(20); make.right.mas_offset(-20); make.height.mas_offset(50); make.top.mas_offset(80); } touchUp:^(UIButton *sender) { [self onEnterToTestCenter:sender]; }]; [button setBackgroundColor:kOrangeColor]; [button setTitleColor:kWhiteColor forState:UIControlStateNormal]; } - (IBAction)onEnterToTestCenter:(id)sender { HYBHelperKitTestEntranceController *vc = [[HYBHelperKitTestEntranceController alloc] initWithItems:^NSArray *{ return @[[HYBHelperKitTestEntranceModel modelWithClass:[TestViewController1 class] title:@"Test1"], [HYBHelperKitTestEntranceModel modelWithClass:[UIViewController class] title:@"Test2"] ]; }]; [self.navigationController pushViewController:vc animated:YES]; } @end ================================================ FILE: HYBHelperKit/main.m ================================================ // // main.m // HYBHelperKit // // Created by huangyibiao on 16/6/29. // Copyright © 2016年 huangyibiao. All rights reserved. // #import #import "AppDelegate.h" int main(int argc, char * argv[]) { @autoreleasepool { return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); } } ================================================ FILE: HYBHelperKit.podspec ================================================ Pod::Spec.new do |s| s.name = "HYBHelperKit" s.version = "0.2.0" s.summary = "日常开发必不可少的神器之一,UIBlockKit、UIMakerKit、UIHelperKit、CommonKit、FoundationKit、Controllers、Constants等集于一身的神器!" s.description = <<-DESC 日常开发必不可少的神器之一,UIBlockKit、UIMakerKit、UIHelperKit、CommonKit、FoundationKit、Controllers等集于一身的神器,简化日常开发,提高开发效率! DESC s.homepage = "https://github.com/CoderJackyHuang/HYBHelperKit" s.license = "MIT" s.author = { "huangyibiao" => "huangyibiao@163.com" } s.social_media_url = "http://www.huangyibiao.com/" s.platform = :ios, "7.0" s.source = { :git => "https://github.com/CoderJackyHuang/HYBHelperKit.git", :tag => "v#{s.version}" } s.source_files = "HYBHelperKitSources/*" #s.public_header_files = 'HYBHelperKitSources/HYBHelperKit.h' s.requires_arc = true s.dependency "Masonry", "~> 1.0.1" end ================================================ FILE: HYBHelperKit.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 5EE55DF079058957C1D7C04F /* libPods-HYBHelperKit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2B9F4AC97535142014D9B17F /* libPods-HYBHelperKit.a */; }; 6920F68B1D320E9600D89D07 /* TestViewController1.m in Sources */ = {isa = PBXBuildFile; fileRef = 6920F68A1D320E9600D89D07 /* TestViewController1.m */; }; 6920F84A1D3351DB00D89D07 /* HYBCommonKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 6920F80C1D3351DB00D89D07 /* HYBCommonKit.m */; }; 6920F84B1D3351DB00D89D07 /* HYBHelperKitBaseController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6920F8101D3351DB00D89D07 /* HYBHelperKitBaseController.m */; }; 6920F84C1D3351DB00D89D07 /* HYBHelperKitBaseURLController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6920F8121D3351DB00D89D07 /* HYBHelperKitBaseURLController.m */; }; 6920F84D1D3351DB00D89D07 /* HYBHelperKitTestEntranceController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6920F8141D3351DB00D89D07 /* HYBHelperKitTestEntranceController.m */; }; 6920F84E1D3351DB00D89D07 /* NSArray+HYBHelperKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 6920F8171D3351DB00D89D07 /* NSArray+HYBHelperKit.m */; }; 6920F84F1D3351DB00D89D07 /* NSDictionary+HYBHelperKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 6920F8191D3351DB00D89D07 /* NSDictionary+HYBHelperKit.m */; }; 6920F8501D3351DB00D89D07 /* NSFileManager+HYBHelperKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 6920F81B1D3351DB00D89D07 /* NSFileManager+HYBHelperKit.m */; }; 6920F8511D3351DB00D89D07 /* NSMutableArray+HYBHelperKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 6920F81D1D3351DB00D89D07 /* NSMutableArray+HYBHelperKit.m */; }; 6920F8521D3351DB00D89D07 /* NSMutableDictionary+HYBHelperKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 6920F81F1D3351DB00D89D07 /* NSMutableDictionary+HYBHelperKit.m */; }; 6920F8531D3351DB00D89D07 /* NSObject+HYBHelperKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 6920F8211D3351DB00D89D07 /* NSObject+HYBHelperKit.m */; }; 6920F8541D3351DB00D89D07 /* NSString+HYBHelperKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 6920F8231D3351DB00D89D07 /* NSString+HYBHelperKit.m */; }; 6920F8551D3351DB00D89D07 /* NSTimer+HYBHelperKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 6920F8251D3351DB00D89D07 /* NSTimer+HYBHelperKit.m */; }; 6920F8561D3351DB00D89D07 /* NSUserDefaults+HYBHelperKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 6920F8271D3351DB00D89D07 /* NSUserDefaults+HYBHelperKit.m */; }; 6920F85B1D3351DB00D89D07 /* UICollectionView+HYBMaonsryKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 6920F8331D3351DB00D89D07 /* UICollectionView+HYBMaonsryKit.m */; }; 6920F85C1D3351DB00D89D07 /* UIImageView+HYBMasonryKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 6920F8351D3351DB00D89D07 /* UIImageView+HYBMasonryKit.m */; }; 6920F8601D3351DB00D89D07 /* UILabel+HYBMasonryKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 6920F83F1D3351DB00D89D07 /* UILabel+HYBMasonryKit.m */; }; 6920F8611D3351DB00D89D07 /* UIScrollView+HYBMasonryKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 6920F8411D3351DB00D89D07 /* UIScrollView+HYBMasonryKit.m */; }; 6920F8621D3351DB00D89D07 /* UITableView+HYBMasonryKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 6920F8431D3351DB00D89D07 /* UITableView+HYBMasonryKit.m */; }; 6920F8631D3351DB00D89D07 /* UITextField+HYBMasonryKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 6920F8451D3351DB00D89D07 /* UITextField+HYBMasonryKit.m */; }; 6920F8641D3351DB00D89D07 /* UIView+HYBMasonryKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 6920F8471D3351DB00D89D07 /* UIView+HYBMasonryKit.m */; }; 6920F8651D3351DB00D89D07 /* UIWebView+HYBMasonryKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 6920F8491D3351DB00D89D07 /* UIWebView+HYBMasonryKit.m */; }; 6920F8711D33522F00D89D07 /* UIButton+HYBHelperBlockKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 6920F86A1D33522F00D89D07 /* UIButton+HYBHelperBlockKit.m */; }; 6920F8721D33522F00D89D07 /* UIControl+HYBHelperBlockKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 6920F86C1D33522F00D89D07 /* UIControl+HYBHelperBlockKit.m */; }; 6920F8731D33522F00D89D07 /* UIGestureRecognizer+HYBHelperBlockKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 6920F86E1D33522F00D89D07 /* UIGestureRecognizer+HYBHelperBlockKit.m */; }; 6920F8741D33522F00D89D07 /* UIView+HYBHelperBlockKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 6920F8701D33522F00D89D07 /* UIView+HYBHelperBlockKit.m */; }; 6920F87C1D33526B00D89D07 /* UIColor+HYBHelperKitUIKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 6920F8771D33526B00D89D07 /* UIColor+HYBHelperKitUIKit.m */; }; 6920F87D1D33526B00D89D07 /* UIDevice+HYBHelperKitUIKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 6920F8791D33526B00D89D07 /* UIDevice+HYBHelperKitUIKit.m */; }; 6920F87E1D33526B00D89D07 /* UIView+HYBHelperKitUIKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 6920F87B1D33526B00D89D07 /* UIView+HYBHelperKitUIKit.m */; }; 6920F8841D339D3D00D89D07 /* NSDate+HYBHelperKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 6920F8831D339D3D00D89D07 /* NSDate+HYBHelperKit.m */; }; 6932F8D11D24D12600F2D2F0 /* DictionaryTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6932F8D01D24D12600F2D2F0 /* DictionaryTests.m */; }; 69489E851D23790E00F90205 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 69489E841D23790E00F90205 /* main.m */; }; 69489E881D23790E00F90205 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 69489E871D23790E00F90205 /* AppDelegate.m */; }; 69489E8B1D23790E00F90205 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 69489E8A1D23790E00F90205 /* ViewController.m */; }; 69489E901D23790E00F90205 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 69489E8F1D23790E00F90205 /* Assets.xcassets */; }; 69489E931D23790E00F90205 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 69489E911D23790E00F90205 /* LaunchScreen.storyboard */; }; 69489E9E1D23790E00F90205 /* HYBHelperKitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 69489E9D1D23790E00F90205 /* HYBHelperKitTests.m */; }; 69489EC91D23BCDC00F90205 /* NSTimerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 69489EC71D23BCDC00F90205 /* NSTimerTests.m */; }; 69489ECC1D23BEEF00F90205 /* NSUserDefaultsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 69489ECA1D23BEEF00F90205 /* NSUserDefaultsTests.m */; }; 69489ED11D23C11200F90205 /* NSStringTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 69489ED01D23C11200F90205 /* NSStringTests.m */; }; 695029101D366C2800773B69 /* NSNumber+HYBHelperKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 6950290F1D366C2800773B69 /* NSNumber+HYBHelperKit.m */; }; 6950297C1D3929B800773B69 /* UIAlertView+HYBHelperKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 6950297B1D3929B800773B69 /* UIAlertView+HYBHelperKit.m */; }; 6950297F1D39332B00773B69 /* UIActionSheet+HYBHelperKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 6950297E1D39332B00773B69 /* UIActionSheet+HYBHelperKit.m */; }; 69C383191D23C7FB00176B00 /* NSObjectTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 69C383181D23C7FB00176B00 /* NSObjectTests.m */; }; 69C383291D23DA4100176B00 /* ArrayTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 69C383271D23DA4100176B00 /* ArrayTests.m */; }; DC82BC5B03DBD5DC59B883D8 /* libPods-HYBHelperKitTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 880E538D3E79C9676BE1490E /* libPods-HYBHelperKitTests.a */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ 69489E9A1D23790E00F90205 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 69489E781D23790E00F90205 /* Project object */; proxyType = 1; remoteGlobalIDString = 69489E7F1D23790E00F90205; remoteInfo = HYBHelperKit; }; /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ 27E98AAFD6B6C8A744E7B36C /* Pods-HYBHelperKitTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HYBHelperKitTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-HYBHelperKitTests/Pods-HYBHelperKitTests.debug.xcconfig"; sourceTree = ""; }; 2B9F4AC97535142014D9B17F /* libPods-HYBHelperKit.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-HYBHelperKit.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 3D2427DF68D165E6D41371A3 /* Pods-HYBHelperKit.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HYBHelperKit.release.xcconfig"; path = "Pods/Target Support Files/Pods-HYBHelperKit/Pods-HYBHelperKit.release.xcconfig"; sourceTree = ""; }; 3E988714FC5DCCC6FE572EC4 /* Pods-HYBHelperKit.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HYBHelperKit.debug.xcconfig"; path = "Pods/Target Support Files/Pods-HYBHelperKit/Pods-HYBHelperKit.debug.xcconfig"; sourceTree = ""; }; 6920F6891D320E9600D89D07 /* TestViewController1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestViewController1.h; sourceTree = ""; }; 6920F68A1D320E9600D89D07 /* TestViewController1.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TestViewController1.m; sourceTree = ""; }; 6920F80B1D3351DB00D89D07 /* HYBCommonKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HYBCommonKit.h; sourceTree = ""; }; 6920F80C1D3351DB00D89D07 /* HYBCommonKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HYBCommonKit.m; sourceTree = ""; }; 6920F80E1D3351DB00D89D07 /* HYBHelperKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HYBHelperKit.h; sourceTree = ""; }; 6920F80F1D3351DB00D89D07 /* HYBHelperKitBaseController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HYBHelperKitBaseController.h; sourceTree = ""; }; 6920F8101D3351DB00D89D07 /* HYBHelperKitBaseController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HYBHelperKitBaseController.m; sourceTree = ""; }; 6920F8111D3351DB00D89D07 /* HYBHelperKitBaseURLController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HYBHelperKitBaseURLController.h; sourceTree = ""; }; 6920F8121D3351DB00D89D07 /* HYBHelperKitBaseURLController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HYBHelperKitBaseURLController.m; sourceTree = ""; }; 6920F8131D3351DB00D89D07 /* HYBHelperKitTestEntranceController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HYBHelperKitTestEntranceController.h; sourceTree = ""; }; 6920F8141D3351DB00D89D07 /* HYBHelperKitTestEntranceController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HYBHelperKitTestEntranceController.m; sourceTree = ""; }; 6920F8151D3351DB00D89D07 /* HYBHelperMasonryMaker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HYBHelperMasonryMaker.h; sourceTree = ""; }; 6920F8161D3351DB00D89D07 /* NSArray+HYBHelperKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSArray+HYBHelperKit.h"; sourceTree = ""; }; 6920F8171D3351DB00D89D07 /* NSArray+HYBHelperKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSArray+HYBHelperKit.m"; sourceTree = ""; }; 6920F8181D3351DB00D89D07 /* NSDictionary+HYBHelperKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDictionary+HYBHelperKit.h"; sourceTree = ""; }; 6920F8191D3351DB00D89D07 /* NSDictionary+HYBHelperKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDictionary+HYBHelperKit.m"; sourceTree = ""; }; 6920F81A1D3351DB00D89D07 /* NSFileManager+HYBHelperKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSFileManager+HYBHelperKit.h"; sourceTree = ""; }; 6920F81B1D3351DB00D89D07 /* NSFileManager+HYBHelperKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSFileManager+HYBHelperKit.m"; sourceTree = ""; }; 6920F81C1D3351DB00D89D07 /* NSMutableArray+HYBHelperKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMutableArray+HYBHelperKit.h"; sourceTree = ""; }; 6920F81D1D3351DB00D89D07 /* NSMutableArray+HYBHelperKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSMutableArray+HYBHelperKit.m"; sourceTree = ""; }; 6920F81E1D3351DB00D89D07 /* NSMutableDictionary+HYBHelperKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMutableDictionary+HYBHelperKit.h"; sourceTree = ""; }; 6920F81F1D3351DB00D89D07 /* NSMutableDictionary+HYBHelperKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSMutableDictionary+HYBHelperKit.m"; sourceTree = ""; }; 6920F8201D3351DB00D89D07 /* NSObject+HYBHelperKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+HYBHelperKit.h"; sourceTree = ""; }; 6920F8211D3351DB00D89D07 /* NSObject+HYBHelperKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+HYBHelperKit.m"; sourceTree = ""; }; 6920F8221D3351DB00D89D07 /* NSString+HYBHelperKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+HYBHelperKit.h"; sourceTree = ""; }; 6920F8231D3351DB00D89D07 /* NSString+HYBHelperKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+HYBHelperKit.m"; sourceTree = ""; }; 6920F8241D3351DB00D89D07 /* NSTimer+HYBHelperKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSTimer+HYBHelperKit.h"; sourceTree = ""; }; 6920F8251D3351DB00D89D07 /* NSTimer+HYBHelperKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSTimer+HYBHelperKit.m"; sourceTree = ""; }; 6920F8261D3351DB00D89D07 /* NSUserDefaults+HYBHelperKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSUserDefaults+HYBHelperKit.h"; sourceTree = ""; }; 6920F8271D3351DB00D89D07 /* NSUserDefaults+HYBHelperKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSUserDefaults+HYBHelperKit.m"; sourceTree = ""; }; 6920F8321D3351DB00D89D07 /* UICollectionView+HYBMaonsryKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UICollectionView+HYBMaonsryKit.h"; sourceTree = ""; }; 6920F8331D3351DB00D89D07 /* UICollectionView+HYBMaonsryKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UICollectionView+HYBMaonsryKit.m"; sourceTree = ""; }; 6920F8341D3351DB00D89D07 /* UIImageView+HYBMasonryKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImageView+HYBMasonryKit.h"; sourceTree = ""; }; 6920F8351D3351DB00D89D07 /* UIImageView+HYBMasonryKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImageView+HYBMasonryKit.m"; sourceTree = ""; }; 6920F83E1D3351DB00D89D07 /* UILabel+HYBMasonryKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UILabel+HYBMasonryKit.h"; sourceTree = ""; }; 6920F83F1D3351DB00D89D07 /* UILabel+HYBMasonryKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UILabel+HYBMasonryKit.m"; sourceTree = ""; }; 6920F8401D3351DB00D89D07 /* UIScrollView+HYBMasonryKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIScrollView+HYBMasonryKit.h"; sourceTree = ""; }; 6920F8411D3351DB00D89D07 /* UIScrollView+HYBMasonryKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIScrollView+HYBMasonryKit.m"; sourceTree = ""; }; 6920F8421D3351DB00D89D07 /* UITableView+HYBMasonryKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UITableView+HYBMasonryKit.h"; sourceTree = ""; }; 6920F8431D3351DB00D89D07 /* UITableView+HYBMasonryKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UITableView+HYBMasonryKit.m"; sourceTree = ""; }; 6920F8441D3351DB00D89D07 /* UITextField+HYBMasonryKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UITextField+HYBMasonryKit.h"; sourceTree = ""; }; 6920F8451D3351DB00D89D07 /* UITextField+HYBMasonryKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UITextField+HYBMasonryKit.m"; sourceTree = ""; }; 6920F8461D3351DB00D89D07 /* UIView+HYBMasonryKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+HYBMasonryKit.h"; sourceTree = ""; }; 6920F8471D3351DB00D89D07 /* UIView+HYBMasonryKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+HYBMasonryKit.m"; sourceTree = ""; }; 6920F8481D3351DB00D89D07 /* UIWebView+HYBMasonryKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIWebView+HYBMasonryKit.h"; sourceTree = ""; }; 6920F8491D3351DB00D89D07 /* UIWebView+HYBMasonryKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIWebView+HYBMasonryKit.m"; sourceTree = ""; }; 6920F8691D33522F00D89D07 /* UIButton+HYBHelperBlockKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIButton+HYBHelperBlockKit.h"; path = "HYBHelperKitSources/UIButton+HYBHelperBlockKit.h"; sourceTree = SOURCE_ROOT; }; 6920F86A1D33522F00D89D07 /* UIButton+HYBHelperBlockKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIButton+HYBHelperBlockKit.m"; path = "HYBHelperKitSources/UIButton+HYBHelperBlockKit.m"; sourceTree = SOURCE_ROOT; }; 6920F86B1D33522F00D89D07 /* UIControl+HYBHelperBlockKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIControl+HYBHelperBlockKit.h"; path = "HYBHelperKitSources/UIControl+HYBHelperBlockKit.h"; sourceTree = SOURCE_ROOT; }; 6920F86C1D33522F00D89D07 /* UIControl+HYBHelperBlockKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIControl+HYBHelperBlockKit.m"; path = "HYBHelperKitSources/UIControl+HYBHelperBlockKit.m"; sourceTree = SOURCE_ROOT; }; 6920F86D1D33522F00D89D07 /* UIGestureRecognizer+HYBHelperBlockKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIGestureRecognizer+HYBHelperBlockKit.h"; path = "HYBHelperKitSources/UIGestureRecognizer+HYBHelperBlockKit.h"; sourceTree = SOURCE_ROOT; }; 6920F86E1D33522F00D89D07 /* UIGestureRecognizer+HYBHelperBlockKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIGestureRecognizer+HYBHelperBlockKit.m"; path = "HYBHelperKitSources/UIGestureRecognizer+HYBHelperBlockKit.m"; sourceTree = SOURCE_ROOT; }; 6920F86F1D33522F00D89D07 /* UIView+HYBHelperBlockKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIView+HYBHelperBlockKit.h"; path = "HYBHelperKitSources/UIView+HYBHelperBlockKit.h"; sourceTree = SOURCE_ROOT; }; 6920F8701D33522F00D89D07 /* UIView+HYBHelperBlockKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIView+HYBHelperBlockKit.m"; path = "HYBHelperKitSources/UIView+HYBHelperBlockKit.m"; sourceTree = SOURCE_ROOT; }; 6920F8761D33526B00D89D07 /* UIColor+HYBHelperKitUIKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIColor+HYBHelperKitUIKit.h"; path = "HYBHelperKitSources/UIColor+HYBHelperKitUIKit.h"; sourceTree = SOURCE_ROOT; }; 6920F8771D33526B00D89D07 /* UIColor+HYBHelperKitUIKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIColor+HYBHelperKitUIKit.m"; path = "HYBHelperKitSources/UIColor+HYBHelperKitUIKit.m"; sourceTree = SOURCE_ROOT; }; 6920F8781D33526B00D89D07 /* UIDevice+HYBHelperKitUIKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIDevice+HYBHelperKitUIKit.h"; path = "HYBHelperKitSources/UIDevice+HYBHelperKitUIKit.h"; sourceTree = SOURCE_ROOT; }; 6920F8791D33526B00D89D07 /* UIDevice+HYBHelperKitUIKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIDevice+HYBHelperKitUIKit.m"; path = "HYBHelperKitSources/UIDevice+HYBHelperKitUIKit.m"; sourceTree = SOURCE_ROOT; }; 6920F87A1D33526B00D89D07 /* UIView+HYBHelperKitUIKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIView+HYBHelperKitUIKit.h"; path = "HYBHelperKitSources/UIView+HYBHelperKitUIKit.h"; sourceTree = SOURCE_ROOT; }; 6920F87B1D33526B00D89D07 /* UIView+HYBHelperKitUIKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIView+HYBHelperKitUIKit.m"; path = "HYBHelperKitSources/UIView+HYBHelperKitUIKit.m"; sourceTree = SOURCE_ROOT; }; 6920F8801D3352B200D89D07 /* HYBHelperBlocksKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HYBHelperBlocksKit.h; path = HYBHelperKitSources/HYBHelperBlocksKit.h; sourceTree = SOURCE_ROOT; }; 6920F8811D3352B200D89D07 /* HYBHelperUIKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HYBHelperUIKit.h; path = HYBHelperKitSources/HYBHelperUIKit.h; sourceTree = SOURCE_ROOT; }; 6920F8821D339D3D00D89D07 /* NSDate+HYBHelperKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDate+HYBHelperKit.h"; sourceTree = ""; }; 6920F8831D339D3D00D89D07 /* NSDate+HYBHelperKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDate+HYBHelperKit.m"; sourceTree = ""; }; 6932F8D01D24D12600F2D2F0 /* DictionaryTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DictionaryTests.m; sourceTree = ""; }; 69489E801D23790E00F90205 /* HYBHelperKit.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HYBHelperKit.app; sourceTree = BUILT_PRODUCTS_DIR; }; 69489E841D23790E00F90205 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 69489E861D23790E00F90205 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 69489E871D23790E00F90205 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 69489E891D23790E00F90205 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 69489E8A1D23790E00F90205 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 69489E8F1D23790E00F90205 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 69489E921D23790E00F90205 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 69489E941D23790E00F90205 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 69489E991D23790E00F90205 /* HYBHelperKitTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = HYBHelperKitTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 69489E9D1D23790E00F90205 /* HYBHelperKitTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HYBHelperKitTests.m; sourceTree = ""; }; 69489E9F1D23790E00F90205 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 69489EC71D23BCDC00F90205 /* NSTimerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSTimerTests.m; sourceTree = ""; }; 69489ECA1D23BEEF00F90205 /* NSUserDefaultsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSUserDefaultsTests.m; sourceTree = ""; }; 69489ED01D23C11200F90205 /* NSStringTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSStringTests.m; sourceTree = ""; }; 6950290E1D366C2800773B69 /* NSNumber+HYBHelperKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSNumber+HYBHelperKit.h"; sourceTree = ""; }; 6950290F1D366C2800773B69 /* NSNumber+HYBHelperKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSNumber+HYBHelperKit.m"; sourceTree = ""; }; 6950297A1D3929B800773B69 /* UIAlertView+HYBHelperKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIAlertView+HYBHelperKit.h"; path = "HYBHelperKitSources/UIAlertView+HYBHelperKit.h"; sourceTree = SOURCE_ROOT; }; 6950297B1D3929B800773B69 /* UIAlertView+HYBHelperKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIAlertView+HYBHelperKit.m"; path = "HYBHelperKitSources/UIAlertView+HYBHelperKit.m"; sourceTree = SOURCE_ROOT; }; 6950297D1D39332B00773B69 /* UIActionSheet+HYBHelperKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIActionSheet+HYBHelperKit.h"; path = "HYBHelperKitSources/UIActionSheet+HYBHelperKit.h"; sourceTree = SOURCE_ROOT; }; 6950297E1D39332B00773B69 /* UIActionSheet+HYBHelperKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIActionSheet+HYBHelperKit.m"; path = "HYBHelperKitSources/UIActionSheet+HYBHelperKit.m"; sourceTree = SOURCE_ROOT; }; 69C383181D23C7FB00176B00 /* NSObjectTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSObjectTests.m; sourceTree = ""; }; 69C383271D23DA4100176B00 /* ArrayTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ArrayTests.m; sourceTree = ""; }; 880E538D3E79C9676BE1490E /* libPods-HYBHelperKitTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-HYBHelperKitTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; D4190D82170077172A8B3795 /* Pods-HYBHelperKitTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HYBHelperKitTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-HYBHelperKitTests/Pods-HYBHelperKitTests.release.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 69489E7D1D23790E00F90205 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 5EE55DF079058957C1D7C04F /* libPods-HYBHelperKit.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; 69489E961D23790E00F90205 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( DC82BC5B03DBD5DC59B883D8 /* libPods-HYBHelperKitTests.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 6920F80A1D3351DB00D89D07 /* HYBHelperKitSources */ = { isa = PBXGroup; children = ( 6920F87F1D33527200D89D07 /* UIKit */, 6920F8661D3351E000D89D07 /* CommonKit */, 6920F80E1D3351DB00D89D07 /* HYBHelperKit.h */, 6920F8671D3351EA00D89D07 /* ControllerKit */, 6920F8681D3351F500D89D07 /* FoudationKit */, 6920F8281D3351DB00D89D07 /* UIBlocksKit */, 6920F8751D33523F00D89D07 /* MasonryKit */, ); path = HYBHelperKitSources; sourceTree = SOURCE_ROOT; }; 6920F8281D3351DB00D89D07 /* UIBlocksKit */ = { isa = PBXGroup; children = ( 6920F8801D3352B200D89D07 /* HYBHelperBlocksKit.h */, 6920F8691D33522F00D89D07 /* UIButton+HYBHelperBlockKit.h */, 6920F86A1D33522F00D89D07 /* UIButton+HYBHelperBlockKit.m */, 6920F86B1D33522F00D89D07 /* UIControl+HYBHelperBlockKit.h */, 6920F86C1D33522F00D89D07 /* UIControl+HYBHelperBlockKit.m */, 6920F86D1D33522F00D89D07 /* UIGestureRecognizer+HYBHelperBlockKit.h */, 6920F86E1D33522F00D89D07 /* UIGestureRecognizer+HYBHelperBlockKit.m */, 6920F86F1D33522F00D89D07 /* UIView+HYBHelperBlockKit.h */, 6920F8701D33522F00D89D07 /* UIView+HYBHelperBlockKit.m */, ); path = UIBlocksKit; sourceTree = ""; }; 6920F8661D3351E000D89D07 /* CommonKit */ = { isa = PBXGroup; children = ( 6920F80B1D3351DB00D89D07 /* HYBCommonKit.h */, 6920F80C1D3351DB00D89D07 /* HYBCommonKit.m */, ); name = CommonKit; sourceTree = ""; }; 6920F8671D3351EA00D89D07 /* ControllerKit */ = { isa = PBXGroup; children = ( 6920F80F1D3351DB00D89D07 /* HYBHelperKitBaseController.h */, 6920F8101D3351DB00D89D07 /* HYBHelperKitBaseController.m */, 6920F8111D3351DB00D89D07 /* HYBHelperKitBaseURLController.h */, 6920F8121D3351DB00D89D07 /* HYBHelperKitBaseURLController.m */, 6920F8131D3351DB00D89D07 /* HYBHelperKitTestEntranceController.h */, 6920F8141D3351DB00D89D07 /* HYBHelperKitTestEntranceController.m */, ); name = ControllerKit; sourceTree = ""; }; 6920F8681D3351F500D89D07 /* FoudationKit */ = { isa = PBXGroup; children = ( 6920F8161D3351DB00D89D07 /* NSArray+HYBHelperKit.h */, 6920F8171D3351DB00D89D07 /* NSArray+HYBHelperKit.m */, 6920F8181D3351DB00D89D07 /* NSDictionary+HYBHelperKit.h */, 6920F8191D3351DB00D89D07 /* NSDictionary+HYBHelperKit.m */, 6920F81A1D3351DB00D89D07 /* NSFileManager+HYBHelperKit.h */, 6920F81B1D3351DB00D89D07 /* NSFileManager+HYBHelperKit.m */, 6920F81C1D3351DB00D89D07 /* NSMutableArray+HYBHelperKit.h */, 6920F81D1D3351DB00D89D07 /* NSMutableArray+HYBHelperKit.m */, 6920F81E1D3351DB00D89D07 /* NSMutableDictionary+HYBHelperKit.h */, 6920F81F1D3351DB00D89D07 /* NSMutableDictionary+HYBHelperKit.m */, 6920F8201D3351DB00D89D07 /* NSObject+HYBHelperKit.h */, 6920F8211D3351DB00D89D07 /* NSObject+HYBHelperKit.m */, 6920F8221D3351DB00D89D07 /* NSString+HYBHelperKit.h */, 6920F8231D3351DB00D89D07 /* NSString+HYBHelperKit.m */, 6920F8241D3351DB00D89D07 /* NSTimer+HYBHelperKit.h */, 6920F8251D3351DB00D89D07 /* NSTimer+HYBHelperKit.m */, 6920F8261D3351DB00D89D07 /* NSUserDefaults+HYBHelperKit.h */, 6920F8271D3351DB00D89D07 /* NSUserDefaults+HYBHelperKit.m */, 6920F8821D339D3D00D89D07 /* NSDate+HYBHelperKit.h */, 6920F8831D339D3D00D89D07 /* NSDate+HYBHelperKit.m */, 6950290E1D366C2800773B69 /* NSNumber+HYBHelperKit.h */, 6950290F1D366C2800773B69 /* NSNumber+HYBHelperKit.m */, ); name = FoudationKit; sourceTree = ""; }; 6920F8751D33523F00D89D07 /* MasonryKit */ = { isa = PBXGroup; children = ( 6920F83E1D3351DB00D89D07 /* UILabel+HYBMasonryKit.h */, 6920F83F1D3351DB00D89D07 /* UILabel+HYBMasonryKit.m */, 6920F8151D3351DB00D89D07 /* HYBHelperMasonryMaker.h */, 6920F8321D3351DB00D89D07 /* UICollectionView+HYBMaonsryKit.h */, 6920F8331D3351DB00D89D07 /* UICollectionView+HYBMaonsryKit.m */, 6920F8341D3351DB00D89D07 /* UIImageView+HYBMasonryKit.h */, 6920F8351D3351DB00D89D07 /* UIImageView+HYBMasonryKit.m */, 6920F8401D3351DB00D89D07 /* UIScrollView+HYBMasonryKit.h */, 6920F8411D3351DB00D89D07 /* UIScrollView+HYBMasonryKit.m */, 6920F8421D3351DB00D89D07 /* UITableView+HYBMasonryKit.h */, 6920F8431D3351DB00D89D07 /* UITableView+HYBMasonryKit.m */, 6920F8441D3351DB00D89D07 /* UITextField+HYBMasonryKit.h */, 6920F8451D3351DB00D89D07 /* UITextField+HYBMasonryKit.m */, 6920F8461D3351DB00D89D07 /* UIView+HYBMasonryKit.h */, 6920F8471D3351DB00D89D07 /* UIView+HYBMasonryKit.m */, 6920F8481D3351DB00D89D07 /* UIWebView+HYBMasonryKit.h */, 6920F8491D3351DB00D89D07 /* UIWebView+HYBMasonryKit.m */, ); name = MasonryKit; sourceTree = ""; }; 6920F87F1D33527200D89D07 /* UIKit */ = { isa = PBXGroup; children = ( 6920F8811D3352B200D89D07 /* HYBHelperUIKit.h */, 6920F8761D33526B00D89D07 /* UIColor+HYBHelperKitUIKit.h */, 6920F8771D33526B00D89D07 /* UIColor+HYBHelperKitUIKit.m */, 6920F8781D33526B00D89D07 /* UIDevice+HYBHelperKitUIKit.h */, 6920F8791D33526B00D89D07 /* UIDevice+HYBHelperKitUIKit.m */, 6920F87A1D33526B00D89D07 /* UIView+HYBHelperKitUIKit.h */, 6920F87B1D33526B00D89D07 /* UIView+HYBHelperKitUIKit.m */, 6950297A1D3929B800773B69 /* UIAlertView+HYBHelperKit.h */, 6950297B1D3929B800773B69 /* UIAlertView+HYBHelperKit.m */, 6950297D1D39332B00773B69 /* UIActionSheet+HYBHelperKit.h */, 6950297E1D39332B00773B69 /* UIActionSheet+HYBHelperKit.m */, ); name = UIKit; path = UIBlocksKit; sourceTree = ""; }; 69489E771D23790E00F90205 = { isa = PBXGroup; children = ( 69489E821D23790E00F90205 /* HYBHelperKit */, 69489E9C1D23790E00F90205 /* HYBHelperKitTests */, 69489E811D23790E00F90205 /* Products */, A0654A6FA263E139658F66F9 /* Pods */, EABF94265F022B8CD7ECFEC0 /* Frameworks */, ); sourceTree = ""; }; 69489E811D23790E00F90205 /* Products */ = { isa = PBXGroup; children = ( 69489E801D23790E00F90205 /* HYBHelperKit.app */, 69489E991D23790E00F90205 /* HYBHelperKitTests.xctest */, ); name = Products; sourceTree = ""; }; 69489E821D23790E00F90205 /* HYBHelperKit */ = { isa = PBXGroup; children = ( 6920F80A1D3351DB00D89D07 /* HYBHelperKitSources */, 6920F6891D320E9600D89D07 /* TestViewController1.h */, 6920F68A1D320E9600D89D07 /* TestViewController1.m */, 69489E861D23790E00F90205 /* AppDelegate.h */, 69489E871D23790E00F90205 /* AppDelegate.m */, 69489E891D23790E00F90205 /* ViewController.h */, 69489E8A1D23790E00F90205 /* ViewController.m */, 69489E8F1D23790E00F90205 /* Assets.xcassets */, 69489E911D23790E00F90205 /* LaunchScreen.storyboard */, 69489E941D23790E00F90205 /* Info.plist */, 69489E831D23790E00F90205 /* Supporting Files */, ); path = HYBHelperKit; sourceTree = ""; }; 69489E831D23790E00F90205 /* Supporting Files */ = { isa = PBXGroup; children = ( 69489E841D23790E00F90205 /* main.m */, ); name = "Supporting Files"; sourceTree = ""; }; 69489E9C1D23790E00F90205 /* HYBHelperKitTests */ = { isa = PBXGroup; children = ( 69489EC11D23BB9A00F90205 /* FoundationKitTests */, 69489E9D1D23790E00F90205 /* HYBHelperKitTests.m */, 69489E9F1D23790E00F90205 /* Info.plist */, ); path = HYBHelperKitTests; sourceTree = ""; }; 69489EC11D23BB9A00F90205 /* FoundationKitTests */ = { isa = PBXGroup; children = ( 69489EC71D23BCDC00F90205 /* NSTimerTests.m */, 69489ECA1D23BEEF00F90205 /* NSUserDefaultsTests.m */, 69489ED01D23C11200F90205 /* NSStringTests.m */, 69C383181D23C7FB00176B00 /* NSObjectTests.m */, 69C383271D23DA4100176B00 /* ArrayTests.m */, 6932F8D01D24D12600F2D2F0 /* DictionaryTests.m */, ); name = FoundationKitTests; sourceTree = ""; }; A0654A6FA263E139658F66F9 /* Pods */ = { isa = PBXGroup; children = ( 3E988714FC5DCCC6FE572EC4 /* Pods-HYBHelperKit.debug.xcconfig */, 3D2427DF68D165E6D41371A3 /* Pods-HYBHelperKit.release.xcconfig */, 27E98AAFD6B6C8A744E7B36C /* Pods-HYBHelperKitTests.debug.xcconfig */, D4190D82170077172A8B3795 /* Pods-HYBHelperKitTests.release.xcconfig */, ); name = Pods; sourceTree = ""; }; EABF94265F022B8CD7ECFEC0 /* Frameworks */ = { isa = PBXGroup; children = ( 2B9F4AC97535142014D9B17F /* libPods-HYBHelperKit.a */, 880E538D3E79C9676BE1490E /* libPods-HYBHelperKitTests.a */, ); name = Frameworks; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 69489E7F1D23790E00F90205 /* HYBHelperKit */ = { isa = PBXNativeTarget; buildConfigurationList = 69489EA21D23790E00F90205 /* Build configuration list for PBXNativeTarget "HYBHelperKit" */; buildPhases = ( 44B2C4371B8E5D8CEAC74A1D /* 📦 Check Pods Manifest.lock */, 69489E7C1D23790E00F90205 /* Sources */, 69489E7D1D23790E00F90205 /* Frameworks */, 69489E7E1D23790E00F90205 /* Resources */, 1EFDCD21E8E8ECA0267B1586 /* 📦 Embed Pods Frameworks */, 81534C734CCEF3F4035504D7 /* 📦 Copy Pods Resources */, ); buildRules = ( ); dependencies = ( ); name = HYBHelperKit; productName = HYBHelperKit; productReference = 69489E801D23790E00F90205 /* HYBHelperKit.app */; productType = "com.apple.product-type.application"; }; 69489E981D23790E00F90205 /* HYBHelperKitTests */ = { isa = PBXNativeTarget; buildConfigurationList = 69489EA51D23790E00F90205 /* Build configuration list for PBXNativeTarget "HYBHelperKitTests" */; buildPhases = ( D6C81BFCA53864F8884FFE81 /* 📦 Check Pods Manifest.lock */, 69489E951D23790E00F90205 /* Sources */, 69489E961D23790E00F90205 /* Frameworks */, 69489E971D23790E00F90205 /* Resources */, 6B8615C290B3105DB77F07FD /* 📦 Embed Pods Frameworks */, 2A2189E2041806595439F32F /* 📦 Copy Pods Resources */, ); buildRules = ( ); dependencies = ( 69489E9B1D23790E00F90205 /* PBXTargetDependency */, ); name = HYBHelperKitTests; productName = HYBHelperKitTests; productReference = 69489E991D23790E00F90205 /* HYBHelperKitTests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 69489E781D23790E00F90205 /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0730; ORGANIZATIONNAME = huangyibiao; TargetAttributes = { 69489E7F1D23790E00F90205 = { CreatedOnToolsVersion = 7.3.1; }; 69489E981D23790E00F90205 = { CreatedOnToolsVersion = 7.3.1; TestTargetID = 69489E7F1D23790E00F90205; }; }; }; buildConfigurationList = 69489E7B1D23790E00F90205 /* Build configuration list for PBXProject "HYBHelperKit" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, Base, ); mainGroup = 69489E771D23790E00F90205; productRefGroup = 69489E811D23790E00F90205 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 69489E7F1D23790E00F90205 /* HYBHelperKit */, 69489E981D23790E00F90205 /* HYBHelperKitTests */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 69489E7E1D23790E00F90205 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 69489E931D23790E00F90205 /* LaunchScreen.storyboard in Resources */, 69489E901D23790E00F90205 /* Assets.xcassets in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; 69489E971D23790E00F90205 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ 1EFDCD21E8E8ECA0267B1586 /* 📦 Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); name = "📦 Embed Pods Frameworks"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-HYBHelperKit/Pods-HYBHelperKit-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; 2A2189E2041806595439F32F /* 📦 Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); name = "📦 Copy Pods Resources"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-HYBHelperKitTests/Pods-HYBHelperKitTests-resources.sh\"\n"; showEnvVarsInLog = 0; }; 44B2C4371B8E5D8CEAC74A1D /* 📦 Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); name = "📦 Check Pods Manifest.lock"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; showEnvVarsInLog = 0; }; 6B8615C290B3105DB77F07FD /* 📦 Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); name = "📦 Embed Pods Frameworks"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-HYBHelperKitTests/Pods-HYBHelperKitTests-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; 81534C734CCEF3F4035504D7 /* 📦 Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); name = "📦 Copy Pods Resources"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-HYBHelperKit/Pods-HYBHelperKit-resources.sh\"\n"; showEnvVarsInLog = 0; }; D6C81BFCA53864F8884FFE81 /* 📦 Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); name = "📦 Check Pods Manifest.lock"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 69489E7C1D23790E00F90205 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 6920F8621D3351DB00D89D07 /* UITableView+HYBMasonryKit.m in Sources */, 6920F8611D3351DB00D89D07 /* UIScrollView+HYBMasonryKit.m in Sources */, 6920F8601D3351DB00D89D07 /* UILabel+HYBMasonryKit.m in Sources */, 6920F8511D3351DB00D89D07 /* NSMutableArray+HYBHelperKit.m in Sources */, 6920F8711D33522F00D89D07 /* UIButton+HYBHelperBlockKit.m in Sources */, 6920F8501D3351DB00D89D07 /* NSFileManager+HYBHelperKit.m in Sources */, 6920F8531D3351DB00D89D07 /* NSObject+HYBHelperKit.m in Sources */, 6920F8631D3351DB00D89D07 /* UITextField+HYBMasonryKit.m in Sources */, 695029101D366C2800773B69 /* NSNumber+HYBHelperKit.m in Sources */, 6920F87D1D33526B00D89D07 /* UIDevice+HYBHelperKitUIKit.m in Sources */, 6920F8841D339D3D00D89D07 /* NSDate+HYBHelperKit.m in Sources */, 69489E8B1D23790E00F90205 /* ViewController.m in Sources */, 6920F8651D3351DB00D89D07 /* UIWebView+HYBMasonryKit.m in Sources */, 6920F85B1D3351DB00D89D07 /* UICollectionView+HYBMaonsryKit.m in Sources */, 6920F8561D3351DB00D89D07 /* NSUserDefaults+HYBHelperKit.m in Sources */, 6920F84C1D3351DB00D89D07 /* HYBHelperKitBaseURLController.m in Sources */, 6920F87E1D33526B00D89D07 /* UIView+HYBHelperKitUIKit.m in Sources */, 6920F8641D3351DB00D89D07 /* UIView+HYBMasonryKit.m in Sources */, 6920F8741D33522F00D89D07 /* UIView+HYBHelperBlockKit.m in Sources */, 6920F84A1D3351DB00D89D07 /* HYBCommonKit.m in Sources */, 6920F84F1D3351DB00D89D07 /* NSDictionary+HYBHelperKit.m in Sources */, 6920F8731D33522F00D89D07 /* UIGestureRecognizer+HYBHelperBlockKit.m in Sources */, 6920F68B1D320E9600D89D07 /* TestViewController1.m in Sources */, 6920F84E1D3351DB00D89D07 /* NSArray+HYBHelperKit.m in Sources */, 6950297C1D3929B800773B69 /* UIAlertView+HYBHelperKit.m in Sources */, 6920F8551D3351DB00D89D07 /* NSTimer+HYBHelperKit.m in Sources */, 6950297F1D39332B00773B69 /* UIActionSheet+HYBHelperKit.m in Sources */, 6920F8541D3351DB00D89D07 /* NSString+HYBHelperKit.m in Sources */, 6920F8521D3351DB00D89D07 /* NSMutableDictionary+HYBHelperKit.m in Sources */, 6920F85C1D3351DB00D89D07 /* UIImageView+HYBMasonryKit.m in Sources */, 6920F84B1D3351DB00D89D07 /* HYBHelperKitBaseController.m in Sources */, 69489E881D23790E00F90205 /* AppDelegate.m in Sources */, 6920F8721D33522F00D89D07 /* UIControl+HYBHelperBlockKit.m in Sources */, 6920F84D1D3351DB00D89D07 /* HYBHelperKitTestEntranceController.m in Sources */, 69489E851D23790E00F90205 /* main.m in Sources */, 6920F87C1D33526B00D89D07 /* UIColor+HYBHelperKitUIKit.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; 69489E951D23790E00F90205 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 69489EC91D23BCDC00F90205 /* NSTimerTests.m in Sources */, 69489ED11D23C11200F90205 /* NSStringTests.m in Sources */, 69489ECC1D23BEEF00F90205 /* NSUserDefaultsTests.m in Sources */, 69C383191D23C7FB00176B00 /* NSObjectTests.m in Sources */, 6932F8D11D24D12600F2D2F0 /* DictionaryTests.m in Sources */, 69489E9E1D23790E00F90205 /* HYBHelperKitTests.m in Sources */, 69C383291D23DA4100176B00 /* ArrayTests.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ 69489E9B1D23790E00F90205 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 69489E7F1D23790E00F90205 /* HYBHelperKit */; targetProxy = 69489E9A1D23790E00F90205 /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ 69489E911D23790E00F90205 /* LaunchScreen.storyboard */ = { isa = PBXVariantGroup; children = ( 69489E921D23790E00F90205 /* Base */, ); name = LaunchScreen.storyboard; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 69489EA01D23790E00F90205 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 9.3; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; }; name = Debug; }; 69489EA11D23790E00F90205 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 9.3; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; VALIDATE_PRODUCT = YES; }; name = Release; }; 69489EA31D23790E00F90205 /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = 3E988714FC5DCCC6FE572EC4 /* Pods-HYBHelperKit.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = HYBHelperKit/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 7.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.huangyibiao.HYBHelperKit; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; }; 69489EA41D23790E00F90205 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 3D2427DF68D165E6D41371A3 /* Pods-HYBHelperKit.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = HYBHelperKit/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 7.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.huangyibiao.HYBHelperKit; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; }; 69489EA61D23790E00F90205 /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = 27E98AAFD6B6C8A744E7B36C /* Pods-HYBHelperKitTests.debug.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; INFOPLIST_FILE = HYBHelperKitTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.huangyibiao.HYBHelperKitTests; PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/HYBHelperKit.app/HYBHelperKit"; }; name = Debug; }; 69489EA71D23790E00F90205 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = D4190D82170077172A8B3795 /* Pods-HYBHelperKitTests.release.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; INFOPLIST_FILE = HYBHelperKitTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.huangyibiao.HYBHelperKitTests; PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/HYBHelperKit.app/HYBHelperKit"; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 69489E7B1D23790E00F90205 /* Build configuration list for PBXProject "HYBHelperKit" */ = { isa = XCConfigurationList; buildConfigurations = ( 69489EA01D23790E00F90205 /* Debug */, 69489EA11D23790E00F90205 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 69489EA21D23790E00F90205 /* Build configuration list for PBXNativeTarget "HYBHelperKit" */ = { isa = XCConfigurationList; buildConfigurations = ( 69489EA31D23790E00F90205 /* Debug */, 69489EA41D23790E00F90205 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 69489EA51D23790E00F90205 /* Build configuration list for PBXNativeTarget "HYBHelperKitTests" */ = { isa = XCConfigurationList; buildConfigurations = ( 69489EA61D23790E00F90205 /* Debug */, 69489EA71D23790E00F90205 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 69489E781D23790E00F90205 /* Project object */; } ================================================ FILE: HYBHelperKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata ================================================ ================================================ FILE: HYBHelperKit.xcodeproj/xcuserdata/huangyibiao.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist ================================================ ================================================ FILE: HYBHelperKit.xcodeproj/xcuserdata/huangyibiao.xcuserdatad/xcschemes/HYBHelperKit.xcscheme ================================================ ================================================ FILE: HYBHelperKit.xcodeproj/xcuserdata/huangyibiao.xcuserdatad/xcschemes/xcschememanagement.plist ================================================ SchemeUserState HYBHelperKit.xcscheme orderHint 0 SuppressBuildableAutocreation 69489E7F1D23790E00F90205 primary 69489E981D23790E00F90205 primary ================================================ FILE: HYBHelperKit.xcworkspace/contents.xcworkspacedata ================================================ ================================================ FILE: HYBHelperKit.xcworkspace/xcuserdata/huangyibiao.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist ================================================ ================================================ FILE: HYBHelperKitSources/HYBCommonKit.h ================================================ // // HYBCommonKit.h // HYBHelperKit // // Created by huangyibiao on 16/7/10. // Copyright © 2016年 huangyibiao. All rights reserved. // #import #import "Masonry.h" // Get weak reference object. #define kWeakObject(object) __weak __typeof(object) weakObject = object; // Get weak reference object. #define kWeak(caller, object) __weak __typeof(object) caller = object; // Get strong reference object. #define kStrongObject(object) __strong __typedef(object) strongObject = object; // Get dispatch_get_main_queue() #define kMainThread (dispatch_get_main_queue()) // Get default dispatch_get_global_queue #define kGlobalThread dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0) // Radians convert to degress. #define kRadiansToDegrees(radians) ((radians) * (180.0 / M_PI)) // Degrees convert to randians. #define kDegreesToRadians(angle) ((angle) / 180.0 * M_PI) // Fast to get iOS system version #define kIOSVersion ([UIDevice currentDevice].systemVersion.floatValue) // More fast way to get app delegate #define kAppDelegate ((AppDelegate *)[[UIApplication sharedApplication] delegate]) #pragma mark - Device Frame // Get the screen's height. #define kScreenHeight ([UIScreen mainScreen].bounds.size.height) // Get the screen's width. #define kScreenWidth ([UIScreen mainScreen].bounds.size.width) // Get the screen's bounds. #define kScreenBounds ([UIScreen mainScreen].bounds) #pragma mark - Generate Color // color ///< format:0xFFFFFF #define k16RGBColor(rgbValue) \ [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16)) / 255.0 \ green:((float)((rgbValue & 0xFF00) >> 8)) / 255.0 \ blue:((float)(rgbValue & 0xFF)) / 255.0 alpha:1.0] ///< format:22,22,22 #define kRGBColor(r, g, b) ([UIColor colorWithRed:(r) / 255.0 \ green:(g) / 255.0 \ blue:(b) / 255.0 \ alpha:1]) ///< format:22,22,22,0.5 #define kRGBAColor(r, g, b, a) ([UIColor colorWithRed:(r) / 255.0 \ green:(g) / 255.0 \ blue:(b) / 255.0 \ alpha:(a)]) // More easy way to use hex color to generate color. #define kHexRGB(rgb) k16RGBColor(rgb) // More easy way to generate a color object. #define kRGB(r,g,b) kRGBColor(r,g,b) // More easy way to generate a color object with rgb and alpha. #define kRGBA(r,g,b,a) kRGBAColor(r, g, b, a) #pragma mark - Load Font // Generate font with size #define kFontWithSize(size) [UIFont systemFontOfSize:size] // Generate bold font with size. #define kBoldFontWithSize(size) [UIFont boldSystemFontOfSize:size] #pragma mark - Load Image // More easy way to load an image. #define kImage(Name) ([UIImage imageNamed:Name]) // More easy to load an image from file. #define kImageOfFile(Name) ([UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:Name ofType:nil]]) #pragma mark - System Singletons // More easy way to get user default object. #define kUserDefaults [NSUserDefaults standardUserDefaults] // More easy way to get NSNotificationCenter object. #define kNotificationCenter [NSNotificationCenter defaultCenter] // More easy way to get [NSFileManager defaultManager] #define kFileManager [NSFileManager defaultManager] // More easy way to post a notification from notification center. #define kPostNotificationWithName(notificationName) \ [kNotificationCenter postNotificationName:notificationName object:nil userInfo:nil] // More easy way to post a notification with user info from notification center. #define kPostNotificationWithNameAndUserInfo(notificationName, userInfo) \ [kNotificationCenter postNotificationName:notificationName object:nil userInfo:userInfo] #pragma mark - Judge // Judge whether it is an empty string. #define kIsEmptyString(s) (s == nil || [s isKindOfClass:[NSNull class]] || ([s isKindOfClass:[NSString class]] && s.length == 0)) // Judge whether it is a nil or null object. #define kIsEmptyObject(obj) (obj == nil || [obj isKindOfClass:[NSNull class]]) // Judge whether it is a vaid dictionary. #define kIsDictionary(objDict) (objDict != nil && [objDict isKindOfClass:[NSDictionary class]]) // Judge whether it is a valid array. #define kIsArray(objArray) (objArray != nil && [objArray isKindOfClass:[NSArray class]]) // Judge whether the device it is ipad. #define kIsIPad \ ([[UIDevice currentDevice] respondsToSelector:@selector(userInterfaceIdiom)]\ && [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) // Judge whether current orientation is landscape. #define kIsLandscape (UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation])) #pragma makr - Color /** * @author https://github.com/CoderJackyHuang * * The following macros are system colors. */ #define kBlackColor [UIColor blackColor] #define kDarkGrayColor [UIColor darkGrayColor] #define kLightGrayColor [UIColor lightGrayColor] #define kWhiteColor [UIColor whiteColor] #define kRedColor [UIColor redColor] #define kBlueColor [UIColor blueColor] #define kGreenColor [UIColor greenColor] #define kCyanColor [UIColor cyanColor] #define kYellowColor [UIColor yellowColor] #define kMagentaColor [UIColor magentaColor] #define kOrangeColor [UIColor orangeColor] #define kPurpleColor [UIColor purpleColor] #define kBrownColor [UIColor brownColor] #define kClearColor [UIColor clearColor] // Black opaque color, with rgba: 0, 0, 0, 0.5 #define kBlackOpaqueColor kHexColor(0, 0, 0, 0.5) #pragma mark - Blocks /** * This is a common block for handling error. */ typedef void (^HYBErrorBlock)(NSError *error); /** * This is a void block. */ typedef void (^HYBVoidBlock)(void); /** * This is a common block for handling to return a string value. */ typedef void (^HYBStringBlock)(NSString *result); /** * For notification block. */ typedef void (^HYBNotificationBlock)(NSNotification *sender); /** * For return a bool block. */ typedef void (^HYBBOOLBlock)(BOOL result); /** * For return a array block. */ typedef void (^HYBArrayBlock)(NSArray *list); /** * For return a array and msg block. */ typedef void (^HYBArrayMessageBlock)(NSArray *list, NSString *msg); /** * For return a dictionary block. */ typedef void (^HYBDictionaryBlock)(NSDictionary *response); /** * For return a dictionary and a message block. */ typedef void (^HYBDictionaryMessageBlock)(NSDictionary *response, NSString *msg); /** * For only return number block. */ typedef void (^HYBNumberBlock)(NSNumber *resultNumber); /** * For number and message block. */ typedef void (^HYBNumberMessageBlock)(NSNumber *resultNumber, NSString *msg); /** * Common return object block. */ typedef void (^HYBIdBlock)(id result); /** * For single button block. */ typedef void(^HYBButtonBlock)(UIButton *sender); /** * @author https://github.com/CoderJackyHuang * * Common value change block. * * @param sender The responder */ typedef void(^HYBValueChangedBlock)(id sender); /** * @author https://github.com/CoderJackyHuang * * Common edit change block, eg: UITextField. * * @param sender The responder. */ typedef void(^HYBEditChangedBlock)(id sender); /** * For button array block. * * @param index index in the array. * @param sender The responder. */ typedef void(^HYBButtonIndexBlock)(NSUInteger index, UIButton *sender); /** * Gesture block callback. */ typedef void(^HYBGestureBlock)(UIGestureRecognizer *sender); /** * @author https://github.com/CoderJackyHuang * * The long press gesture callback block. * * @param sender The long press gesture. */ typedef void(^HYBLongGestureBlock)(UILongPressGestureRecognizer *sender); /** * @author https://github.com/CoderJackyHuang * * The tap gesture callback block. * * @param sender The tap gesture. */ typedef void(^HYBTapGestureBlock)(UITapGestureRecognizer *sender); /** * @author https://github.com/CoderJackyHuang * * Masonry Kit Need To Use It. */ typedef void(^HYBConstraintMaker)(MASConstraintMaker *make); #pragma mark - Cell /** * @author https://github.com/CoderJackyHuang * * The common cell identifier */ static NSString *kHYBCellIdentifier = @"HYBCommonCellIdentifier"; @interface HYBCommonKit : NSObject @end ================================================ FILE: HYBHelperKitSources/HYBCommonKit.m ================================================ // // HYBCommonKit.m // HYBHelperKit // // Created by huangyibiao on 16/7/11. // Copyright © 2016年 huangyibiao. All rights reserved. // #import "HYBCommonKit.h" @implementation HYBCommonKit @end ================================================ FILE: HYBHelperKitSources/HYBHelperBlocksKit.h ================================================ // // HYBHelperBlocksKit.h // HYBHelperKit // // Created by huangyibiao on 16/6/29. // Copyright © 2016年 huangyibiao. All rights reserved. // #import "UIButton+HYBHelperBlockKit.h" #import "UIControl+HYBHelperBlockKit.h" #import "UIGestureRecognizer+HYBHelperBlockKit.h" #import "UIView+HYBHelperBlockKit.h" ================================================ FILE: HYBHelperKitSources/HYBHelperKit.h ================================================ // // HYBHelperKit.h // HYBHelperKit // // Created by huangyibiao on 16/6/29. // Copyright © 2016年 huangyibiao. All rights reserved. // /** * 使用此库的入口,可以通过引入此文件,达到统一引入全部文件的上的 */ #import "HYBHelperBlocksKit.h" #import "HYBHelperMasonryMaker.h" #import "HYBHelperUIKit.h" #import "HYBCommonKit.h" #import "HYBHelperKitBaseController.h" #import "HYBHelperKitBaseURLController.h" #import "HYBHelperKitTestEntranceController.h" // FoundationKit #import "NSNumber+HYBHelperKit.h" #import "NSObject+HYBHelperKit.h" #import "NSString+HYBHelperKit.h" #import "NSUserDefaults+HYBHelperKit.h" #import "NSTimer+HYBHelperKit.h" #import "NSMutableArray+HYBHelperKit.h" #import "NSArray+HYBHelperKit.h" #import "NSDictionary+HYBHelperKit.h" #import "NSMutableDictionary+HYBHelperKit.h" #import "NSFileManager+HYBHelperKit.h" #import "NSDate+HYBHelperKit.h" ================================================ FILE: HYBHelperKitSources/HYBHelperKitBaseController.h ================================================ // // HYBHelperKitBaseController.h // HYBHelperKit // // Created by huangyibiao on 16/7/5. // Copyright © 2016年 huangyibiao. All rights reserved. // #import #import "HYBCommonKit.h" /** * @author https://github.com/CoderJackyHuang * * This is an very useful view controller, that it will support many kinds of * base APIs of UINavigationBar items and so no. */ @interface HYBHelperKitBaseController : UIViewController /** * @author https://github.com/CoderJackyHuang * * Get the left item which using a button as custom view. It may be nil if * navigation item left items are empty. */ @property (nonatomic, strong, readonly) UIButton *hyb_leftButtonItem; /** * @author https://github.com/CoderJackyHuang * * Get all of left items that using button as custom view. It may be nil if * navigation item left items are empty. */ @property (nonatomic, strong, readonly) NSArray *hyb_leftButtonItems; /** * @author https://github.com/CoderJackyHuang * * Get the first right button item. When using it to access right button, it usually * just has a right item. It may be nil if there is no navigation right items. */ @property (nonatomic, strong, readonly) UIButton *hyb_rightButtonItem; /** * @author https://github.com/CoderJackyHuang * * Get all right button items. When using ti to access right buttons. It may be nil if * there is no navigation right items. */ @property (nonatomic, strong, readonly) NSArray *hyb_rightButtonItems; /** * @author https://github.com/CoderJackyHuang * * Adjust navigation title view to center, when it shows margin right, just because * the previous navigation item's title is too long. */ - (void)hyb_adjustNavigationTitleToCenter; #pragma mark - Config Navigaiton Item /** * @author https://github.com/CoderJackyHuang * * Set the navigation title or title view. * * @param title Title, titleView or a UIImage instance will be automatically * created a title view. */ - (void)hyb_setNavTitle:(id)title; /** * @author https://github.com/CoderJackyHuang * * Add a title or title view to the navigation item, and add a button to the * navigation item right item with callback. * * @param title The title view or a title. * @param rightTitle The right button item title. * @param rightBlock The button event callback. */ - (void)hyb_setNavTitle:(id)title rightTitle:(NSString *)rightTitle rightBlock:(HYBButtonBlock)rightBlock; /** * @author https://github.com/CoderJackyHuang * * Add a title or title view, right items with titles to the navigation item. * * @param title The title view * @param rightTitles The right item button titles * @param rightBlock The callback of button touch up event. */ - (void)hyb_setNavTitle:(id)title rightTitles:(NSArray *)rightTitles rightBlock:(HYBButtonIndexBlock)rightBlock; /** * @author https://github.com/CoderJackyHuang * * Add a title or title view, right items with images to the navigation item. * * @param title The title view * @param rightImages The right item button normal images. * @param rightBlock The callback of button touch up event. */ - (void)hyb_setNavTitle:(id)title rightImages:(NSArray *)rightImages rightBlock:(HYBButtonIndexBlock)rightBlock; /** * @author https://github.com/CoderJackyHuang * * Add a title or title view, right items with images to the navigation item. * * @param title The title view * @param rightImages The right item button normal images. * @param rightHgImages The right item button highlighted images. * @param rightBlock The callback of button touch up event. */ - (void)hyb_setNavTitle:(id)title rightImages:(NSArray *)rightImages rightHgImages:(NSArray *)rightHgImages rightBlock:(HYBButtonIndexBlock)rightBlock; /** * @author https://github.com/CoderJackyHuang * * Set navigation left item with button title. * * @param title The title of left item button. * @param block The button touch up event callback. */ - (void)hyb_setNavLeftButtonTitle:(NSString *)title onCliked:(HYBButtonBlock)block; /** * @author https://github.com/CoderJackyHuang * * Config navigation left item with a image or image name. * * @param image UIImage instance or an image name. * @param block The callback of item clicked. */ - (void)hyb_setNavLeftImage:(id)image block:(HYBButtonBlock)block; #pragma mark - About indicator animating /** * @author https://github.com/CoderJackyHuang * * Create an UIActivityIndicatorView view with UIActivityIndicatorViewStyleGray style * * @return The instance of UIActivityIndicatorView */ - (UIActivityIndicatorView *)hyb_startIndicatorAnimating; /** * @author https://github.com/CoderJackyHuang * * Create an UIActivityIndicatorView view with specified style. * * @param style The indicator view style * * @return The instance of UIActivityIndicatorView */ - (UIActivityIndicatorView *)hyb_startIndicatorAnimatingWithStyle:(UIActivityIndicatorViewStyle)style; /** * @author https://github.com/CoderJackyHuang * * Stop animating of indicator and remove from super view. */ - (void)hyb_stopIndicatorAnimating; #pragma mark - Notification /** * @author https://github.com/CoderJackyHuang * * Add a notification to the notification center with notification name. * * @param notificationName The name of notification * @param callback The callback when received the notification. */ - (void)hyb_addObserverWithNotificationName:(NSString *)notificationName callback:(HYBNotificationBlock)callback; /** * @author https://github.com/CoderJackyHuang * * Remove all notifications of the view controller. */ - (void)hyb_removeAllNotifications; /** * @author https://github.com/CoderJackyHuang * * Remove the specified notification with notification name from notification * center. * * @param nofiticationName The notification name. */ - (void)hyb_removeAllNotificationWithName:(NSString *)nofiticationName; @end ================================================ FILE: HYBHelperKitSources/HYBHelperKitBaseController.m ================================================ // // HYBHelperKitBaseController.m // HYBHelperKit // // Created by huangyibiao on 16/7/5. // Copyright © 2016年 huangyibiao. All rights reserved. // #import "HYBHelperKitBaseController.h" #import #import "HYBHelperKit.h" @interface HYBHelperKitBaseController () @property (nonatomic, strong) NSMutableArray *hyb_notificationNames; @property (nonatomic, strong) UIActivityIndicatorView *hyb_loadingView; @end @implementation HYBHelperKitBaseController - (void)dealloc { [self hyb_removeAllNotifications]; #if DEBUG NSLog(@"%@ dealloc", [[self class] description]); #endif } - (void)viewDidLoad { [super viewDidLoad]; self.edgesForExtendedLayout = UIRectEdgeNone; self.automaticallyAdjustsScrollViewInsets = NO; self.view.backgroundColor = kWhiteColor; } - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; #if DEBUG NSLog(@"%@ viewDidAppear", [[self class] description]); #endif } - (void)viewDidDisappear:(BOOL)animated { [super viewDidDisappear:animated]; #if DEBUG NSLog(@"%@ viewDidDisappear", [[self class] description]); #endif } - (UIButton *)hyb_leftButtonItem { return [[self hyb_leftButtonItems] hyb_objectAtIndex:0]; } - (NSArray *)hyb_leftButtonItems { NSMutableArray *array = [[NSMutableArray alloc] init]; NSArray *leftItems = self.navigationItem.leftBarButtonItems; for (UIBarButtonItem *item in leftItems) { if ([item isKindOfClass:[UIBarButtonItem class]]) { if ([item.customView isKindOfClass:[UIButton class]]) { [array addObject:item.customView]; } } } return array; } - (UIButton *)hyb_rightButtonItem { return [[self hyb_rightButtonItems] hyb_objectAtIndex:0]; } - (NSArray *)hyb_rightButtonItems { NSMutableArray *array = [[NSMutableArray alloc] init]; NSArray *rightItems = self.navigationItem.rightBarButtonItems; for (UIBarButtonItem *item in rightItems) { if ([item isKindOfClass:[UIBarButtonItem class]]) { if ([item.customView isKindOfClass:[UIButton class]]) { [array addObject:item.customView]; } } } return array; } - (void)hyb_adjustNavigationTitleToCenter { NSArray *viewControllerArray = [self.navigationController viewControllers]; long previousViewControllerIndex = [viewControllerArray indexOfObject:self] - 1; UIViewController *previous; if (previousViewControllerIndex >= 0) { previous = [viewControllerArray objectAtIndex:previousViewControllerIndex]; previous.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@" " style:UIBarButtonItemStylePlain target:self action:nil]; } } - (void)hyb_setNavTitle:(id)title rightTitle:(NSString *)rightTitle rightBlock:(HYBButtonBlock)rightBlock { if (kIsEmptyString(rightTitle)) { return [self hyb_setNavTitle:title]; } return [self hyb_setNavTitle:title rightTitles:@[rightTitle] rightBlock:^(NSUInteger index, UIButton *sender) { if (rightBlock) { rightBlock(sender); } }]; } - (void)hyb_setNavTitle:(id)title rightTitles:(NSArray *)rightTitles rightBlock:(HYBButtonIndexBlock)rightBlock { [self hyb_setNavTitle:title]; if (kIsArray(rightTitles) && rightTitles.count >= 1) { NSUInteger i = 0; NSMutableArray *rightButtons = [[NSMutableArray alloc] init]; for (NSString *title in rightTitles) { UIButton *btn = [UIButton hyb_buttonWithTitle:title superView:nil constraints:nil touchUp:^(UIButton *sender) { if (rightBlock) { rightBlock(i, sender); } }]; [rightButtons addObject:btn]; i++; } [self _hyb_setNavItems:rightButtons isLeft:NO]; } } - (void)hyb_setNavTitle:(id)title rightImages:(NSArray *)rightImages rightBlock:(HYBButtonIndexBlock)rightBlock { return [self hyb_setNavTitle:title rightImages:rightImages rightHgImages:nil rightBlock:rightBlock]; } - (void)hyb_setNavTitle:(id)title rightImages:(NSArray *)rightImages rightHgImages:(NSArray *)rightHgImages rightBlock:(HYBButtonIndexBlock)rightBlock { [self hyb_setNavTitle:title]; if (kIsArray(rightImages) && rightHgImages.count >= 1) { NSUInteger i = 0; NSMutableArray *rightButtons = [[NSMutableArray alloc] init]; for (NSString *imgName in rightImages) { NSString *last = [rightHgImages hyb_objectAtIndex:i]; UIButton *btn = [UIButton hyb_buttonWithImage:imgName superView:nil constraints:nil touchUp:^(UIButton *sender) { if (rightBlock) { rightBlock(i, sender); } }]; UIImage *hgImage = nil; if ([last isKindOfClass:[UIImage class]]) { hgImage = (UIImage *)last; } else if ([last isKindOfClass:[NSString class]]) { hgImage = kImage(last); } if (hgImage) { [btn setImage:hgImage forState:UIControlStateHighlighted]; } [rightButtons addObject:btn]; i++; } [self _hyb_setNavItems:rightButtons isLeft:NO]; } } - (void)hyb_setNavLeftButtonTitle:(NSString *)title onCliked:(HYBButtonBlock)block { UIButton *btn = [UIButton hyb_buttonWithTitle:title superView:nil constraints:nil touchUp:block]; [self _hyb_setNavItems:@[btn] isLeft:YES]; } - (void)hyb_setNavLeftImage:(id)image block:(HYBButtonBlock)block { UIImage *normalImage = image; if ([normalImage isKindOfClass:[NSString class]]) { normalImage = kImage(image); } UIButton *btn = [UIButton hyb_buttonWithImage:image superView:nil constraints:nil touchUp:block]; [self _hyb_setNavItems:@[btn] isLeft:YES]; } - (void)hyb_setNavTitle:(id)title { if ([title isKindOfClass:[NSString class]]) { self.navigationItem.title = title; } else if ([title isKindOfClass:[UIView class]]) { self.navigationItem.titleView = title; } else if ([title isKindOfClass:[UIImage class]]) { UIImageView *imageView = [[UIImageView alloc] initWithImage:(UIImage *)title]; self.navigationItem.titleView = imageView; [imageView sizeToFit]; } } #pragma mark - Notification - (void)hyb_addObserverWithNotificationName:(NSString *)notificationName callback:(HYBNotificationBlock)callback { if (kIsEmptyString(notificationName)) { return; } [self hyb_addNotificationName:notificationName]; [kNotificationCenter addObserver:self selector:@selector(hyb_onRecievedNotification:) name:notificationName object:nil]; objc_setAssociatedObject(self, (__bridge const void *)(notificationName), callback, OBJC_ASSOCIATION_COPY_NONATOMIC); } - (void)hyb_removeAllNotifications { // 移除监听 for (NSString *name in self.hyb_notificationNames) { [kNotificationCenter removeObserver:self name:name object:nil]; // 取消关联 objc_setAssociatedObject(self, (__bridge const void *)(name), nil, OBJC_ASSOCIATION_COPY_NONATOMIC); } [kNotificationCenter removeObserver:self]; } - (void)hyb_removeAllNotificationWithName:(NSString *)nofiticationName { if (kIsEmptyString(nofiticationName)) { return; } // 移除监听 for (NSString *name in self.hyb_notificationNames) { if ([name isEqualToString:nofiticationName]) { [kNotificationCenter removeObserver:self name:name object:nil]; // 取消关联 objc_setAssociatedObject(self, (__bridge const void *)(name), nil, OBJC_ASSOCIATION_COPY_NONATOMIC); break; } } } - (UIActivityIndicatorView *)hyb_startIndicatorAnimating { return [self hyb_startIndicatorAnimatingWithStyle:UIActivityIndicatorViewStyleGray]; } - (UIActivityIndicatorView *)hyb_startIndicatorAnimatingWithStyle:(UIActivityIndicatorViewStyle)style { if (self.hyb_loadingView == nil) { self.hyb_loadingView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:style]; [self.view addSubview:self.hyb_loadingView]; kWeakObject(self); if (self.navigationController && self.navigationController.navigationBarHidden == NO) { [self.hyb_loadingView mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.equalTo(weakObject.view); make.centerY.equalTo(weakObject.view).offset(-64 / 2); }]; } else { [self.hyb_loadingView mas_makeConstraints:^(MASConstraintMaker *make) { make.center.equalTo(weakObject.view); }]; } } [self.view bringSubviewToFront:self.hyb_loadingView]; [self.hyb_loadingView startAnimating]; return self.hyb_loadingView; } - (void)hyb_stopIndicatorAnimating { [self.hyb_loadingView stopAnimating]; [self.hyb_loadingView removeFromSuperview]; self.hyb_loadingView = nil; } #pragma mark - Private - (void)_hyb_setNavItems:(NSArray *)buttons isLeft:(BOOL)isLeft { UIBarButtonItem *negativeSpacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil]; negativeSpacer.width = -8; if (kIOSVersion < 7) { negativeSpacer.width = 0; } NSMutableArray *items = [[NSMutableArray alloc] initWithCapacity:buttons.count]; [items addObject:negativeSpacer]; for (NSUInteger i = 0; i < buttons.count; ++i) { UIButton *btn = [buttons hyb_objectAtIndex:i]; [btn sizeToFit]; UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithCustomView:btn]; [items addObject:item]; } if (isLeft) { self.navigationItem.leftBarButtonItems = items; } else { self.navigationItem.rightBarButtonItems = items; } } - (void)hyb_addNotificationName:(NSString *)name { for (NSString *notificationName in self.hyb_notificationNames) { if ([notificationName isEqualToString:name]) { return; } } [self.hyb_notificationNames addObject:name]; } - (void)hyb_onRecievedNotification:(NSNotification *)notification { for (NSString *name in self.hyb_notificationNames) { if ([name isEqualToString:notification.name]) { HYBNotificationBlock block = objc_getAssociatedObject(self, (__bridge const void *)(notification.name)); if (block) { block(notification); } break; } } } - (NSMutableArray *)hyb_notificationNames { if (_hyb_notificationNames == nil) { _hyb_notificationNames = [[NSMutableArray alloc] init]; } return _hyb_notificationNames; } @end ================================================ FILE: HYBHelperKitSources/HYBHelperKitBaseURLController.h ================================================ // // HYBHelperKitBaseURLController.h // HYBHelperKit // // Created by huangyibiao on 16/6/30. // Copyright © 2016年 huangyibiao. All rights reserved. // #import #import "HYBHelperKitBaseController.h" #import "HYBCommonKit.h" /** * @author https://github.com/CoderJackyHuang * * This is a helper controller, for developers showing a base url list * in the tabbar controller, and need to select one url before any * HTTP/HTTPS request is sent. * * @Note This class is only used in the debug mode. */ @interface HYBHelperKitBaseURLController : HYBHelperKitBaseController /** * @author https://github.com/CoderJackyHuang * * Show the base url list view controller to developers with selected callback. * * @param baseURLSources The base url list sources. * @param callback The callback block when select one or input one. * * @return The controller instance. */ + (instancetype)createWithBaseURLs:(NSArray *(^)(void))baseURLSources onCallback:(HYBStringBlock)callback; @end ================================================ FILE: HYBHelperKitSources/HYBHelperKitBaseURLController.m ================================================ // // HYBHelperKitBaseURLController.m // HYBHelperKit // // Created by huangyibiao on 16/6/30. // Copyright © 2016年 huangyibiao. All rights reserved. // #import "HYBHelperKit.h" @interface HYBHelperKitBaseURLController () @property (nonatomic, strong) UITableView *tableView; @property (nonatomic, strong) UITextField *textField; @property (nonatomic, copy) NSArray *baseURLs; @property (nonatomic, copy) HYBStringBlock callback; @end @implementation HYBHelperKitBaseURLController + (instancetype)createWithBaseURLs:(NSArray *(^)(void))baseURLSources onCallback:(HYBStringBlock)callback { #ifdef DEBUG HYBHelperKitBaseURLController *vc = [[HYBHelperKitBaseURLController alloc] init]; if (baseURLSources) { vc.baseURLs = baseURLSources(); } vc.callback = callback; return vc; #endif return nil; } - (instancetype)init { if (self = [super init]) { } return self; } - (void)viewDidLoad { [super viewDidLoad]; self.title = @"Base URL List"; self.tableView = [UITableView hyb_tableViewWithSuperview:self.view delegate:self]; [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:kHYBCellIdentifier]; self.tableView.backgroundColor = kWhiteColor; UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 44)]; self.textField = [UITextField hyb_textFieldWithHolder:@"Enter base url" delegate:nil superView:headerView constraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(10); make.height.mas_equalTo(30); make.width.mas_equalTo(kScreenWidth - 100); make.centerY.mas_equalTo(headerView); }]; self.textField.borderStyle = UITextBorderStyleRoundedRect; UIButton *button = [UIButton hyb_buttonWithTitle:@"Go" superView:headerView constraints:^(MASConstraintMaker *make) { make.right.mas_equalTo(headerView).offset(-10); make.width.mas_equalTo(100 - 20); make.centerY.mas_equalTo(self.textField); make.height.mas_equalTo(30); } touchUp:^(UIButton *sender) { if (!kIsEmptyObject(self.textField.text)) { if (self.callback) { self.callback(self.textField.text); } } }]; button.layer.cornerRadius = 3; button.layer.masksToBounds = YES; button.backgroundColor = kBlueColor; headerView.backgroundColor = kHexRGB(0xf0f0f0); self.tableView.tableHeaderView = headerView; } #pragma mark - UITableViewDelegate & UITableViewDataSource - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return self.baseURLs.count; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kHYBCellIdentifier]; NSString *baseUrl = [self.baseURLs hyb_objectAtIndex:indexPath.row]; cell.textLabel.text = baseUrl; return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSString *baseUrl = [self.baseURLs hyb_objectAtIndex:indexPath.row]; if (self.callback) { self.callback(baseUrl); } } @end ================================================ FILE: HYBHelperKitSources/HYBHelperKitTestEntranceController.h ================================================ // // HYBHelperKitTestEntranceController.h // HYBHelperKit // // Created by huangyibiao on 16/7/1. // Copyright © 2016年 huangyibiao. All rights reserved. // #import #import "HYBHelperKit.h" /** * @author https://github.com/CoderJackyHuang * * The model for HYBHelperKitTestEntranceController, we use it to add test controller * to the test center. */ @interface HYBHelperKitTestEntranceModel : NSObject /** * @author https://github.com/CoderJackyHuang * * The view controller's Class */ @property (nonatomic, unsafe_unretained) Class vcClass; /** * @author https://github.com/CoderJackyHuang * * The title to show in the list, if it is nil, it will show the class name. */ @property (nonatomic, copy) NSString *title; /** * @author https://github.com/CoderJackyHuang * * Use this to create a model will be more convenience. * * @param vcClass The view controller's Class * @param title The title * * @return The HYBHelperKitTestEntranceModel instance. */ + (instancetype)modelWithClass:(Class)vcClass title:(NSString *)title; @end /** * @author https://github.com/CoderJackyHuang * * When a team is going to develop a project, usually we will divide * works into more detail task and assign to different team members. * * And the question is? We don't have test entrance, before each task * links together. So, here I try to support a common test center entrance * view controller, and each team member can use it to add current controller * entrance. * * @Note Auto push to the next veiw controller when select an item. */ @interface HYBHelperKitTestEntranceController : HYBHelperKitBaseController /** * @author https://github.com/CoderJackyHuang * * Designed initialized. * * @param items To get HYBHelperKitTestEntranceModel items to show in the list. * * @return The HYBHelperKitTestEntranceController instance. */ - (instancetype)initWithItems:(NSArray *(^)(void))items; @end ================================================ FILE: HYBHelperKitSources/HYBHelperKitTestEntranceController.m ================================================ // // HYBHelperKitTestEntranceController.m // HYBHelperKit // // Created by huangyibiao on 16/7/1. // Copyright © 2016年 huangyibiao. All rights reserved. // #import "HYBHelperKitTestEntranceController.h" @implementation HYBHelperKitTestEntranceModel + (instancetype)modelWithClass:(Class)vcClass title:(NSString *)title { HYBHelperKitTestEntranceModel *model = [[HYBHelperKitTestEntranceModel alloc] init]; model.vcClass = vcClass; model.title = title; return model; } @end @interface HYBHelperKitTestEntranceController () @property (nonatomic, strong) NSArray *sources; @property (nonatomic, strong) UITableView *tableView; @end @implementation HYBHelperKitTestEntranceController - (instancetype)initWithItems:(NSArray *(^)(void))items { if (self = [super init]) { if (items) { self.sources = items(); } } return self; } - (void)viewDidLoad { [super viewDidLoad]; self.title = @"Test Center Entrance"; self.tableView = [UITableView hyb_tableViewWithSuperview:self.view delegate:self]; [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:kHYBCellIdentifier]; self.tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine; } #pragma mark - UITableViewDelegate & UITableViewDataSource - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return self.sources.count; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kHYBCellIdentifier]; HYBHelperKitTestEntranceModel *model = [self.sources hyb_objectAtIndex:indexPath.row]; if ([model isKindOfClass:[HYBHelperKitTestEntranceModel class]]) { if (kIsEmptyObject(model.title)) { cell.textLabel.text = [model.vcClass description]; } else { cell.textLabel.text = model.title; } } return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { HYBHelperKitTestEntranceModel *model = [self.sources hyb_objectAtIndex:indexPath.row]; if ([model isKindOfClass:[HYBHelperKitTestEntranceModel class]]) { if (model.vcClass) { UIViewController *vc = [[model.vcClass alloc] init]; [self.navigationController pushViewController:vc animated:YES]; } } } @end ================================================ FILE: HYBHelperKitSources/HYBHelperMasonryMaker.h ================================================ // // HYBHelperMasonryMaker.h // HYBHelperKit // // Created by huangyibiao on 16/6/30. // Copyright © 2016年 huangyibiao. All rights reserved. // #import "UITableView+HYBMasonryKit.h" #import "UITextField+HYBMasonryKit.h" #import "UIImageView+HYBMasonryKit.h" #import "UILabel+HYBMasonryKit.h" #import "UIScrollView+HYBMasonryKit.h" #import "UIView+HYBMasonryKit.h" #import "UICollectionView+HYBMaonsryKit.h" #import "UIWebView+HYBMasonryKit.h" ================================================ FILE: HYBHelperKitSources/HYBHelperUIKit.h ================================================ // // HYBHelperUIKit.h // HYBHelperKit // // Created by huangyibiao on 16/6/30. // Copyright © 2016年 huangyibiao. All rights reserved. // #import "UIView+HYBHelperKitUIKit.h" #import "UIDevice+HYBHelperKitUIKit.h" #import "UIColor+HYBHelperKitUIKit.h" #import "UIAlertView+HYBHelperKit.h" #import "UIActionSheet+HYBHelperKit.h" ================================================ FILE: HYBHelperKitSources/NSArray+HYBHelperKit.h ================================================ // // NSArray+HYBHelperKit.h // HYBHelperKit // // Created by huangyibiao on 16/6/29. // Copyright © 2016年 huangyibiao. All rights reserved. // #import @interface NSArray (HYBHelperKit) /** * It is safe to call this method to retrieve element. * * @param index The index. * * @return The element in the index if index is valid, otherwise nil. */ - (id)hyb_objectAtIndex:(NSUInteger)index; /** * Judge whether the array contains the string. * * @param string The specified string to be checked. * * @return YES if found, otherwise NO. */ - (BOOL)hyb_isContainsString:(NSString *)string; /** * Make the array elements reverse. * * @return The reversed array. */ - (NSArray *)hyb_reverseArray; @end ================================================ FILE: HYBHelperKitSources/NSArray+HYBHelperKit.m ================================================ // // NSArray+HYBHelperKit.m // HYBHelperKit // // Created by huangyibiao on 16/6/29. // Copyright © 2016年 huangyibiao. All rights reserved. // #import "NSArray+HYBHelperKit.h" @implementation NSArray (HYBHelperKit) - (id)hyb_objectAtIndex:(NSUInteger)index { NSUInteger count = [self count]; if (count > 0 && index < count) { return [self objectAtIndex:index]; } return nil; } - (BOOL)hyb_isContainsString:(NSString *)string { for (NSString *element in self) { if ([element isKindOfClass:[NSString class]] && [element isEqualToString:string]) { return true; } } return false; } - (NSArray *)hyb_reverseArray { NSMutableArray *arrayTemp = [NSMutableArray arrayWithCapacity:[self count]]; NSEnumerator *enumerator = [self reverseObjectEnumerator]; for (id element in enumerator) { [arrayTemp addObject:element]; } return arrayTemp; } @end ================================================ FILE: HYBHelperKitSources/NSDate+HYBHelperKit.h ================================================ // // NSDate+HYBHelperKit.h // HYBHelperKit // // Created by huangyibiao on 16/7/11. // Copyright © 2016年 huangyibiao. All rights reserved. // #import @interface NSDate (HYBHelperKit) //--------------------------------------------// // Get day, month, year, hour, minute, second //--------------------------------------------// - (NSUInteger)hyb_day; - (NSUInteger)hyb_month; - (NSUInteger)hyb_year; - (NSUInteger)hyb_hour; - (NSUInteger)hyb_minute; - (NSUInteger)hyb_second; + (NSUInteger)hyb_day:(NSDate *)hyb_date; + (NSUInteger)hyb_month:(NSDate *)hyb_date; + (NSUInteger)hyb_year:(NSDate *)hyb_date; + (NSUInteger)hyb_hour:(NSDate *)hyb_date; + (NSUInteger)hyb_minute:(NSDate *)hyb_date; + (NSUInteger)hyb_second:(NSDate *)hyb_date; /** * @author https://github.com/CoderJackyHuang * * Get how many days in the year. * * @return The days of the year. */ - (NSUInteger)hyb_daysInYear; /** * @author https://github.com/CoderJackyHuang * * Get how many days in the specified year. * * @param hyb_date The specified date * * @return The days of the year. */ + (NSUInteger)hyb_daysInYear:(NSDate *)hyb_date; /** * @author https://github.com/CoderJackyHuang * * Judge whether this year is leap year or not. * * @return YES means leap year, otherwise NO. */ - (BOOL)hyb_isLeapYear; /** * @author https://github.com/CoderJackyHuang * * Judge whether the specified date of year is leap year or not. * * @param hyb_date The specified date. * * @return YES means leap year, otherwise NO. */ + (BOOL)hyb_isLeapYear:(NSDate *)hyb_date; /** * @author https://github.com/CoderJackyHuang * * Judge whether this year is leap year or not. * * @param year The specified year * * @return YES means leap year, otherwise NO. */ + (BOOL)hyb_isLeapYearWithYear:(int)year; /** * @author https://github.com/CoderJackyHuang * * Get which week in the year. * * @return Current week of year. */ - (NSUInteger)hyb_weekOfYear; /** * @author https://github.com/CoderJackyHuang * * Get which week in the specified date. * * @param hyb_date The specified date to get which week. * * @return Current week of the specified year. */ + (NSUInteger)hyb_weekOfYear:(NSDate *)hyb_date; /** * 获取格式化为YYYY-MM-dd格式的日期字符串 */ /** * @author https://github.com/CoderJackyHuang * * Convert the date to a time string with yyyy-MM-dd format. * * @return The time string with yyyy-MM-dd */ - (NSString *)hyb_toStringWithFormatYMD; /** * @author https://github.com/CoderJackyHuang * * Convert the date to a time string with yyyy-MM-dd format. * * @param hyb_date The specified date to be converted to time string. * * @return The time string with yyyy-MM-dd */ + (NSString *)hyb_toStringWithFormatYMD:(NSDate *)hyb_date; /** * @author https://github.com/CoderJackyHuang * * Get how many weeks in the month. It might have 4, 5, or 6 weeks. * * @return The weeks in the month. */ - (NSUInteger)hyb_howManyWeeksOfMonth; /** * @author https://github.com/CoderJackyHuang * * Get how many weeks in the month. It might have 4, 5, or 6 weeks. * * @param hyb_date The specified date * * @return The weeks in the month of the specified date. */ + (NSUInteger)hyb_howManyWeeksOfMonth:(NSDate *)hyb_date; /** * @author https://github.com/CoderJackyHuang * * Get the first date of this month. * * @return The first date of this month. */ - (NSDate *)hyb_beginDayOfMonth; /** * @author https://github.com/CoderJackyHuang * * Get the first date of this month. * * @param hyb_date The specified date. * * @return The first date of this month. */ + (NSDate *)hyb_beginDayOfMonth:(NSDate *)hyb_date; /** * @author https://github.com/CoderJackyHuang * * Get the last date of this month. * * @return The last date of this month. */ - (NSDate *)hyb_lastDayOfMonth; /** * @author https://github.com/CoderJackyHuang * * Get the last date of the specified month. * * @param hyb_date The specified date. * * @return The last date of this month. */ + (NSDate *)hyb_lastDayOfMonth:(NSDate *)hyb_date; /** * @author https://github.com/CoderJackyHuang * * Add days * * @param days The added days. * * @return The new date after add days. */ - (NSDate *)hyb_dateAfterDay:(NSUInteger)days; /** * @author https://github.com/CoderJackyHuang * * Add days to the specified date. * * @param hyb_date The spcified date. * @param days The added days. * * @return The new date after adding days. */ + (NSDate *)hyb_dateAfterDate:(NSDate *)hyb_date day:(NSInteger)days; /** * @author https://github.com/CoderJackyHuang * * Add months to the date. * * @param months The added months. * * @return The new date after adding months. */ - (NSDate *)hyb_dateAfterMonth:(NSUInteger)months; /** * @author https://github.com/CoderJackyHuang * * Add months to the date. * * @param hyb_date The specified date. * @param months The added months. * * @return The new date after adding months. */ + (NSDate *)hyb_dateAfterDate:(NSDate *)hyb_date month:(NSInteger)months; /** * 返回numYears年后的日期 */ /** * @author https://github.com/CoderJackyHuang * * Get new date offset numYears. * * @param numYears The * */ - (NSDate *)hyb_offsetYears:(int)numYears; + (NSDate *)hyb_offsetYears:(int)hyb_numYears fromDate:(NSDate *)hyb_fromDate; - (NSDate *)hyb_offsetMonths:(int)hyb_numMonths; + (NSDate *)hyb_offsetMonths:(int)hyb_numMonths fromDate:(NSDate *)hyb_fromDate; - (NSDate *)hyb_offsetDays:(int)hyb_numDays; + (NSDate *)hyb_offsetDays:(int)hyb_numDays fromDate:(NSDate *)hyb_fromDate; - (NSDate *)hyb_offsetHours:(int)hyb_hours; + (NSDate *)hyb_offsetHours:(int)hyb_numHours fromDate:(NSDate *)hyb_fromDate; - (NSUInteger)hyb_daysAgo; + (NSUInteger)hyb_daysAgo:(NSDate *)hyb_date; /** * 获取星期几 * * @return Return weekday number * [1 - Sunday] * [2 - Monday] * [3 - Tuerday] * [4 - Wednesday] * [5 - Thursday] * [6 - Friday] * [7 - Saturday] */ - (NSInteger)hyb_weekday; + (NSInteger)hyb_weekday:(NSDate *)hyb_date; /** * 获取星期几(名称)hyb_ * * @return Return weekday as a localized string * [1 - Sunday] * [2 - Monday] * [3 - Tuerday] * [4 - Wednesday] * [5 - Thursday] * [6 - Friday] * [7 - Saturday] */ - (NSString *)hyb_dayFromWeekday; + (NSString *)hyb_dayFromWeekday:(NSDate *)hyb_date; /** * Is the same date? * * @param anotherDate The another date to compare as NSDate * @return Return YES if is same day, NO if not */ - (BOOL)hyb_isSameDate:(NSDate *)hyb_anotherDate; /** * Is today? * * @return Return if self is today */ - (BOOL)hyb_isToday; /** * Add days to self * * @param days The number of days to add * @return Return self by adding the gived days number */ - (NSDate *)hyb_dateByAddingDays:(NSUInteger)hyb_days; /** * Get the month as a localized string from the given month number * * @param month The month to be converted in string * [1 - January] * [2 - February] * [3 - March] * [4 - April] * [5 - May] * [6 - June] * [7 - July] * [8 - August] * [9 - September] * [10 - October] * [11 - November] * [12 - December] * * @return Return the given month as a localized string */ + (NSString *)hyb_monthWithMonthNumber:(NSInteger)hyb_month; /** * Convert date to string with format. */ + (NSString *)hyb_stringWithDate:(NSDate *)hyb_date format:(NSString *)hyb_format; - (NSString *)hyb_stringWithFormat:(NSString *)hyb_format; /** * Convert date string to NSDate instance. */ + (NSDate *)hyb_dateWithString:(NSString *)hyb_string format:(NSString *)hyb_format; /** * Get how many days in the month. */ - (NSUInteger)hyb_daysInMonth:(NSUInteger)hyb_month; + (NSUInteger)hyb_daysInMonth:(NSDate *)hyb_date month:(NSUInteger)hyb_month; + (NSUInteger)hyb_dayInYear:(NSUInteger)year month:(NSUInteger)month; /** * Get how many days in the month. */ - (NSUInteger)hyb_daysInMonth; + (NSUInteger)hyb_daysInMonth:(NSDate *)hyb_date; /** * 返回x分钟前/x小时前/昨天/x天前/x个月前/x年前 */ - (NSString *)hyb_timeInfo; + (NSString *)hyb_timeInfoWithDate:(NSDate *)hyb_date; + (NSString *)hyb_timeInfoWithDateString:(NSString *)hyb_dateString; /** * yyyy-MM-dd/HH:mm:ss/yyyy-MM-dd HH:mm:ss */ - (NSString *)hyb_ymdFormat; - (NSString *)hyb_hmsFormat; - (NSString *)hyb_ymdHmsFormat; + (NSString *)hyb_ymdFormat; + (NSString *)hyb_hmsFormat; + (NSString *)hyb_ymdHmsFormat; + (NSDateComponents *)hyb_dateComponentsWithDate:(NSDate *)date; /** * Convert date to time stamp. */ - (NSString *)hyb_toTimeStamp; /** * Convert time stamp to date. */ + (NSDate *)hyb_toDateWithTimeStamp:(NSString *)timeStamp; @end ================================================ FILE: HYBHelperKitSources/NSDate+HYBHelperKit.m ================================================ // // NSDate+HYBHelperKit.m // HYBHelperKit // // Created by huangyibiao on 16/7/11. // Copyright © 2016年 huangyibiao. All rights reserved. // #import "NSDate+HYBHelperKit.h" @implementation NSDate (HYBHelperKit) - (NSUInteger)hyb_day { return [NSDate hyb_day:self]; } - (NSUInteger)hyb_month { return [NSDate hyb_month:self]; } - (NSUInteger)hyb_year { return [NSDate hyb_year:self]; } - (NSUInteger)hyb_hour { return [NSDate hyb_hour:self]; } - (NSUInteger)hyb_minute { return [NSDate hyb_minute:self]; } - (NSUInteger)hyb_second { return [NSDate hyb_second:self]; } + (NSUInteger)hyb_day:(NSDate *)hyb_date { return [[self hyb_dateComponentsWithDate:hyb_date] day]; } + (NSUInteger)hyb_month:(NSDate *)hyb_date { NSCalendar *calendar = [NSCalendar currentCalendar]; #if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_8_0 // NSDayCalendarUnit NSDateComponents *dayComponents = [calendar components:(NSCalendarUnitMonth)fromDate:hyb_date]; #else NSDateComponents *dayComponents = [calendar components:(NSMonthCalendarUnit)fromDate:hyb_date]; #endif return [dayComponents month]; } + (NSUInteger)hyb_year:(NSDate *)hyb_date { NSCalendar *calendar = [NSCalendar currentCalendar]; #if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_8_0 // NSDayCalendarUnit NSDateComponents *dayComponents = [calendar components:(NSCalendarUnitYear)fromDate:hyb_date]; #else NSDateComponents *dayComponents = [calendar components:(NSYearCalendarUnit)fromDate:hyb_date]; #endif return [dayComponents year]; } + (NSUInteger)hyb_hour:(NSDate *)hyb_date { NSCalendar *calendar = [NSCalendar currentCalendar]; #if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_8_0 // NSDayCalendarUnit NSDateComponents *dayComponents = [calendar components:(NSCalendarUnitHour)fromDate:hyb_date]; #else NSDateComponents *dayComponents = [calendar components:(NSHourCalendarUnit)fromDate:hyb_date]; #endif return [dayComponents hour]; } + (NSUInteger)hyb_minute:(NSDate *)hyb_date { NSCalendar *calendar = [NSCalendar currentCalendar]; #if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_8_0 // NSDayCalendarUnit NSDateComponents *dayComponents = [calendar components:(NSCalendarUnitMinute)fromDate:hyb_date]; #else NSDateComponents *dayComponents = [calendar components:(NSMinuteCalendarUnit)fromDate:hyb_date]; #endif return [dayComponents minute]; } + (NSUInteger)hyb_second:(NSDate *)hyb_date { NSCalendar *calendar = [NSCalendar currentCalendar]; #if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_8_0 // NSDayCalendarUnit NSDateComponents *dayComponents = [calendar components:(NSCalendarUnitSecond)fromDate:hyb_date]; #else NSDateComponents *dayComponents = [calendar components:(NSSecondCalendarUnit)fromDate:hyb_date]; #endif return [dayComponents second]; } - (NSUInteger)hyb_daysInYear { return [NSDate hyb_daysInYear:self]; } + (NSUInteger)hyb_daysInYear:(NSDate *)hyb_date { return [self hyb_isLeapYear:hyb_date] ? 366 : 365; } - (BOOL)hyb_isLeapYear { return [NSDate hyb_isLeapYear:self]; } + (BOOL)hyb_isLeapYear:(NSDate *)hyb_date { int year = (int)[hyb_date hyb_year]; return [self hyb_isLeapYearWithYear:year]; } + (BOOL)hyb_isLeapYearWithYear:(int)year { if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) { return YES; } return NO; } - (NSString *)hyb_toStringWithFormatYMD { return [NSDate hyb_toStringWithFormatYMD:self]; } + (NSString *)hyb_toStringWithFormatYMD:(NSDate *)hyb_date { return [NSString stringWithFormat:@"%ld-%02ld-%02ld", (long)[hyb_date hyb_year], (long)[hyb_date hyb_month], (long)[hyb_date hyb_day]]; } - (NSUInteger)hyb_howManyWeeksOfMonth { return [NSDate hyb_howManyWeeksOfMonth:self]; } + (NSUInteger)hyb_howManyWeeksOfMonth:(NSDate *)hyb_date { return [[hyb_date hyb_lastDayOfMonth] hyb_weekOfYear] - [[hyb_date hyb_beginDayOfMonth] hyb_weekOfYear] + 1; } - (NSUInteger)hyb_weekOfYear { return [NSDate hyb_weekOfYear:self]; } + (NSUInteger)hyb_weekOfYear:(NSDate *)hyb_date { NSUInteger i; NSUInteger year = [hyb_date hyb_year]; NSDate *lastdate = [hyb_date hyb_lastDayOfMonth]; for (i = 1;[[lastdate hyb_dateAfterDay:-7 * i] hyb_year] == year; i++) { } return i; } - (NSDate *)hyb_dateAfterDay:(NSUInteger)hyb_day { return [NSDate hyb_dateAfterDate:self day:hyb_day]; } + (NSDate *)hyb_dateAfterDate:(NSDate *)hyb_date day:(NSInteger)hyb_day { NSCalendar *calendar = [NSCalendar currentCalendar]; NSDateComponents *componentsToAdd = [[NSDateComponents alloc] init]; [componentsToAdd setDay:hyb_day]; NSDate *dateAfterDay = [calendar dateByAddingComponents:componentsToAdd toDate:hyb_date options:0]; return dateAfterDay; } - (NSDate *)hyb_dateAfterMonth:(NSUInteger)hyb_month { return [NSDate hyb_dateAfterDate:self month:hyb_month]; } + (NSDate *)hyb_dateAfterDate:(NSDate *)hyb_date month:(NSInteger)hyb_month { NSCalendar *calendar = [NSCalendar currentCalendar]; NSDateComponents *componentsToAdd = [[NSDateComponents alloc] init]; [componentsToAdd setMonth:hyb_month]; NSDate *dateAfterMonth = [calendar dateByAddingComponents:componentsToAdd toDate:hyb_date options:0]; return dateAfterMonth; } - (NSDate *)hyb_beginDayOfMonth { return [NSDate hyb_beginDayOfMonth:self]; } + (NSDate *)hyb_beginDayOfMonth:(NSDate *)hyb_date { return [self hyb_dateAfterDate:hyb_date day:-[hyb_date hyb_day] + 1]; } - (NSDate *)hyb_lastDayOfMonth { return [NSDate hyb_lastDayOfMonth:self]; } + (NSDate *)hyb_lastDayOfMonth:(NSDate *)hyb_date { NSDate *lastDate = [self hyb_beginDayOfMonth:hyb_date]; return [[lastDate hyb_dateAfterMonth:1] hyb_dateAfterDay:-1]; } - (NSUInteger)hyb_daysAgo { return [NSDate hyb_daysAgo:self]; } + (NSUInteger)hyb_daysAgo:(NSDate *)hyb_date { NSCalendar *calendar = [NSCalendar currentCalendar]; #if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_8_0 NSDateComponents *components = [calendar components:(NSCalendarUnitDay) fromDate:hyb_date toDate:[NSDate date] options:0]; #else NSDateComponents *components = [calendar components:(NSDayCalendarUnit) fromDate:hyb_date toDate:[NSDate date] options:0]; #endif return [components day]; } - (NSInteger)hyb_weekday { return [NSDate hyb_weekday:self]; } + (NSInteger)hyb_weekday:(NSDate *)hyb_date { NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; NSDateComponents *comps = [gregorian components:(NSCalendarUnitDay | NSCalendarUnitMonth | NSCalendarUnitYear | NSCalendarUnitWeekday) fromDate:hyb_date]; NSInteger weekday = [comps weekday]; return weekday; } - (NSString *)hyb_dayFromWeekday { return [NSDate hyb_dayFromWeekday:self]; } + (NSString *)hyb_dayFromWeekday:(NSDate *)hyb_date { switch([hyb_date hyb_weekday]) { case 1: return @"星期天"; break; case 2: return @"星期一"; break; case 3: return @"星期二"; break; case 4: return @"星期三"; break; case 5: return @"星期四"; break; case 6: return @"星期五"; break; case 7: return @"星期六"; break; default: break; } return @""; } - (BOOL)hyb_isSameDate:(NSDate *)hyb_anotherDate { NSCalendar *calendar = [NSCalendar currentCalendar]; NSDateComponents *components1 = [calendar components:(NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay) fromDate:self]; NSDateComponents *components2 = [calendar components:(NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay) fromDate:hyb_anotherDate]; return ([components1 year] == [components2 year] && [components1 month] == [components2 month] && [components1 day] == [components2 day]); } - (BOOL)hyb_isToday { return [self hyb_isSameDate:[NSDate date]]; } - (NSDate *)hyb_dateByAddingDays:(NSUInteger)hyb_days { NSDateComponents *c = [[NSDateComponents alloc] init]; c.day = hyb_days; return [[NSCalendar currentCalendar] dateByAddingComponents:c toDate:self options:0]; } /** * Get the month as a localized string from the given month number * * @param month The month to be converted in string * [1 - January] * [2 - February] * [3 - March] * [4 - April] * [5 - May] * [6 - June] * [7 - July] * [8 - August] * [9 - September] * [10 - October] * [11 - November] * [12 - December] * * @return Return the given month as a localized string */ + (NSString *)hyb_monthWithMonthNumber:(NSInteger)hyb_month { switch(hyb_month) { case 1: return @"January"; break; case 2: return @"February"; break; case 3: return @"March"; break; case 4: return @"April"; break; case 5: return @"May"; break; case 6: return @"June"; break; case 7: return @"July"; break; case 8: return @"August"; break; case 9: return @"September"; break; case 10: return @"October"; break; case 11: return @"November"; break; case 12: return @"December"; break; default: break; } return @""; } + (NSString *)hyb_stringWithDate:(NSDate *)hyb_date format:(NSString *)hyb_format { return [hyb_date hyb_stringWithFormat:hyb_format]; } - (NSString *)hyb_stringWithFormat:(NSString *)hyb_format { NSDateFormatter *outputFormatter = [[NSDateFormatter alloc] init]; [outputFormatter setDateFormat:hyb_format]; [outputFormatter setTimeZone:[NSTimeZone systemTimeZone]]; NSString *retStr = [outputFormatter stringFromDate:self]; return retStr; } + (NSDate *)hyb_dateWithString:(NSString *)hyb_string format:(NSString *)hyb_format { NSDateFormatter *inputFormatter = [[NSDateFormatter alloc] init]; [inputFormatter setDateFormat:hyb_format]; [inputFormatter setTimeZone:[NSTimeZone systemTimeZone]]; NSDate *date = [inputFormatter dateFromString:hyb_string]; return date; } - (NSUInteger)hyb_daysInMonth:(NSUInteger)hyb_month { return [NSDate hyb_daysInMonth:self month:hyb_month]; } + (NSUInteger)hyb_dayInYear:(NSUInteger)year month:(NSUInteger)month { switch (month) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: return 31; case 2: return [self hyb_isLeapYearWithYear:(int)year] ? 29 : 28; } return 30; } + (NSUInteger)hyb_daysInMonth:(NSDate *)hyb_date month:(NSUInteger)hyb_month { switch (hyb_month) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: return 31; case 2: return [hyb_date hyb_isLeapYear] ? 29 : 28; } return 30; } - (NSUInteger)hyb_daysInMonth { return [NSDate hyb_daysInMonth:self]; } + (NSUInteger)hyb_daysInMonth:(NSDate *)hyb_date { return [self hyb_daysInMonth:hyb_date month:[hyb_date hyb_month]]; } - (NSString *)hyb_timeInfo { return [NSDate hyb_timeInfoWithDate:self]; } + (NSString *)hyb_timeInfoWithDate:(NSDate *)hyb_date { return [self hyb_timeInfoWithDateString:[self hyb_stringWithDate:hyb_date format:[self hyb_ymdHmsFormat]]]; } + (NSString *)hyb_timeInfoWithDateString:(NSString *)hyb_dateString { NSDate *date = [self hyb_dateWithString:hyb_dateString format:[self hyb_ymdHmsFormat]]; NSDate *curDate = [NSDate date]; NSTimeInterval time = -[date timeIntervalSinceDate:curDate]; int month = (int)([curDate hyb_month] - [date hyb_month]); int year = (int)([curDate hyb_year] - [date hyb_year]); int day = (int)([curDate hyb_day] - [date hyb_day]); NSTimeInterval retTime = 1.0; if (time < 3600) { // 小于一小时 retTime = time / 60; retTime = retTime <= 0.0 ? 1.0 : retTime; return [NSString stringWithFormat:@"%.0f分钟前", retTime]; } else if (time < 3600 * 24) { // 小于一天,也就是今天 retTime = time / 3600; retTime = retTime <= 0.0 ? 1.0 : retTime; return [NSString stringWithFormat:@"%.0f小时前", retTime]; } else if (time < 3600 * 24 * 2) { return @"昨天"; } // 第一个条件是同年,且相隔时间在一个月内 // 第二个条件是隔年,对于隔年,只能是去年12月与今年1月这种情况 else if ((abs(year) == 0 && abs(month) <= 1) || (abs(year) == 1 && [curDate hyb_month] == 1 && [date hyb_month] == 12)) { int retDay = 0; if (year == 0) { // 同年 if (month == 0) { // 同月 retDay = day; } } if (retDay <= 0) { // 获取发布日期中,该月有多少天 int totalDays = (int)[self hyb_daysInMonth:date month:[date hyb_month]]; // 当前天数 + (发布日期月中的总天数-发布日期月中发布日,即等于距离今天的天数) retDay = (int)[curDate hyb_day] + (totalDays - (int)[date hyb_day]); } return [NSString stringWithFormat:@"%d天前", (abs)(retDay)]; } else { if (abs(year) <= 1) { if (year == 0) { // 同年 return [NSString stringWithFormat:@"%d个月前", abs(month)]; } // 隔年 int month = (int)[curDate hyb_month]; int preMonth = (int)[date hyb_month]; if (month == 12 && preMonth == 12) {// 隔年,但同月,就作为满一年来计算 return @"1年前"; } return [NSString stringWithFormat:@"%d个月前", (abs)(12 - preMonth + month)]; } return [NSString stringWithFormat:@"%d年前", abs(year)]; } return @"1小时前"; } - (NSString *)hyb_ymdFormat { return [NSDate hyb_ymdFormat]; } - (NSString *)hyb_hmsFormat { return [NSDate hyb_hmsFormat]; } - (NSString *)hyb_ymdHmsFormat { return [NSDate hyb_ymdHmsFormat]; } + (NSString *)hyb_ymdFormat { return @"yyyy-MM-dd"; } + (NSString *)hyb_hmsFormat { return @"HH:mm:ss"; } + (NSString *)hyb_ymdHmsFormat { return [NSString stringWithFormat:@"%@ %@", [self hyb_ymdFormat], [self hyb_hmsFormat]]; } - (NSDate *)hyb_offsetYears:(int)hyb_numYears { return [NSDate hyb_offsetYears:hyb_numYears fromDate:self]; } + (NSDate *)hyb_offsetYears:(int)hyb_numYears fromDate:(NSDate *)hyb_fromDate { if (hyb_fromDate == nil) { return nil; } #if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_8_0 // NSDayCalendarUnit NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; #else NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; #endif NSDateComponents *offsetComponents = [[NSDateComponents alloc] init]; [offsetComponents setYear:hyb_numYears]; return [gregorian dateByAddingComponents:offsetComponents toDate:hyb_fromDate options:0]; } - (NSDate *)hyb_offsetMonths:(int)hyb_numMonths { return [NSDate hyb_offsetMonths:hyb_numMonths fromDate:self]; } + (NSDate *)hyb_offsetMonths:(int)hyb_numMonths fromDate:(NSDate *)hyb_fromDate { if (hyb_fromDate == nil) { return nil; } #if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_8_0 // NSDayCalendarUnit NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; #else NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; #endif NSDateComponents *offsetComponents = [[NSDateComponents alloc] init]; [offsetComponents setMonth:hyb_numMonths]; return [gregorian dateByAddingComponents:offsetComponents toDate:hyb_fromDate options:0]; } - (NSDate *)hyb_offsetDays:(int)hyb_numDays { return [NSDate hyb_offsetDays:hyb_numDays fromDate:self]; } + (NSDate *)hyb_offsetDays:(int)hyb_numDays fromDate:(NSDate *)hyb_fromDate { if (hyb_fromDate == nil) { return nil; } #if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_8_0 // NSDayCalendarUnit NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; #else NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; #endif NSDateComponents *offsetComponents = [[NSDateComponents alloc] init]; [offsetComponents setDay:hyb_numDays]; return [gregorian dateByAddingComponents:offsetComponents toDate:hyb_fromDate options:0]; } - (NSDate *)hyb_offsetHours:(int)hyb_hours { return [NSDate hyb_offsetHours:hyb_hours fromDate:self]; } + (NSDate *)hyb_offsetHours:(int)hyb_numHours fromDate:(NSDate *)hyb_fromDate { if (hyb_fromDate == nil) { return nil; } #if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_8_0 // NSDayCalendarUnit NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; #else NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; #endif NSDateComponents *offsetComponents = [[NSDateComponents alloc] init]; [offsetComponents setHour:hyb_numHours]; return [gregorian dateByAddingComponents:offsetComponents toDate:hyb_fromDate options:0]; } + (NSDateComponents *)hyb_dateComponentsWithDate:(NSDate *)date { NSCalendar *calendar = nil; NSUInteger flags = 0; #if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_8_0 calendar = [NSCalendar calendarWithIdentifier:NSCalendarIdentifierGregorian]; flags = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond; #else calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; flags = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit; #endif [calendar setTimeZone:[NSTimeZone systemTimeZone]]; return [calendar components:flags fromDate:date]; } - (NSString *)hyb_toTimeStamp { return [NSString stringWithFormat:@"%lf", [self timeIntervalSince1970]]; } + (NSDate *)hyb_toDateWithTimeStamp:(NSString *)timeStamp { NSString *arg = timeStamp; if (![timeStamp isKindOfClass:[NSString class]]) { arg = [NSString stringWithFormat:@"%@", timeStamp]; } if (arg.length > 10) { arg = [arg substringToIndex:10]; } NSTimeInterval time = [arg doubleValue]; return [NSDate dateWithTimeIntervalSince1970:time]; } @end ================================================ FILE: HYBHelperKitSources/NSDictionary+HYBHelperKit.h ================================================ // // NSDictionary+HYBHelperKit.h // HYBHelperKit // // Created by huangyibiao on 16/6/29. // Copyright © 2016年 huangyibiao. All rights reserved. // #import @interface NSDictionary (HYBHelperKit) /** * @author https://github.com/CoderJackyHuang * * Get object from dictionary by key. * * @param key key * * @return object of key, or nil if key doesn't exist */ - (id)hyb_objectForKey:(id)key; /** * @author https://github.com/CoderJackyHuang * * Get int value from dictionary by key. * * @param key key * * @return int value of key, or zero if key doesn't exist */ - (int)hyb_intForKey:(id)key; /** * @author https://github.com/CoderJackyHuang * * Get double value from dictionary by key. * * @param key key * * @return double value of key, or zero if key doesn't exist */ - (double)hyb_doubleForKey:(id)key; /** * @author https://github.com/CoderJackyHuang * * Get float value from dictionary by key. * * @param key key * * @return float value of key, or zero if key doesn't exist */ - (float)hyb_floatForKey:(id)key; /** * @author https://github.com/CoderJackyHuang * * Get NSInteger value from dictionary by key. * * @param key key * * @return NSInteger value of key, or zero if key doesn't exist */ - (NSInteger)hyb_integerForKey:(id)key; /** * @author https://github.com/CoderJackyHuang * * Get NSString value from dictionary by key. * * @param key key * * @return NSString value of key, or nil if key doesn't exist */ - (NSString *)hyb_stringForKey:(id)key; /** * @author https://github.com/CoderJackyHuang * * Get NSDictionary value from dictionary by key. * * @param key key * * @return NSDictionary value of key, or nil if key doesn't exist */ - (NSDictionary *)hyb_dictionaryForKey:(id)key; /** * @author https://github.com/CoderJackyHuang * * Get NSArray value from dictionary by key. * * @param key key * * @return NSArray value of key, or nil if key doesn't exist */ - (NSArray *)hyb_arrayForKey:(id)key; /** * @author https://github.com/CoderJackyHuang * * Get NSNumber value from dictionary by key. * * @param key key * * @return NSNumber value of key, or nil if key doesn't exist */ - (NSNumber *)hyb_numberForKey:(id)key; /** * @author https://github.com/CoderJackyHuang * * Get BOOL value from dictionary by key. * * @param key key * * @return BOOL value of key, or false if key doesn't exist */ - (BOOL)hyb_boolForKey:(id)key; /** * @author https://github.com/CoderJackyHuang * * Get the unsigned long long value form dict by key. * * @param key The key * * @return unsigned long long value of key, or 0 if key doesn't exist. */ - (unsigned long long)hyb_unsignedLongLongValue:(id)key; @end ================================================ FILE: HYBHelperKitSources/NSDictionary+HYBHelperKit.m ================================================ // // NSDictionary+HYBHelperKit.m // HYBHelperKit // // Created by huangyibiao on 16/6/29. // Copyright © 2016年 huangyibiao. All rights reserved. // #import "NSDictionary+HYBHelperKit.h" #import "HYBCommonKit.h" @implementation NSDictionary (HYBHelperKit) - (id)hyb_objectForKey:(id)key { if (key == nil) { return nil; } return [self objectForKey:key]; } - (int)hyb_intForKey:(id)key { if (key == nil) { return 0; } NSNumber *number = [self hyb_numberForKey:key]; return [number intValue]; } - (double)hyb_doubleForKey:(id)key { if (key == nil) { return 0; } NSNumber *number = [self hyb_numberForKey:key]; return [number doubleValue]; } - (float)hyb_floatForKey:(id)key { if (key == nil) { return 0; } NSNumber *number = [self hyb_numberForKey:key]; return [number floatValue]; } - (NSInteger)hyb_integerForKey:(id)key { if (key == nil) { return 0; } NSNumber *number = [self hyb_numberForKey:key]; return [number integerValue]; } - (NSString *)hyb_stringForKey:(id)key { if (key == nil) { return 0; } id obj = [self hyb_objectForKey:key]; if ([obj isKindOfClass:[NSString class]]) { return (NSString *)obj; } else if ([obj isKindOfClass:[NSNumber class]]) { return [NSString stringWithFormat:@"%@", obj]; } return nil; } - (NSDictionary *)hyb_dictionaryForKey:(id)key { if (key == nil) { return 0; } id obj = [self hyb_objectForKey:key]; if ([obj isKindOfClass:[NSDictionary class]]) { return (NSDictionary *)obj; } return nil; } - (NSArray *)hyb_arrayForKey:(id)key { if (key == nil) { return 0; } id obj = [self hyb_objectForKey:key]; if ([obj isKindOfClass:[NSArray class]]) { return (NSArray *)obj; } return nil; } - (NSNumber *)hyb_numberForKey:(id)key { if (key == nil) { return 0; } id obj = [self hyb_objectForKey:key]; if ([obj isKindOfClass:[NSNumber class]]) { return (NSNumber *)obj; } return nil; } - (BOOL)hyb_boolForKey:(id)key { if (key == nil) { return NO; } id number = [self hyb_objectForKey:key]; if ([number respondsToSelector:@selector(boolValue)]) { return [number boolValue]; } return NO; } - (unsigned long long)hyb_unsignedLongLongValue:(id)key { if (key == nil) { return 0; } id number = [self hyb_objectForKey:key]; if ([number respondsToSelector:@selector(unsignedLongLongValue)]) { return [number unsignedLongLongValue]; } return 0; } @end ================================================ FILE: HYBHelperKitSources/NSFileManager+HYBHelperKit.h ================================================ // // NSFileManager+HYBHelperKit.h // HYBHelperKit // // Created by huangyibiao on 16/6/30. // Copyright © 2016年 huangyibiao. All rights reserved. // #import @interface NSFileManager (HYBHelperKit) /** * @author https://github.com/CoderJackyHuang * * Judge whether file at path exists and check time out or not. * * @param filePath The file absolute path * @param timeout The specified time out. * * @return NO if file exists and hasn't exceeded the specified time, otherwise YES. */ - (BOOL)hyb_isFileAtPath:(NSString *)filePath hasTimeOut:(NSTimeInterval)timeout; /** * @author https://github.com/CoderJackyHuang * * Get attributes of file at path. * * @param path The file path * * @return The file attributes if file exists, otherwise nil. */ - (NSDictionary *)hyb_fileAttributesAtPath:(NSString *)path; /** * @author https://github.com/CoderJackyHuang * * Get file size at path * * @param path The file path * * @return File real size at path, or 0 if file doesn't exist. */ - (unsigned long long)hyb_fileSizeAtPath:(NSString *)path; @end ================================================ FILE: HYBHelperKitSources/NSFileManager+HYBHelperKit.m ================================================ // // NSFileManager+HYBHelperKit.m // HYBHelperKit // // Created by huangyibiao on 16/6/30. // Copyright © 2016年 huangyibiao. All rights reserved. // #import "NSFileManager+HYBHelperKit.h" #import "NSDictionary+HYBHelperKit.h" @implementation NSFileManager (HYBHelperKit) - (BOOL)hyb_isFileAtPath:(NSString *)filePath hasTimeOut:(NSTimeInterval)timeout { if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) { NSError *error = nil; NSDictionary *attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:filePath error:&error]; if (error) { return YES; } if ([attributes isKindOfClass:[NSDictionary class]] && attributes) { NSString *createDate = [attributes objectForKey:@"NSFileModificationDate"]; createDate = [NSString stringWithFormat:@"%@", createDate]; if (createDate.length >= 19) { createDate = [createDate substringToIndex:19]; NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; formatter.dateFormat = @"yyyy-MM-dd HH:mm:ss"; NSDate *sinceDate = [formatter dateFromString:createDate]; NSTimeInterval interval = [[NSDate date] timeIntervalSinceDate:sinceDate]; BOOL isTimeOut = (long)interval > timeout; return isTimeOut; } } } return YES; } - (NSDictionary *)hyb_fileAttributesAtPath:(NSString *)path { NSError *error = nil; NSDictionary *attrs = [[NSFileManager defaultManager] attributesOfItemAtPath:path error:&error]; if (error) { return nil; } return attrs; } - (unsigned long long)hyb_fileSizeAtPath:(NSString *)path { NSDictionary *attrs = [self hyb_fileAttributesAtPath:path]; if (attrs == nil) { return 0; } return [attrs hyb_unsignedLongLongValue:NSFileSize]; } @end ================================================ FILE: HYBHelperKitSources/NSMutableArray+HYBHelperKit.h ================================================ // // NSMutableArray+HYBHelperKit.h // HYBHelperKit // // Created by huangyibiao on 16/6/29. // Copyright © 2016年 huangyibiao. All rights reserved. // #import @interface NSMutableArray (HYBHelperKit) /** * It is more safe to add object to the array. * * @param object The object to be added. * * @return YES if object can be added, otherwise NO. */ - (BOOL)hyb_addObject:(id)object; /** * It is more safe to insert object to the array. * * @param anObject The object to be inserted. * @param index Index. * * @return YES if inserted successfully, otherwise NO. */ - (BOOL)hyb_insertObject:(id)anObject atIndex:(NSUInteger)index; /** * It it safe to remove object from the array. * * @param index The index * * @return YES if remove successfully, otherwise NO. */ - (BOOL)hyb_removeObjectAtIndex:(NSUInteger)index; /** * Exchange double elements. * * @param fromIndex The index to move from * @param toIndex The index to move to * * @return YES if exchange successfully, otherwise NO. */ - (BOOL)hyb_exchangeObjectFromIndex:(NSUInteger)fromIndex toIndex:(NSUInteger)toIndex; @end ================================================ FILE: HYBHelperKitSources/NSMutableArray+HYBHelperKit.m ================================================ // // NSMutableArray+HYBHelperKit.m // HYBHelperKit // // Created by huangyibiao on 16/6/29. // Copyright © 2016年 huangyibiao. All rights reserved. // #import "NSMutableArray+HYBHelperKit.h" #import "NSArray+HYBHelperKit.h" @implementation NSMutableArray (HYBHelperKit) - (BOOL)hyb_addObject:(id)object { BOOL ret = NO; if (object) { ret = YES; [self addObject:object]; } return ret; } - (BOOL)hyb_insertObject:(id)anObject atIndex:(NSUInteger)index { if (anObject == nil|| index > [self count] ) { return NO; } if ([self containsObject:anObject]) { return NO; } [self insertObject:anObject atIndex:index]; return YES; } - (BOOL)hyb_removeObjectAtIndex:(NSUInteger)index { if (index >= [self count]) { return NO; } [self removeObjectAtIndex:index]; return YES; } - (BOOL)hyb_exchangeObjectFromIndex:(NSUInteger)fromIndex toIndex:(NSUInteger)toIndex { if ([self count] != 0 && toIndex != fromIndex && fromIndex < [self count] && toIndex < [self count]) { [self exchangeObjectAtIndex:fromIndex withObjectAtIndex:toIndex]; return YES; } return NO; } @end ================================================ FILE: HYBHelperKitSources/NSMutableDictionary+HYBHelperKit.h ================================================ // // NSMutableDictionary+HYBHelperKit.h // HYBHelperKit // // Created by huangyibiao on 16/6/29. // Copyright © 2016年 huangyibiao. All rights reserved. // #import @interface NSMutableDictionary (HYBHelperKit) /** * @author https://github.com/CoderJackyHuang * * It is safe to use it to set object for key. * * @param anObject Object to be set. * @param aKey The unique key of key-value * * @return YES if set object successfully, otherwise NO. */ - (BOOL)hyb_setObject:(id)anObject forKey:(id)aKey; /** * @author https://github.com/CoderJackyHuang * * It is safe to use it to set value for key. * * @param value Value to be set. * @param key The unique key of key-value. * * @return YES if set value successfully, otherwise NO. */ - (BOOL)hyb_setValue:(id)value forKey:(NSString *)key; @end ================================================ FILE: HYBHelperKitSources/NSMutableDictionary+HYBHelperKit.m ================================================ // // NSMutableDictionary+HYBHelperKit.m // HYBHelperKit // // Created by huangyibiao on 16/6/29. // Copyright © 2016年 huangyibiao. All rights reserved. // #import "NSMutableDictionary+HYBHelperKit.h" @implementation NSMutableDictionary (HYBHelperKit) - (BOOL)hyb_setObject:(id)anObject forKey:(id)aKey { if (aKey == nil || anObject == nil) { return NO; } [self setObject:anObject forKey:aKey]; return YES; } - (BOOL)hyb_setValue:(id)value forKey:(NSString *)key { if (key == nil || value == nil) { return NO; } [self setValue:value forKey:key]; return YES; } @end ================================================ FILE: HYBHelperKitSources/NSNumber+HYBHelperKit.h ================================================ // // NSNumber+HYBHelperKit.h // HYBHelperKit // // Created by huangyibiao on 16/7/13. // Copyright © 2016年 huangyibiao. All rights reserved. // #import @interface NSNumber (HYBHelperKit) /** * @author https://github.com/CoderJackyHuang * * Convert NSNumber object to a string object. * * @return A string. */ - (NSString *)hyb_toString; @end ================================================ FILE: HYBHelperKitSources/NSNumber+HYBHelperKit.m ================================================ // // NSNumber+HYBHelperKit.m // HYBHelperKit // // Created by huangyibiao on 16/7/13. // Copyright © 2016年 huangyibiao. All rights reserved. // #import "NSNumber+HYBHelperKit.h" @implementation NSNumber (HYBHelperKit) - (NSString *)hyb_toString { return [NSString stringWithFormat:@"%@", self]; } @end ================================================ FILE: HYBHelperKitSources/NSObject+HYBHelperKit.h ================================================ // // NSObject+HYBHelperKit.h // HYBHelperKit // // Created by huangyibiao on 16/6/29. // Copyright © 2016年 huangyibiao. All rights reserved. // #import #import @interface NSObject (HYBHelperKit) /** * Get the name of currnet object's class. */ - (NSString *)hyb_className; #pragma mark - Json to object and object to jason /** * Transform an object to json data. * * @param object Any kind of object. * * @return json data object if transform successfully, otherwise return nil. */ + (NSMutableData *)hyb_toJsonDataWithObject:(id)object; /** * Transform self to json data. * * @return json data if transform successfully, otherwise return nil. */ - (NSMutableData *)hyb_toJsonData; /** * Transform an object to json string. * * @param object Any kind of object * * @return json string if transform successfully, otherwise return nil. */ + (NSString *)hyb_toJsonStringWithObject:(id)object; /** * Transform self to json string. * * @return json string if transform successfully, otherwise return nil. */ - (NSString *)hyb_toJsonString; #pragma mark - Filter Null and nil /** * Filter all nil and null object. */ - (id)hyb_filterNullNil; /** * Filter all nil and null object. * * @param object The object to be filtered. */ + (id)hyb_filterNullNilFromObject:(id)object; @end ================================================ FILE: HYBHelperKitSources/NSObject+HYBHelperKit.m ================================================ // // NSObject+HYBHelperKit.m // HYBHelperKit // // Created by huangyibiao on 16/6/29. // Copyright © 2016年 huangyibiao. All rights reserved. // #import "NSObject+HYBHelperKit.h" @implementation NSObject (HYBHelperKit) - (NSString *)hyb_className { return NSStringFromClass([self class]); } - (NSMutableData *)hyb_toJsonData { return [NSObject hyb_toJsonDataWithObject:self]; } - (NSString *)hyb_toJsonString { return [NSObject hyb_toJsonStringWithObject:self]; } + (NSMutableData *)hyb_toJsonDataWithObject:(id)object { NSMutableData *jsonData = nil; if ([NSJSONSerialization isValidJSONObject:object]) { NSError *error = nil; NSData *data = [NSJSONSerialization dataWithJSONObject:object options:NSJSONWritingPrettyPrinted error:&error]; if (error) { NSLog(@"error: %@", error.description); } else { jsonData = [[NSMutableData alloc] initWithData:data]; } } return jsonData; } + (NSString *)hyb_toJsonStringWithObject:(id)object { NSMutableData *data = [self hyb_toJsonDataWithObject:object]; if (data.length) { return [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; } return nil; } - (id)hyb_filterNullNil { return [NSObject hyb_filterNullNilFromObject:self]; } + (id)hyb_filterNullNilFromObject:(id)object { if ([object isKindOfClass:[NSDictionary class]]) { return [self _removeNullNilFromDict:(NSDictionary *)object]; } else if ([object isKindOfClass:[NSArray class]]) { return [self _removeNullFromArray:(NSArray *)object]; } else if ([object isKindOfClass:[NSSet class]]) { return [self _removeNullFromSet:(NSSet *)object]; } else if ([object isKindOfClass:[NSNull class]] || object == nil) { return nil; } return object; } #pragma mark - Private + (NSDictionary *)_removeNullNilFromDict:(NSDictionary *)dict { if (dict == nil || [dict isKindOfClass:[NSNull class]]) { return nil; } NSMutableDictionary *resultDict = [NSMutableDictionary dictionaryWithCapacity:dict.count]; for (id key in dict.allKeys) { id object = [dict objectForKey:key]; if ([object isKindOfClass:[NSNull class]] || object == nil) { // 不添加 } else if ([object isKindOfClass:[NSDictionary class]]) { object = [self _removeNullNilFromDict:(NSDictionary *)object]; if (object != nil) { [resultDict setObject:object forKey:key]; } } else if ([object isKindOfClass:[NSArray class]]) { object = [self _removeNullFromArray:(NSArray *)object]; if (object != nil) { [resultDict setObject:object forKey:key]; } } else if ([object isKindOfClass:[NSSet class]]) { object = [self _removeNullFromSet:(NSSet *)object]; if (object != nil && ![object isKindOfClass:[NSNull class]]) { [resultDict setObject:object forKey:key]; } } else { [resultDict setObject:object forKey:key]; } } return resultDict; } + (NSArray *)_removeNullFromArray:(NSArray *)array { if (array == nil || [array isKindOfClass:[NSNull class]]) { return nil; } if (array.count == 0) { return array; } NSMutableArray *resultArray = [[NSMutableArray alloc] initWithCapacity:array.count]; for (NSUInteger i = 0; i < array.count; ++i) { id object = array[i]; if ([object isKindOfClass:[NSNull class]] || object == nil) { // 不添加 } else if ([object isKindOfClass:[NSDictionary class]]) { object = [self _removeNullNilFromDict:(NSDictionary *)object]; if (object != nil && ![object isKindOfClass:[NSNull class]]) { [resultArray addObject:object]; } } else if ([object isKindOfClass:[NSArray class]]) { object = [self _removeNullFromArray:(NSArray *)object]; if (object != nil && ![object isKindOfClass:[NSNull class]]) { [resultArray addObject:object]; } } else if ([object isKindOfClass:[NSSet class]]) { object = [self _removeNullFromSet:(NSSet *)object]; if (object != nil && ![object isKindOfClass:[NSNull class]]) { [resultArray addObject:object]; } } else { [resultArray addObject:object]; } } return resultArray; } + (NSSet *)_removeNullFromSet:(NSSet *)set { if (set == nil || [set isKindOfClass:[NSNull class]]) { return nil; } if (set.count == 0) { return set; } NSMutableSet *resultSet = [[NSMutableSet alloc] initWithCapacity:set.count]; [set enumerateObjectsUsingBlock:^(id _Nonnull obj, BOOL * _Nonnull stop) { id object = obj; if ([object isKindOfClass:[NSNull class]] || object == nil) { // 不添加 } else if ([object isKindOfClass:[NSDictionary class]]) { object = [self _removeNullNilFromDict:(NSDictionary *)object]; if (object != nil && ![object isKindOfClass:[NSNull class]]) { [resultSet addObject:object]; } } else if ([object isKindOfClass:[NSArray class]]) { object = [self _removeNullFromArray:(NSArray *)object]; if (object != nil && ![object isKindOfClass:[NSNull class]]) { [resultSet addObject:object]; } } else if ([object isKindOfClass:[NSSet class]]) { object = [self _removeNullFromSet:(NSSet *)object]; if (object != nil && ![object isKindOfClass:[NSNull class]]) { [resultSet addObject:object]; } } else { [resultSet addObject:object]; } }]; return resultSet; } @end ================================================ FILE: HYBHelperKitSources/NSString+HYBHelperKit.h ================================================ // // NSString+HYBHelperKit.h // HYBHelperKit // // Created by huangyibiao on 16/6/29. // Copyright © 2016年 huangyibiao. All rights reserved. // #import @interface NSString (HYBHelperKit) #pragma mark - Encrypt and decrypt /** * Convert the string to 32bit md5 string. * * @return 32bit md5 */ - (NSString *)hyb_toMD5; /** * Convert the string to 16bit md5 string. * * @return 16bit md5 */ - (NSString *)hyb_to16MD5; /** * Encrypt the string with sha1 argorithm. * * @return The sha1 string. */ - (NSString *)hyb_sha1; /** * Encrypt the string with sha256 argorithm. * * @return The sha256 string. */ - (NSString *)hyb_sha256; /** * Encrypt the string with sha512 argorithm. * * @return The sha512 string. */ - (NSString *)hyb_sha512; #pragma mark - Data convert to string or string to data. /** * Convert the current string to data. * * @return data object if convert successfully, otherwise nil. */ - (NSData *)hyb_toData; /** * Convert a data object to string. * * @param data The data will be converted. * * @return string object if convert successfully, otherwise nil. */ + (NSString *)hyb_toStringWithData:(NSData *)data; #pragma mark - Check email, phone, tel, or persion id. /** * Check whether the string is a valid kind of email format. * * @return YES if it is a valid format, otherwise false. */ - (BOOL)hyb_isEmail; /** * Check whether the string is a valid kind of email format. * * @param email The string to be checked. * * @return YES if it is a valid format, otherwise false. */ + (BOOL)hyb_isEmail:(NSString *)email; /** * Check whether the string is a valid kind of mobile phone format. * Now only check 11 numbers and begin with 1. * * @return YES if passed, otherwise false. */ - (BOOL)hyb_isMobilePhone; /** * Check whether the string is a valid kind of mobile phone format. * * @param phone The phone to be checked. * * @return YES if passed, otherwise false. */ + (BOOL)hyb_isMobilePhone:(NSString *)phone; /** * Check whether it is a valid kind of tel number format. * * @return YES if passed, otherwise false. */ - (BOOL)hyb_isTelNumber; /** * Check whether it is a valid kind of tel number format. * * @param telNumber The tel number to be checked. * * @return YES if passed, otherwise false. */ + (BOOL)hyb_isTelNumber:(NSString *)telNumber; /** * Check whether it is a valid kind of Chinese Persion ID * * @return YES if it is valid kind of PID, otherwise false. */ - (BOOL)hyb_isPersonID; /** * Check whether it is a valid kind of Chinese Persion ID * * @param PID The Chinese Persion ID to be checked. * * @return YES if it is valid kind of PID, otherwise false. */ + (BOOL)hyb_isPersonID:(NSString *)PID; #pragma mark - Trim Character /** * Trim the left blank space * * @return The new string without left blank space. */ - (NSString *)hyb_trimLeft; /** * Trim the right blank space * * @return The new string without right blank space. */ - (NSString *)hyb_trimRight; /** * Trim the left and the right blank space * * @return The new string without left and right blank space. */ - (NSString *)hyb_trim; /** * Trim all blank space in the string. * * @return The new string without blank space. */ - (NSString *)hyb_trimAll; /** * Trim letters. * * @return The new string without letters. */ - (NSString *)hyb_trimLetters; /** * Trim all the specified characters. * * @param character The character to be trimed. * * @return The new string without the specified character. */ - (NSString *)hyb_trimCharacter:(unichar)character; /** * Trim white space. * * @return The new string without white space. */ - (NSString *)hyb_trimWhitespace; /** * Trim all whitespace and new line. * * @return The new string without white space and new line. */ - (NSString *)hyb_trimWhitespaceAndNewLine; #pragma mark - Check letters, numbers or letter and numbers /** * Check whether it only contains letters. * * @return YES if only containing letters, otherwise NO. */ - (BOOL)hyb_isOnlyLetters; /** * Check whether it only contains digit numbers. * * @return YES if only containing digit numbers, otherwise NO. */ - (BOOL)hyb_isOnlyDigits; /** * Check whether it only contains letters and digit numbers. * * @return YES if only containing letters and digit numbers, otherwise NO. */ - (BOOL)hyb_isOnlyAlphaNumeric; #pragma mark - URL /** * Try to convert the string to a NSURL object. * * @return NSURL object if converts successfully, otherwise nil. */ - (NSURL *)hyb_toURL; /** * Try to do a url encode. * * @return Encoded string. */ - (NSString *)hyb_URLEncode; #pragma mark - HTML /** * Filter html tags in the string. * * @return A new string without html tags. */ - (NSString *)hyb_filterHtml; /** * Fileter html tags in the specified string. * * @param html The specified html string. * * @return A new string without html tags. */ + (NSString *)hyb_filterHTML:(NSString *)html; #pragma mark - Get document/tmp/Cache path /** * Get the absolute path of the document. * * @return Document path. */ + (NSString *)hyb_documentPath; /** * Get the absolute path of tmp * * @return Tmp path */ + (NSString *)hyb_tmpPath; /** * Get the absolute path of Cache. * * @return Cache absolute path */ + (NSString *)hyb_cachePath; #pragma mark - String operation /** * Check whether current string contains the substring. * * @param substring Substring * * @return YES if containing, otherwise NO. */ - (BOOL)hyb_isContainString:(NSString *)substring; @end ================================================ FILE: HYBHelperKitSources/NSString+HYBHelperKit.m ================================================ // // NSString+HYBHelperKit.m // HYBHelperKit // // Created by huangyibiao on 16/6/29. // Copyright © 2016年 huangyibiao. All rights reserved. // #import "NSString+HYBHelperKit.h" #import @implementation NSString (HYBHelperKit) - (NSString *)hyb_toMD5 { if (self == nil || [self length] == 0) { return nil; } unsigned char digest[CC_MD5_DIGEST_LENGTH], i; CC_MD5([self UTF8String], (int)[self lengthOfBytesUsingEncoding:NSUTF8StringEncoding], digest); NSMutableString *ms = [NSMutableString string]; for (i = 0; i < CC_MD5_DIGEST_LENGTH; i++) { [ms appendFormat:@"%02x", (int)(digest[i])]; } return [ms copy]; } - (NSString *)hyb_to16MD5 { if (self == nil || [self length] == 0) { return nil; } return [[self hyb_toMD5] substringWithRange:NSMakeRange(8, 16)]; } - (NSString *)hyb_sha1 { if (self == nil || [self length] == 0) { return nil; } unsigned char digest[CC_SHA1_DIGEST_LENGTH], i; CC_SHA1([self UTF8String], (int)[self lengthOfBytesUsingEncoding:NSUTF8StringEncoding], digest); NSMutableString *ms = [NSMutableString string]; for ( i = 0; i < CC_SHA1_DIGEST_LENGTH; i++) { [ms appendFormat:@"%02x", (int)(digest[i])]; } return [ms copy]; } - (NSString *)hyb_sha256 { if (self == nil || [self length] == 0) { return nil; } unsigned char digest[CC_SHA256_DIGEST_LENGTH], i; CC_SHA256([self UTF8String], (int)[self lengthOfBytesUsingEncoding:NSUTF8StringEncoding], digest); NSMutableString *ms = [NSMutableString string]; for (i = 0; i < CC_SHA256_DIGEST_LENGTH; i++) { [ms appendFormat: @"%02x", (int)(digest[i])]; } return [ms copy]; } - (NSString *)hyb_sha512 { if (self == nil || [self length] == 0) { return nil; } unsigned char digest[CC_SHA512_DIGEST_LENGTH], i; CC_SHA512([self UTF8String], (int)[self lengthOfBytesUsingEncoding:NSUTF8StringEncoding], digest); NSMutableString *ms = [NSMutableString string]; for (i = 0; i < CC_SHA512_DIGEST_LENGTH; i++) { [ms appendFormat: @"%02x", (int)(digest[i])]; } return [ms copy]; } - (NSData *)hyb_toData { return [self dataUsingEncoding:NSUTF8StringEncoding]; } + (NSString *)hyb_toStringWithData:(NSData *)data { if (data && [data isKindOfClass:[NSData class]]) { return [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; } return nil; } - (BOOL)hyb_isEmail { return [NSString hyb_isEmail:self]; } + (BOOL)hyb_isEmail:(NSString *)email { NSString *reg = @"(?:[a-z0-9!#$%\\&'*+/=?\\^_`{|}~-]+(?:\\.[a-z0-9!#$%\\&'*+/=?\\^_`{|}" @"~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\" @"x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-" @"z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5" @"]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-" @"9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21" @"-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])"; NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", reg]; return [predicate evaluateWithObject:[email lowercaseString]]; } - (BOOL)hyb_isMobilePhone { return [NSString hyb_isMobilePhone:self]; } + (BOOL)hyb_isMobilePhone:(NSString *)phone { NSString *pattern = @"^((13[0-9])|(15[^4,\\D])|(18[0,0-9])|(17[0,0-9]))\\d{8}$"; NSPredicate *mobilePredicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", pattern]; if ([mobilePredicate evaluateWithObject:phone]) { return YES; } return NO; } - (BOOL)hyb_isTelNumber { return [NSString hyb_isTelNumber:self]; } + (BOOL)hyb_isTelNumber:(NSString *)telNumber { NSString *pattern = @"^0(10|2[0-5789]|\\d{3})\\d{7,8}$"; NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", pattern]; return [predicate evaluateWithObject:telNumber]; } - (BOOL)hyb_isPersonID { return [NSString hyb_isPersonID:self]; } + (BOOL)hyb_isPersonID:(NSString *)PID { // 判断位数 if (PID.length != 15 && PID.length != 18) { return NO; } NSString *carid = PID; long lSumQT = 0; // 加权因子 int R[] ={7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2 }; // 校验码 unsigned char sChecker[11]={'1','0','X', '9', '8', '7', '6', '5', '4', '3', '2'}; // 将15位身份证号转换成18位 NSMutableString *mString = [NSMutableString stringWithString:PID]; if (PID.length == 15) { [mString insertString:@"19" atIndex:6]; long p = 0; const char *pid = [mString UTF8String]; for (int i = 0; i<= 16; i++) { p += (pid[i] - 48) * R[i]; } int o = p % 11; NSString *string_content = [NSString stringWithFormat:@"%c", sChecker[o]]; [mString insertString:string_content atIndex:[mString length]]; carid = mString; } // 判断地区码 NSString * sProvince = [carid substringToIndex:2]; if (![self _areaCode:sProvince]) { return NO; } // 判断年月日是否有效 // 年份 int strYear = [[self _substringWithString:carid begin:6 end:4] intValue]; // 月份 int strMonth = [[self _substringWithString:carid begin:10 end:2] intValue]; // 日 int strDay = [[self _substringWithString:carid begin:12 end:2] intValue]; NSTimeZone *localZone = [NSTimeZone localTimeZone]; NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateStyle:NSDateFormatterMediumStyle]; [dateFormatter setTimeStyle:NSDateFormatterNoStyle]; [dateFormatter setTimeZone:localZone]; [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; NSDate *date = [dateFormatter dateFromString:[NSString stringWithFormat:@"%d-%d-%d 12:01:01", strYear, strMonth, strDay]]; if (date == nil) { return NO; } const char *PaperId = [carid UTF8String]; // 检验长度 if(18 != strlen(PaperId)) return NO; // 校验数字 for (int i = 0; i < 18; i++) { if ( !isdigit(PaperId[i]) && !(('X' == PaperId[i] || 'x' == PaperId[i]) && 17 == i) ) { return NO; } } // 验证最末的校验码 for (int i=0; i<=16; i++) { lSumQT += (PaperId[i]-48) * R[i]; } if (sChecker[lSumQT%11] != PaperId[17] ) { return NO; } return YES; } - (NSString *)hyb_trimLeft { NSInteger len = 0; while (len < self.length) { if ([self characterAtIndex:len] != ' ') { break; } len++; } if (len >= self.length) { len = self.length - 1; } if (len <= 0) { return self; } return [self substringFromIndex:len]; } - (NSString *)hyb_trimRight { NSInteger index = self.length - 1; for (NSInteger i = self.length - 1; i >= 0; --i) { if ([self characterAtIndex:i] != ' ') { break; } else { index--; } } if (index + 1 < self.length) { index++; } if (index + 1 >= self.length) { return self; } return [self substringToIndex:index]; } - (NSString *)hyb_trim { NSString *str = [self hyb_trimLeft]; return [str hyb_trimRight]; } - (NSString *)hyb_trimAll { return [self stringByReplacingOccurrencesOfString:@" " withString:@""]; } - (NSString *)hyb_trimLetters { return [self stringByTrimmingCharactersInSet:[NSCharacterSet letterCharacterSet]]; } - (NSString *)hyb_trimCharacter:(unichar)character { NSString *str = [NSString stringWithFormat:@"%c", character]; return [self stringByReplacingOccurrencesOfString:str withString:@""]; } - (NSString *)hyb_trimWhitespace { return [self stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; } - (NSString *)hyb_trimWhitespaceAndNewLine { return [self stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; } - (BOOL)hyb_isOnlyLetters { NSCharacterSet *letterCharacterset = [[NSCharacterSet letterCharacterSet] invertedSet]; return ([self rangeOfCharacterFromSet:letterCharacterset].location == NSNotFound); } - (BOOL)hyb_isOnlyDigits { NSCharacterSet *numSet = [[NSCharacterSet characterSetWithCharactersInString:@"0123456789"] invertedSet]; return ([self rangeOfCharacterFromSet:numSet].location == NSNotFound); } - (BOOL)hyb_isOnlyAlphaNumeric { NSCharacterSet *numAndLetterCharSet = [[NSCharacterSet alphanumericCharacterSet] invertedSet]; return ([self rangeOfCharacterFromSet:numAndLetterCharSet].location == NSNotFound); } - (NSURL *)hyb_toURL { return [NSURL URLWithString:self]; } - (NSString *)hyb_URLEncode { NSString *result = CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)self, NULL, CFSTR("!*'();:@&;=+$,/?%#[] "), kCFStringEncodingUTF8)); return result; } - (NSString *)hyb_filterHtml { return [NSString hyb_filterHTML:self]; } + (NSString *)hyb_filterHTML:(NSString *)html { if (html == nil) { return nil; } NSScanner *scanner = [NSScanner scannerWithString:html]; NSString *text = nil; while ([scanner isAtEnd] == NO) { [scanner scanUpToString:@"<" intoString:nil]; [scanner scanUpToString:@">" intoString:&text]; html = [html stringByReplacingOccurrencesOfString:[NSString stringWithFormat:@"%@>",text] withString:@""]; } return html; } + (NSString *)hyb_documentPath { return [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"]; } + (NSString *)hyb_tmpPath { return [NSHomeDirectory() stringByAppendingPathComponent:@"tmp"]; } + (NSString *)hyb_cachePath { return [NSHomeDirectory() stringByAppendingPathComponent:@"Library/Caches"]; } - (BOOL)hyb_isContainString:(NSString *)substring { return [self rangeOfString:substring].location != NSNotFound; } #pragma mark - Private /** * 功能:判断是否在地区码内 * 参数:地区码 */ + (BOOL)_areaCode:(NSString *)code { NSMutableDictionary *dic = [[NSMutableDictionary alloc] init]; [dic setObject:@"北京" forKey:@"11"]; [dic setObject:@"天津" forKey:@"12"]; [dic setObject:@"河北" forKey:@"13"]; [dic setObject:@"山西" forKey:@"14"]; [dic setObject:@"内蒙古" forKey:@"15"]; [dic setObject:@"辽宁" forKey:@"21"]; [dic setObject:@"吉林" forKey:@"22"]; [dic setObject:@"黑龙江" forKey:@"23"]; [dic setObject:@"上海" forKey:@"31"]; [dic setObject:@"江苏" forKey:@"32"]; [dic setObject:@"浙江" forKey:@"33"]; [dic setObject:@"安徽" forKey:@"34"]; [dic setObject:@"福建" forKey:@"35"]; [dic setObject:@"江西" forKey:@"36"]; [dic setObject:@"山东" forKey:@"37"]; [dic setObject:@"河南" forKey:@"41"]; [dic setObject:@"湖北" forKey:@"42"]; [dic setObject:@"湖南" forKey:@"43"]; [dic setObject:@"广东" forKey:@"44"]; [dic setObject:@"广西" forKey:@"45"]; [dic setObject:@"海南" forKey:@"46"]; [dic setObject:@"重庆" forKey:@"50"]; [dic setObject:@"四川" forKey:@"51"]; [dic setObject:@"贵州" forKey:@"52"]; [dic setObject:@"云南" forKey:@"53"]; [dic setObject:@"西藏" forKey:@"54"]; [dic setObject:@"陕西" forKey:@"61"]; [dic setObject:@"甘肃" forKey:@"62"]; [dic setObject:@"青海" forKey:@"63"]; [dic setObject:@"宁夏" forKey:@"64"]; [dic setObject:@"新疆" forKey:@"65"]; [dic setObject:@"台湾" forKey:@"71"]; [dic setObject:@"香港" forKey:@"81"]; [dic setObject:@"澳门" forKey:@"82"]; [dic setObject:@"国外" forKey:@"91"]; if ([dic objectForKey:code] == nil) { return NO; } return YES; } + (NSString *)_substringWithString:(NSString *)str begin:(NSInteger)begin end:(NSInteger )end { return [str substringWithRange:NSMakeRange(begin, end)]; } @end ================================================ FILE: HYBHelperKitSources/NSTimer+HYBHelperKit.h ================================================ // // NSTimer+HYBHelperKit.h // HYBHelperKit // // Created by huangyibiao on 16/6/29. // Copyright © 2016年 huangyibiao. All rights reserved. // #import typedef void(^HYBTimerCallback)(NSTimer *timer); @interface NSTimer (HYBHelperKit) /** * Create a timer with time interval, repeat or not, and callback. * * @param interval Time interval * @param repeats Whether repeat to schedule. * @param callback The callback block. * * @return Timer object. */ + (NSTimer *)hyb_scheduledTimerWithTimeInterval:(NSTimeInterval)interval repeats:(BOOL)repeats callback:(HYBTimerCallback)callback; /** * Create a timer with time interval, repeat count, and callback. * * @param interval Time interval * @param count When count <= 0, it means repeat. * @param callback The callback block * * @return Timer object */ + (NSTimer *)hyb_scheduledTimerWithTimeInterval:(NSTimeInterval)interval count:(NSInteger)count callback:(HYBTimerCallback)callback; /** * Start timer immediately. */ - (void)hyb_fireTimer; /** * Pause timer immediately */ - (void)hyb_unfireTimer; /** * Make timer invalidate. */ - (void)hyb_invalidate; @end ================================================ FILE: HYBHelperKitSources/NSTimer+HYBHelperKit.m ================================================ // // NSTimer+HYBHelperKit.m // HYBHelperKit // // Created by huangyibiao on 16/6/29. // Copyright © 2016年 huangyibiao. All rights reserved. // #import "NSTimer+HYBHelperKit.h" #import static const void *s_hyb_private_currentCountTime = "s_hyb_private_currentCountTime"; @implementation NSTimer (HYBHelperKit) - (NSNumber *)hyb_private_currentCountTime { NSNumber *obj = objc_getAssociatedObject(self, s_hyb_private_currentCountTime); if (obj == nil) { obj = @(0); [self setHyb_private_currentCountTime:obj]; } return obj; } - (void)setHyb_private_currentCountTime:(NSNumber *)time { objc_setAssociatedObject(self, s_hyb_private_currentCountTime, time, OBJC_ASSOCIATION_RETAIN_NONATOMIC); } + (NSTimer *)hyb_scheduledTimerWithTimeInterval:(NSTimeInterval)interval count:(NSInteger)count callback:(HYBTimerCallback)callback { if (count <= 0) { return [self hyb_scheduledTimerWithTimeInterval:interval repeats:YES callback:callback]; } NSDictionary *userInfo = @{@"callback" : callback, @"count" : @(count)}; return [NSTimer scheduledTimerWithTimeInterval:interval target:self selector:@selector(hyb_onTimerUpdateCountBlock:) userInfo:userInfo repeats:YES]; } + (NSTimer *)hyb_scheduledTimerWithTimeInterval:(NSTimeInterval)interval repeats:(BOOL)repeats callback:(HYBTimerCallback)callback { return [NSTimer scheduledTimerWithTimeInterval:interval target:self selector:@selector(hyb_onTimerUpdateBlock:) userInfo:callback repeats:repeats]; } - (void)hyb_fireTimer { [self setFireDate:[NSDate distantPast]]; } - (void)hyb_unfireTimer { [self setFireDate:[NSDate distantFuture]]; } - (void)hyb_invalidate { if (self.isValid) { [self invalidate]; } } #pragma mark - Private + (void)hyb_onTimerUpdateBlock:(NSTimer *)timer { HYBTimerCallback block = timer.userInfo; if (block) { block(timer); } } + (void)hyb_onTimerUpdateCountBlock:(NSTimer *)timer { NSInteger currentCount = [[timer hyb_private_currentCountTime] integerValue]; NSDictionary *userInfo = timer.userInfo; HYBTimerCallback callback = userInfo[@"callback"]; NSNumber *count = userInfo[@"count"]; if (currentCount < count.integerValue) { currentCount++; [timer setHyb_private_currentCountTime:@(currentCount)]; if (callback) { callback(timer); } } else { currentCount = 0; [timer setHyb_private_currentCountTime:@(currentCount)]; [timer hyb_unfireTimer]; [timer hyb_invalidate]; } } @end ================================================ FILE: HYBHelperKitSources/NSUserDefaults+HYBHelperKit.h ================================================ // // NSUserDefaults+HYBHelperKit.h // HYBHelperKit // // Created by huangyibiao on 16/6/29. // Copyright © 2016年 huangyibiao. All rights reserved. // #import @interface NSUserDefaults (HYBHelperKit) /** * Set safe object to the user defaults, it will filter all nil or Null object, * to prevent app crashing. * * @param value The object to be saved. * @param key The only key. */ - (BOOL)hyb_setSafeObject:(id)value forKey:(NSString *)key; @end ================================================ FILE: HYBHelperKitSources/NSUserDefaults+HYBHelperKit.m ================================================ // // NSUserDefaults+HYBHelperKit.m // HYBHelperKit // // Created by huangyibiao on 16/6/29. // Copyright © 2016年 huangyibiao. All rights reserved. // #import "NSUserDefaults+HYBHelperKit.h" #import "NSObject+HYBHelperKit.h" @implementation NSUserDefaults (HYBHelperKit) - (BOOL)hyb_setSafeObject:(id)value forKey:(NSString *)key { if (key == nil) { return NO; } if (value == nil || [value isKindOfClass:[NSNull class]]) { [self removeObjectForKey:key]; return YES; } if ([value isKindOfClass:[NSString class]] || [value isKindOfClass:[NSNumber class]]) { [self setObject:value forKey:key]; [self synchronize]; return YES; } else { id result = [value hyb_filterNullNil]; if (result) { [self setObject:result forKey:key]; [self synchronize]; return YES; } } return NO; } @end ================================================ FILE: HYBHelperKitSources/UIActionSheet+HYBHelperKit.h ================================================ // // UIActionSheet+HYBHelperKit.h // HYBHelperKit // // Created by huangyibiao on 16/7/15. // Copyright © 2016年 huangyibiao. All rights reserved. // #import typedef void(^HYBActionSheetClickedButtonBlock)(UIActionSheet *actionSheet, NSUInteger buttonIndex); @interface UIActionSheet (HYBHelperKit) /** * @author https://github.com/CoderJackyHuang * * The action sheet callback block */ @property (nonatomic, copy) HYBActionSheetClickedButtonBlock hyb_clickedButtonBlock; /** * @author https://github.com/CoderJackyHuang * * Show an action sheet in the view with a title, cancel button title, * destructive title and other button titles. * * @param inView Which view show the action sheet. * @param title The action sheet's title. * @param cancelTitle The cancel button's title. * @param destructiveTitle The destructive button title. * @param otherTitles Other buton titles. * @param callback The callback block * * @return The UIActionSheet instance. */ + (instancetype)hyb_showInView:(UIView *)inView title:(NSString *)title cancelTitle:(NSString *)cancelTitle destructiveTitle:(NSString *)destructiveTitle otherTitles:(NSArray *)otherTitles callback:(HYBActionSheetClickedButtonBlock)callback; @end ================================================ FILE: HYBHelperKitSources/UIActionSheet+HYBHelperKit.m ================================================ // // UIActionSheet+HYBHelperKit.m // HYBHelperKit // // Created by huangyibiao on 16/7/15. // Copyright © 2016年 huangyibiao. All rights reserved. // #import "UIActionSheet+HYBHelperKit.h" #import #import "NSArray+HYBHelperKit.h" @interface UIApplication (HDFActionSheet) @end @implementation UIApplication (HDFActionSheet) - (void)actionSheet:(nonnull UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { if (actionSheet.hyb_clickedButtonBlock) { actionSheet.hyb_clickedButtonBlock(actionSheet, buttonIndex); } } @end static const void *s_HdfActionSheetClickedButtonBlock = "s_HdfActionSheetClickedButtonBlock"; @implementation UIActionSheet (HYBHelperKit) - (void)setHyb_clickedButtonBlock:(HYBActionSheetClickedButtonBlock)hyb_clickedButtonBlock { objc_setAssociatedObject(self, s_HdfActionSheetClickedButtonBlock, hyb_clickedButtonBlock, OBJC_ASSOCIATION_COPY_NONATOMIC); } - (HYBActionSheetClickedButtonBlock)hyb_clickedButtonBlock { return objc_getAssociatedObject(self, s_HdfActionSheetClickedButtonBlock); } + (instancetype)hyb_showInView:(UIView *)inView title:(NSString *)title cancelTitle:(NSString *)cancelTitle destructiveTitle:(NSString *)destructiveTitle otherTitles:(NSArray *)otherTitles callback:(HYBActionSheetClickedButtonBlock)callback { UIActionSheet *as = [[UIActionSheet alloc] initWithTitle:title delegate:[UIApplication sharedApplication] cancelButtonTitle:cancelTitle destructiveButtonTitle:destructiveTitle otherButtonTitles: [otherTitles hyb_objectAtIndex:0], [otherTitles hyb_objectAtIndex:1], [otherTitles hyb_objectAtIndex:2], [otherTitles hyb_objectAtIndex:3], [otherTitles hyb_objectAtIndex:4], [otherTitles hyb_objectAtIndex:5], [otherTitles hyb_objectAtIndex:6], [otherTitles hyb_objectAtIndex:7], [otherTitles hyb_objectAtIndex:8], [otherTitles hyb_objectAtIndex:9], [otherTitles hyb_objectAtIndex:10], [otherTitles hyb_objectAtIndex:11], [otherTitles hyb_objectAtIndex:12], [otherTitles hyb_objectAtIndex:13], [otherTitles hyb_objectAtIndex:14], [otherTitles hyb_objectAtIndex:15], [otherTitles hyb_objectAtIndex:16], [otherTitles hyb_objectAtIndex:17], [otherTitles hyb_objectAtIndex:18], [otherTitles hyb_objectAtIndex:19], [otherTitles hyb_objectAtIndex:20], [otherTitles hyb_objectAtIndex:21], [otherTitles hyb_objectAtIndex:22], [otherTitles hyb_objectAtIndex:23], [otherTitles hyb_objectAtIndex:24], [otherTitles hyb_objectAtIndex:25], [otherTitles hyb_objectAtIndex:26], [otherTitles hyb_objectAtIndex:27], [otherTitles hyb_objectAtIndex:28], [otherTitles hyb_objectAtIndex:29],nil]; as.hyb_clickedButtonBlock = callback; [as showInView:inView]; return as; } @end ================================================ FILE: HYBHelperKitSources/UIAlertView+HYBHelperKit.h ================================================ // // UIAlertView+HYBHelperKit.h // HYBHelperKit // // Created by huangyibiao on 16/7/15. // Copyright © 2016年 huangyibiao. All rights reserved. // #import typedef void(^HYBAlertClickedButtonBlock)(UIAlertView *alertView, NSUInteger buttonIndex); @interface UIAlertView (HYBHelperKit) /** * @author https://github.com/CoderJackyHuang * * The action callback block */ @property (nonatomic, copy) HYBAlertClickedButtonBlock hyb_clickedButtonBlock; /** * @author https://github.com/CoderJackyHuang * * Show an alert view with a title, message and button titles. * * @param title Title * @param message The content message * @param buttonTitles The buttion titles array. * @param block The callbac when clicked. * * @return The UIAlertView instance. */ + (instancetype)hyb_showWithTitle:(NSString *)title message:(NSString *)message buttonTitles:(NSArray *)buttonTitles block:(HYBAlertClickedButtonBlock)block; @end ================================================ FILE: HYBHelperKitSources/UIAlertView+HYBHelperKit.m ================================================ // // UIAlertView+HYBHelperKit.m // HYBHelperKit // // Created by huangyibiao on 16/7/15. // Copyright © 2016年 huangyibiao. All rights reserved. // #import "UIAlertView+HYBHelperKit.h" #import #import "HYBCommonKit.h" #import "NSArray+HYBHelperKit.h" static const void *s_privateAlertViewKey = "s_privateAlertViewKey"; @interface UIApplication (HDFAlertView) @end @implementation UIApplication (HDFAlertView) #pragma mark - UIAlertViewDelegate - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { if (alertView.hyb_clickedButtonBlock) { alertView.hyb_clickedButtonBlock(alertView, buttonIndex); } } @end @implementation UIAlertView (HYBHelperKit) - (void)setHyb_clickedButtonBlock:(HYBAlertClickedButtonBlock)clickedButtonBlock { objc_setAssociatedObject(self, s_privateAlertViewKey, clickedButtonBlock, OBJC_ASSOCIATION_COPY); } - (HYBAlertClickedButtonBlock)hyb_clickedButtonBlock { return objc_getAssociatedObject(self, s_privateAlertViewKey); } + (instancetype)hyb_showWithTitle:(NSString *)title message:(NSString *)message buttonTitles:(NSArray *)buttonTitles block:(HYBAlertClickedButtonBlock)block { NSString *ok = nil; if (kIsArray(buttonTitles) && buttonTitles.count > 0) { ok = [buttonTitles hyb_objectAtIndex:0]; } UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:title message:message delegate:[UIApplication sharedApplication] cancelButtonTitle:ok otherButtonTitles: [buttonTitles hyb_objectAtIndex:1], [buttonTitles hyb_objectAtIndex:2], [buttonTitles hyb_objectAtIndex:3], [buttonTitles hyb_objectAtIndex:4], [buttonTitles hyb_objectAtIndex:5], [buttonTitles hyb_objectAtIndex:6], [buttonTitles hyb_objectAtIndex:7], [buttonTitles hyb_objectAtIndex:8], [buttonTitles hyb_objectAtIndex:9], [buttonTitles hyb_objectAtIndex:10], [buttonTitles hyb_objectAtIndex:11], [buttonTitles hyb_objectAtIndex:12], [buttonTitles hyb_objectAtIndex:13], [buttonTitles hyb_objectAtIndex:14], nil]; alertView.hyb_clickedButtonBlock = block; [alertView show]; return alertView; } @end ================================================ FILE: HYBHelperKitSources/UIButton+HYBHelperBlockKit.h ================================================ // // UIButton+HYBHelperBlockKit.h // HYBHelperKit // // Created by huangyibiao on 16/6/30. // Copyright © 2016年 huangyibiao. All rights reserved. // #import #import "HYBHelperBlocksKit.h" #import "HYBCommonKit.h" @interface UIButton (HYBHelperBlockKit) /** * @author https://github.com/CoderJackyHuang * * The most easy way to create a button with a touch up event callback block. * * @param onTouchUp The touch up event callback block. * * @return UIButton instance. */ + (instancetype)hyb_buttonWithTouchUp:(HYBButtonBlock)onTouchUp; /** * @author https://github.com/CoderJackyHuang * * Create a button with super view, masonry auto layout, and touch up callback. * * @param superView Add the button to the superView. * @param constraints Using Masonry to add constraints. * @param touchUp The callback of touching up event. * * @return UIButton instance. */ + (instancetype)hyb_buttonWithSuperView:(UIView *)superView constraints:(HYBConstraintMaker)constraints touchUp:(HYBButtonBlock)touchUp; /** * @author https://github.com/CoderJackyHuang * * Create a button with title, super view, masonry auto layout, and touch up callback. * * @param title Set title for the button. * @param superView Add the button to the superView. * @param constraints Using Masonry to add constraints. * @param touchUp The callback of touching up event. * * @return UIButton instance. */ + (instancetype)hyb_buttonWithTitle:(NSString *)title superView:(UIView *)superView constraints:(HYBConstraintMaker)constraints touchUp:(HYBButtonBlock)touchUp; /** * @author https://github.com/CoderJackyHuang * * Create a button with image, super view, masonry auto layout, and touch up callback. * * @param image Set normal state image for the button, it can be * a image name or a real UIImage. * @param superView Add the button to the superView. * @param constraints Using Masonry to add constraints. * @param touchUp The callback of touching up event. * * @return UIButton instance. */ + (instancetype)hyb_buttonWithImage:(id)image superView:(UIView *)superView constraints:(HYBConstraintMaker)constraints touchUp:(HYBButtonBlock)touchUp; /** * @author https://github.com/CoderJackyHuang * * Create a button with normal image, selected image, super view, * masonry auto layout, and touch up callback. * * @param image Set normal state image for the button, it can be * a image name or a real UIImage. * @param selectedImage Set selected state image for the button, it can be * a image name or a real UIImage. * @param superView Add the button to the superView. * @param constraints Using Masonry to add constraints. * @param touchUp The callback of touching up event. * * @return UIButton instance. */ + (instancetype)hyb_buttonWithImage:(id)image selectedImage:(id)selectedImage superView:(UIView *)superView constraints:(HYBConstraintMaker)constraints touchUp:(HYBButtonBlock)touchUp; @end ================================================ FILE: HYBHelperKitSources/UIButton+HYBHelperBlockKit.m ================================================ // // UIButton+HYBHelperBlockKit.m // HYBHelperKit // // Created by huangyibiao on 16/6/30. // Copyright © 2016年 huangyibiao. All rights reserved. // #import "UIButton+HYBHelperBlockKit.h" @implementation UIButton (HYBHelperBlockKit) + (instancetype)hyb_buttonWithTouchUp:(HYBButtonBlock)onTouchUp { return [self hyb_buttonWithSuperView:nil constraints:nil touchUp:onTouchUp]; } + (instancetype)hyb_buttonWithSuperView:(UIView *)superView constraints:(HYBConstraintMaker)constraints touchUp:(HYBButtonBlock)touchUp { return [self hyb_buttonWithTitle:nil superView:superView constraints:constraints touchUp:touchUp]; } + (instancetype)hyb_buttonWithTitle:(NSString *)title superView:(UIView *)superView constraints:(HYBConstraintMaker)constraints touchUp:(HYBButtonBlock)touchUp { return [self private_hyb_buttonWithTitle:title image:nil selImage:nil superView:superView constraints:constraints touchUp:touchUp]; } + (instancetype)hyb_buttonWithImage:(id)image superView:(UIView *)superView constraints:(HYBConstraintMaker)constraints touchUp:(HYBButtonBlock)touchUp { return [self hyb_buttonWithImage:image selectedImage:nil superView:superView constraints:constraints touchUp:touchUp]; } + (instancetype)hyb_buttonWithImage:(id)image selectedImage:(id)selectedImage superView:(UIView *)superView constraints:(HYBConstraintMaker)constraints touchUp:(HYBButtonBlock)touchUp { return [self private_hyb_buttonWithTitle:nil image:image selImage:selectedImage superView:superView constraints:constraints touchUp:touchUp]; } #pragma mark - Private + (instancetype)private_hyb_buttonWithTitle:(NSString *)title image:(id)image selImage:(id)selImage superView:(UIView *)superView constraints:(HYBConstraintMaker)constaints touchUp:(HYBButtonBlock)touchUp { UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; button.hyb_onTouchUp = touchUp; if (!kIsEmptyString(title)) { [button setTitle:title forState:UIControlStateNormal]; } UIImage *normalImage = nil; if ([image isKindOfClass:[NSString class]]) { normalImage = kImage(image); } else if ([image isKindOfClass:[UIImage class]]) { normalImage = image; } UIImage *selectedImage = nil; if ([selImage isKindOfClass:[NSString class]]) { selectedImage = kImage(selImage); } else if ([selImage isKindOfClass:[UIImage class]]) { selectedImage = selImage; } if (normalImage) { [button setImage:normalImage forState:UIControlStateNormal]; } if (selectedImage) { [button setImage:selectedImage forState:UIControlStateSelected]; } [superView addSubview:button]; if (superView && constaints) { [button mas_makeConstraints:^(MASConstraintMaker *make) { constaints(make); }]; } return button; } @end ================================================ FILE: HYBHelperKitSources/UICollectionView+HYBMaonsryKit.h ================================================ // // UICollectionView+HYBMaonsryKit.h // HYBHelperKit // // Created by huangyibiao on 16/7/7. // Copyright © 2016年 huangyibiao. All rights reserved. // #import #import "HYBHelperKit.h" @interface UICollectionView (HYBMaonsryKit) /** * @author https://github.com/CoderJackyHuang * * Create a colellection view with flow layout, scroll horizontal or vertical, * set item size, delegate, data source, item spacing and line spacing and so on. * * When super view is not nil, it will be automatically added constraints with edges of * super view. * * @param delegate Delegate and data source. * @param isHorizontal @see UICollectionViewScrollDirection * @param superView The super view of collection view. * * @return The instance of UICollectionView. */ + (instancetype)hyb_collectionViewWithDelegate:(id)delegate horizontal:(BOOL)isHorizontal superView:(UIView *)superView; /** * @author https://github.com/CoderJackyHuang * * Create a colellection view with flow layout, scroll horizontal or vertical, * set item size, delegate, data source, item spacing and line spacing and so on. * * When super view is not nil, it will be automatically added constraints with edges of * super view. * * @param delegate Delegate and data source. * @param isHorizontal @see UICollectionViewScrollDirection * @param itemSize The size of collection view cell. * @param superView The super view of collection view. * * @return The instance of UICollectionView. */ + (instancetype)hyb_collectionViewWithDelegate:(id)delegate horizontal:(BOOL)isHorizontal size:(CGSize)itemSize superView:(UIView *)superView; /** * @author https://github.com/CoderJackyHuang * * Create a colellection view with flow layout, scroll horizontal or vertical, * set item size, delegate, data source, item spacing and line spacing and so on. * * When super view is not nil, it will be automatically added constraints with edges of * super view. * * @param delegate Delegate and data source. * @param isHorizontal @see UICollectionViewScrollDirection * @param itemSize The size of collection view cell. * @param minimumInteritemSpacing The minunum interitem spacing. * @param minimumLineSpacing The mininum line spacing. * @param superView The super view of collection view. * * @return The instance of UICollectionView. */ + (instancetype)hyb_collectionViewWithDelegate:(id)delegate horizontal:(BOOL)isHorizontal size:(CGSize)itemSize itemSpacing:(CGFloat)minimumInteritemSpacing lineSpacing:(CGFloat)minimumLineSpacing superView:(UIView *)superView; /** * @author https://github.com/CoderJackyHuang * * Create a colellection view with flow layout, scroll horizontal or vertical, * set item size, delegate, data source, item spacing and line spacing and so on. * * @param delegate Delegate and data source. * @param isHorizontal @see UICollectionViewScrollDirection * @param itemSize The size of collection view cell. * @param minimumInteritemSpacing The minunum interitem spacing. * @param minimumLineSpacing The mininum line spacing. * @param superView The super view of collection view. * @param constraints The constraints added to the collection view. * * @return The instance of UICollectionView. */ + (instancetype)hyb_collectionViewWithDelegate:(id)delegate horizontal:(BOOL)isHorizontal size:(CGSize)itemSize itemSpacing:(CGFloat)minimumInteritemSpacing lineSpacing:(CGFloat)minimumLineSpacing superView:(UIView *)superView constraints:(HYBConstraintMaker)constraints; @end ================================================ FILE: HYBHelperKitSources/UICollectionView+HYBMaonsryKit.m ================================================ // // UICollectionView+HYBMaonsryKit.m // HYBHelperKit // // Created by huangyibiao on 16/7/7. // Copyright © 2016年 huangyibiao. All rights reserved. // #import "UICollectionView+HYBMaonsryKit.h" @implementation UICollectionView (HYBMaonsryKit) + (instancetype)hyb_collectionViewWithDelegate:(id)delegate horizontal:(BOOL)isHorizontal superView:(UIView *)superView { return [self hyb_collectionViewWithDelegate:delegate horizontal:isHorizontal size:CGSizeZero itemSpacing:0 lineSpacing:0 superView:superView constraints:nil]; } + (instancetype)hyb_collectionViewWithDelegate:(id)delegate horizontal:(BOOL)isHorizontal size:(CGSize)itemSize superView:(UIView *)superView { return [self hyb_collectionViewWithDelegate:delegate horizontal:isHorizontal size:itemSize itemSpacing:0 lineSpacing:0 superView:superView constraints:nil]; } + (instancetype)hyb_collectionViewWithDelegate:(id)delegate horizontal:(BOOL)isHorizontal size:(CGSize)itemSize itemSpacing:(CGFloat)minimumInteritemSpacing lineSpacing:(CGFloat)minimumLineSpacing superView:(UIView *)superView { return [self hyb_collectionViewWithDelegate:delegate horizontal:isHorizontal size:itemSize itemSpacing:minimumInteritemSpacing lineSpacing:minimumLineSpacing superView:superView constraints:nil]; } + (instancetype)hyb_collectionViewWithDelegate:(id)delegate horizontal:(BOOL)isHorizontal size:(CGSize)itemSize itemSpacing:(CGFloat)minimumInteritemSpacing lineSpacing:(CGFloat)minimumLineSpacing superView:(UIView *)superView constraints:(HYBConstraintMaker)constraints { UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc]init]; layout.itemSize = itemSize; layout.minimumInteritemSpacing = minimumInteritemSpacing; layout.minimumLineSpacing = minimumLineSpacing; UICollectionView *collection = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout]; collection.backgroundColor = [UIColor whiteColor]; collection.pagingEnabled = YES; collection.delegate = delegate; collection.dataSource = delegate; collection.showsHorizontalScrollIndicator = NO; [superView addSubview:collection]; if (isHorizontal) { [layout setScrollDirection:UICollectionViewScrollDirectionHorizontal]; collection.showsVerticalScrollIndicator = NO; collection.showsHorizontalScrollIndicator = YES; } else { [layout setScrollDirection:UICollectionViewScrollDirectionVertical]; collection.showsVerticalScrollIndicator = YES; collection.showsHorizontalScrollIndicator = NO; } if (superView) { if (constraints) { [collection mas_makeConstraints:^(MASConstraintMaker *make) { constraints(make); }]; } else { [collection mas_makeConstraints:^(MASConstraintMaker *make) { make.edges.mas_equalTo(superView); }]; } } return collection; } @end ================================================ FILE: HYBHelperKitSources/UIColor+HYBHelperKitUIKit.h ================================================ // // UIColor+HYBHelperKitUIKit.h // HYBHelperKit // // Created by huangyibiao on 16/6/30. // Copyright © 2016年 huangyibiao. All rights reserved. // #import @interface UIColor (HYBHelperKitUIKit) /** * @author https://github.com/CoderJackyHuang * * Generate an image with current color, and the image size will be set to {1, 1} * * @return UIImage instance. */ - (UIImage *)hyb_toImage; /** * @author https://github.com/CoderJackyHuang * * Generate an image with the color and size will be {1, 1} * * @param color The color to generate image. * * @return UIImage instance. */ + (UIImage *)hyb_imageWithColor:(UIColor *)color; /** * @author https://github.com/CoderJackyHuang * * Generate an image to the specified size with current color. * * @param size The returning image size. * * @return The image instance. */ - (UIImage *)hyb_toImageWithSize:(CGSize)size; /** * @author https://github.com/CoderJackyHuang * * Generate an image to the specified size with specified color. * * @param color The color to be used to generate an image. * @param size The result image size. * * @return The image instance. */ + (UIImage *)hyb_imageWithColor:(UIColor *)color size:(CGSize)size; @end ================================================ FILE: HYBHelperKitSources/UIColor+HYBHelperKitUIKit.m ================================================ // // UIColor+HYBHelperKitUIKit.m // HYBHelperKit // // Created by huangyibiao on 16/6/30. // Copyright © 2016年 huangyibiao. All rights reserved. // #import "UIColor+HYBHelperKitUIKit.h" @implementation UIColor (HYBHelperKitUIKit) - (UIImage *)hyb_toImage { return [UIColor hyb_imageWithColor:self]; } + (UIImage *)hyb_imageWithColor:(UIColor *)color { return [self hyb_imageWithColor:color size:CGSizeMake(1, 1)]; } - (UIImage *)hyb_toImageWithSize:(CGSize)size { return [UIColor hyb_imageWithColor:self size:size]; } + (UIImage *)hyb_imageWithColor:(UIColor *)color size:(CGSize)size { CGRect rect = CGRectMake(0, 0, size.width, size.height); UIGraphicsBeginImageContext(size); CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetFillColorWithColor(context, color.CGColor); CGContextFillRect(context, rect); UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return image; } @end ================================================ FILE: HYBHelperKitSources/UIControl+HYBHelperBlockKit.h ================================================ // // UIControl+HYBHelperBlockKit.h // HYBHelperKit // // Created by huangyibiao on 16/6/30. // Copyright © 2016年 huangyibiao. All rights reserved. // #import #import "HYBCommonKit.h" @interface UIControl (HYBHelperBlockKit) /** * @author https://github.com/CoderJackyHuang * * Make it support block callback of touch up event. */ @property (nonatomic, copy) HYBButtonBlock hyb_onTouchUp; /** * @author https://github.com/CoderJackyHuang * * Make it support block callback of touch down event. */ @property (nonatomic, copy) HYBButtonBlock hyb_onTouchDown; /** * @author https://github.com/CoderJackyHuang * * Make it support block callback of value change event. */ @property (nonatomic, copy) HYBValueChangedBlock hyb_onValueChanged; /** * @author https://github.com/CoderJackyHuang * * Make it support block callback of editing changed event. */ @property (nonatomic, copy) HYBEditChangedBlock hyb_onEditChanged; @end ================================================ FILE: HYBHelperKitSources/UIControl+HYBHelperBlockKit.m ================================================ // // UIControl+HYBHelperBlockKit.m // HYBHelperKit // // Created by huangyibiao on 16/6/30. // Copyright © 2016年 huangyibiao. All rights reserved. // #import "UIControl+HYBHelperBlockKit.h" #import static const void *s_HYBButtonTouchUpKey = "s_HYBButtonTouchUpKey"; static const void *s_HYBButtonTouchDownKey = "s_HYBButtonTouchDownKey"; static const void *s_HYBOnValueChangedKey = "s_HYBOnValueChangedKey"; static const void *s_HYBOnEditChangedKey = "s_HYBOnEditChangedKey"; @implementation UIControl (HYBHelperBlockKit) - (HYBButtonBlock)hyb_onTouchUp { return objc_getAssociatedObject(self, s_HYBButtonTouchUpKey); } - (void)setHyb_onTouchUp:(HYBButtonBlock)hyb_onTouchUp { objc_setAssociatedObject(self, s_HYBButtonTouchUpKey, hyb_onTouchUp, OBJC_ASSOCIATION_COPY_NONATOMIC); [self removeTarget:self action:@selector(hyb_private_onTouchUp:) forControlEvents:UIControlEventTouchUpInside]; if (hyb_onTouchUp) { [self addTarget:self action:@selector(hyb_private_onTouchUp:) forControlEvents:UIControlEventTouchUpInside]; } } - (HYBButtonBlock)hyb_onTouchDown { return objc_getAssociatedObject(self, s_HYBButtonTouchDownKey); } - (void)setHyb_onTouchDown:(HYBButtonBlock)hyb_onTouchDown { [self removeTarget:self action:@selector(hyb_private_onTouchDown:) forControlEvents:UIControlEventTouchDown]; if (hyb_onTouchDown) { [self addTarget:self action:@selector(hyb_private_onTouchDown:) forControlEvents:UIControlEventTouchDown]; } objc_setAssociatedObject(self, s_HYBButtonTouchDownKey, hyb_onTouchDown, OBJC_ASSOCIATION_COPY_NONATOMIC); } - (HYBValueChangedBlock)hyb_onValueChanged { return objc_getAssociatedObject(self, s_HYBOnValueChangedKey); } - (void)setHyb_onValueChanged:(HYBValueChangedBlock)hyb_onValueChanged { objc_setAssociatedObject(self, s_HYBOnValueChangedKey, hyb_onValueChanged, OBJC_ASSOCIATION_COPY_NONATOMIC); [self removeTarget:self action:@selector(hyb_private_onValueChanged:) forControlEvents:UIControlEventValueChanged]; if (hyb_onValueChanged) { [self addTarget:self action:@selector(hyb_private_onValueChanged:) forControlEvents:UIControlEventValueChanged]; } } - (HYBEditChangedBlock)hyb_onEditChanged { return objc_getAssociatedObject(self, s_HYBOnEditChangedKey); } - (void)setHyb_onEditChanged:(HYBEditChangedBlock)hyb_onEditChanged { objc_setAssociatedObject(self, s_HYBOnEditChangedKey, hyb_onEditChanged, OBJC_ASSOCIATION_COPY_NONATOMIC); [self removeTarget:self action:@selector(hyb_private_onEditChanged:) forControlEvents:UIControlEventEditingChanged]; if (hyb_onEditChanged) { [self addTarget:self action:@selector(hyb_private_onEditChanged:) forControlEvents:UIControlEventEditingChanged]; } } #pragma mark - Private - (void)hyb_private_onTouchUp:(id)sender { HYBButtonBlock block = [self hyb_onTouchUp]; if (block) { block(sender); } } - (void)hyb_private_onTouchDown:(id)sender { HYBButtonBlock block = [self hyb_onTouchDown]; if (block) { block(sender); } } - (void)hyb_private_onValueChanged:(id)sender { HYBValueChangedBlock block = [self hyb_onValueChanged]; if (block) { block(sender); } } - (void)hyb_private_onEditChanged:(id)sender { HYBEditChangedBlock block = [self hyb_onEditChanged]; if (block) { block(sender); } } @end ================================================ FILE: HYBHelperKitSources/UIDevice+HYBHelperKitUIKit.h ================================================ // // UIDevice+HYBHelperKitUIKit.h // HYBHelperKit // // Created by huangyibiao on 16/6/30. // Copyright © 2016年 huangyibiao. All rights reserved. // #import @interface UIDevice (HYBHelperKitUIKit) /** * Return the device platform string * Example: "iPhone3,2" * * @return Return the device platform string */ + (NSString *)hyb_devicePlatform; /** * Return the user-friendly device platform string * Example: "iPad Air (Cellular)" * * @return Return the user-friendly device platform string */ + (NSString *)hyb_devicePlatformString; /** * Check if the current device is an iPad * * @return Return YES if it's an iPad, NO if not */ + (BOOL)hyb_isiPad; /** * Check if the current device is an iPhone * * @return Return YES if it's an iPhone, NO if not */ + (BOOL)hyb_isiPhone; /** * Check if the current device is an iPod * * @return Return YES if it's an iPod, NO if not */ + (BOOL)hyb_isiPod; /** * Check if the current device is the simulator * * @return Return YES if it's the simulator, NO if not */ + (BOOL)hyb_isSimulator; /** * Check if the current device has a Retina display * * @return Return YES if it has a Retina display, NO if not */ + (BOOL)hyb_isRetina; /** * Check if the current device has a Retina HD display * * @return Return YES if it has a Retina HD display, NO if not */ + (BOOL)hyb_isRetinaHD; /** * Return the iOS version without the subversion * Example: 7 * * @return Return the iOS version */ + (NSInteger)hyb_iOSVersion; /** * Return the current device CPU frequency * * @return Return the current device CPU frequency */ + (NSUInteger)hyb_cpuFrequency; /** * Return the current device BUS frequency * * @return Return the current device BUS frequency */ + (NSUInteger)hyb_busFrequency; /** * Return the current device RAM size * * @return Return the current device RAM size */ + (NSUInteger)hyb_ramSize; /** * Return the current device CPU number * * @return Return the current device CPU number */ + (NSUInteger)hyb_cpuNumber; /** * Return the current device total memory * * @return Return the current device total memory */ + (NSUInteger)hyb_totalMemory; /** * Return the current device non-kernel memory * * @return Return the current device non-kernel memory */ + (NSUInteger)hyb_userMemory; /** * Return the current device total disk space * * @return Return the current device total disk space */ + (NSNumber *)hyb_totalDiskSpace; /** * Return the current device free disk space * * @return Return the current device free disk space */ + (NSNumber *)hyb_freeDiskSpace; /** * Return the current device MAC address * * @return Return the current device MAC address */ + (NSString *)hyb_macAddress; /** * Generate an unique identifier and store it into standardUserDefaults * * @return Return a unique identifier as a NSString */ + (NSString *)hyb_uniqueIdentifier; @end ================================================ FILE: HYBHelperKitSources/UIDevice+HYBHelperKitUIKit.m ================================================ // // UIDevice+HYBHelperKitUIKit.m // HYBHelperKit // // Created by huangyibiao on 16/6/30. // Copyright © 2016年 huangyibiao. All rights reserved. // #import "UIDevice+HYBHelperKitUIKit.h" #include #include #include #include #include static NSString * const BFUniqueIdentifierDefaultsKey = @"BFUniqueIdentifier"; @implementation UIDevice (HYBHelperKitUIKit) + (NSString *)hyb_devicePlatform { size_t size; sysctlbyname("hw.machine", NULL, &size, NULL, 0); char *machine = malloc(size); sysctlbyname("hw.machine", machine, &size, NULL, 0); NSString *platform = [NSString stringWithUTF8String:machine]; free(machine); return platform; } + (NSString *)hyb_devicePlatformString { NSString *platform = [self hyb_devicePlatform]; // iPhone if ([platform isEqualToString:@"iPhone1,1"]) return @"iPhone 2G"; if ([platform isEqualToString:@"iPhone1,2"]) return @"iPhone 3G"; if ([platform isEqualToString:@"iPhone2,1"]) return @"iPhone 3GS"; if ([platform isEqualToString:@"iPhone3,1"]) return @"iPhone 4"; if ([platform isEqualToString:@"iPhone3,3"]) return @"iPhone 4 (CDMA)"; if ([platform isEqualToString:@"iPhone4,1"]) return @"iPhone 4S"; if ([platform isEqualToString:@"iPhone5,1"]) return @"iPhone 5 (GSM)"; if ([platform isEqualToString:@"iPhone5,2"]) return @"iPhone 5 (CDMA)"; if ([platform isEqualToString:@"iPhone5,3"]) return @"iPhone 5C (GSM)"; if ([platform isEqualToString:@"iPhone5,4"]) return @"iPhone 5C (Global)"; if ([platform isEqualToString:@"iPhone6,1"]) return @"iPhone 5S (GSM)"; if ([platform isEqualToString:@"iPhone6,2"]) return @"iPhone 5S (Global)"; if ([platform isEqualToString:@"iPhone7,1"]) return @"iPhone 6 Plus"; if ([platform isEqualToString:@"iPhone7,2"]) return @"iPhone 6"; if ([platform isEqualToString:@"iPhone8,1"]) return @"iPhone 6s"; if ([platform isEqualToString:@"iPhone8,2"]) return @"iPhone 6s Plus"; // iPod if ([platform isEqualToString:@"iPod1,1"]) return @"iPod Touch 1G"; if ([platform isEqualToString:@"iPod2,1"]) return @"iPod Touch 2G"; if ([platform isEqualToString:@"iPod3,1"]) return @"iPod Touch 3G"; if ([platform isEqualToString:@"iPod4,1"]) return @"iPod Touch 4G"; if ([platform isEqualToString:@"iPod5,1"]) return @"iPod Touch 5G"; // iPad if ([platform isEqualToString:@"iPad1,1"]) return @"iPad 1"; if ([platform isEqualToString:@"iPad2,1"]) return @"iPad 2 (WiFi)"; if ([platform isEqualToString:@"iPad2,2"]) return @"iPad 2 (GSM)"; if ([platform isEqualToString:@"iPad2,3"]) return @"iPad 2 (CDMA)"; if ([platform isEqualToString:@"iPad2,4"]) return @"iPad 2 (32nm)"; if ([platform isEqualToString:@"iPad2,5"]) return @"iPad mini (WiFi)"; if ([platform isEqualToString:@"iPad2,6"]) return @"iPad mini (GSM)"; if ([platform isEqualToString:@"iPad2,7"]) return @"iPad mini (CDMA)"; if ([platform isEqualToString:@"iPad3,1"]) return @"iPad 3 (WiFi)"; if ([platform isEqualToString:@"iPad3,2"]) return @"iPad 3 (CDMA)"; if ([platform isEqualToString:@"iPad3,3"]) return @"iPad 3 (GSM)"; if ([platform isEqualToString:@"iPad3,4"]) return @"iPad 4 (WiFi)"; if ([platform isEqualToString:@"iPad3,5"]) return @"iPad 4 (GSM)"; if ([platform isEqualToString:@"iPad3,6"]) return @"iPad 4 (CDMA)"; if ([platform isEqualToString:@"iPad4,1"]) return @"iPad Air (WiFi)"; if ([platform isEqualToString:@"iPad4,2"]) return @"iPad Air (Cellular)"; if ([platform isEqualToString:@"iPad4,3"]) return @"iPad Air (China)"; if ([platform isEqualToString:@"iPad5,3"]) return @"iPad Air 2 (WiFi)"; if ([platform isEqualToString:@"iPad5,4"]) return @"iPad Air 2 (Cellular)"; // iPad mini if ([platform isEqualToString:@"iPad4,4"]) return @"iPad mini 2 (WiFi)"; if ([platform isEqualToString:@"iPad4,5"]) return @"iPad mini 2 (Cellular)"; if ([platform isEqualToString:@"iPad4,6"]) return @"iPad mini 2 (China)"; if ([platform isEqualToString:@"iPad4,7"]) return @"iPad mini 3 (WiFi)"; if ([platform isEqualToString:@"iPad4,8"]) return @"iPad mini 3 (Cellular)"; if ([platform isEqualToString:@"iPad4,9"]) return @"iPad mini 3 (China)"; // Simulator if ([platform isEqualToString:@"i386"]) return @"Simulator"; if ([platform isEqualToString:@"x86_64"]) return @"Simulator"; return platform; } + (BOOL)hyb_isiPad { return [[[self hyb_devicePlatform] substringToIndex:4] isEqualToString:@"iPad"]; } + (BOOL)hyb_isiPhone { return [[[self hyb_devicePlatform] substringToIndex:6] isEqualToString:@"iPhone"]; } + (BOOL)hyb_isiPod { return [[[self hyb_devicePlatform] substringToIndex:4] isEqualToString:@"iPod"]; } + (BOOL)hyb_isSimulator { return [[self hyb_devicePlatform] isEqualToString:@"i386"] || [[self hyb_devicePlatform] isEqualToString:@"x86_64"]; } + (BOOL)hyb_isRetina { return [[UIScreen mainScreen] respondsToSelector:@selector(displayLinkWithTarget:selector:)] && ([UIScreen mainScreen].scale == 2.0 || [UIScreen mainScreen].scale == 3.0); } + (BOOL)hyb_isRetinaHD { return [[UIScreen mainScreen] respondsToSelector:@selector(displayLinkWithTarget:selector:)] && ([UIScreen mainScreen].scale == 3.0); } + (NSInteger)hyb_iOSVersion { return [[[UIDevice currentDevice] systemVersion] integerValue]; } + (NSUInteger)hyb_cpuFrequency { return [self _getSysInfo:HW_CPU_FREQ]; } + (NSUInteger)hyb_busFrequency { return [self _getSysInfo:HW_BUS_FREQ]; } + (NSUInteger)hyb_ramSize { return [self _getSysInfo:HW_MEMSIZE]; } + (NSUInteger)hyb_cpuNumber { return [self _getSysInfo:HW_NCPU]; } + (NSUInteger)hyb_totalMemory { return [self _getSysInfo:HW_PHYSMEM]; } + (NSUInteger)hyb_userMemory { return [self _getSysInfo:HW_USERMEM]; } + (NSNumber *)hyb_totalDiskSpace { NSDictionary *fattributes = [[NSFileManager defaultManager] attributesOfFileSystemForPath:NSHomeDirectory() error:nil]; return [fattributes objectForKey:NSFileSystemSize]; } + (NSNumber *)hyb_freeDiskSpace { NSDictionary *fattributes = [[NSFileManager defaultManager] attributesOfFileSystemForPath:NSHomeDirectory() error:nil]; return [fattributes objectForKey:NSFileSystemFreeSize]; } + (NSString *)hyb_macAddress { int mib[6]; size_t len; char *buf; unsigned char *ptr; struct if_msghdr *ifm; struct sockaddr_dl *sdl; mib[0] = CTL_NET; mib[1] = AF_ROUTE; mib[2] = 0; mib[3] = AF_LINK; mib[4] = NET_RT_IFLIST; if((mib[5] = if_nametoindex("en0")) == 0) { printf("Error: if_nametoindex error\n"); return NULL; } if(sysctl(mib, 6, NULL, &len, NULL, 0) < 0) { printf("Error: sysctl, take 1\n"); return NULL; } if((buf = malloc(len)) == NULL) { printf("Could not allocate memory. Rrror!\n"); return NULL; } if(sysctl(mib, 6, buf, &len, NULL, 0) < 0) { printf("Error: sysctl, take 2"); return NULL; } ifm = (struct if_msghdr *)buf; sdl = (struct sockaddr_dl *)(ifm + 1); ptr = (unsigned char *)LLADDR(sdl); NSString *outstring = [NSString stringWithFormat:@"%02X:%02X:%02X:%02X:%02X:%02X", *ptr, *(ptr+1), *(ptr+2), *(ptr+3), *(ptr+4), *(ptr+5)]; free(buf); return outstring; } + (NSString *)hyb_uniqueIdentifier { NSString *uuid; if([[UIDevice currentDevice] respondsToSelector:@selector(identifierForVendor)]) { uuid = [[[UIDevice currentDevice] identifierForVendor] UUIDString]; } else { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; uuid = [defaults objectForKey:BFUniqueIdentifierDefaultsKey]; if (!uuid) { uuid = [self _generateUUID]; [defaults setObject:uuid forKey:BFUniqueIdentifierDefaultsKey]; [defaults synchronize]; } } return uuid; } #pragma mark - Private + (NSUInteger)_getSysInfo:(uint)typeSpecifier { size_t size = sizeof(int); int results; int mib[2] = {CTL_HW, typeSpecifier}; sysctl(mib, 2, &results, &size, NULL, 0); return (NSUInteger) results; } + (NSString *)_generateUUID { CFUUIDRef theUUID = CFUUIDCreate(NULL); CFStringRef string = CFUUIDCreateString(NULL, theUUID); CFRelease(theUUID); return (__bridge_transfer NSString *)string; } @end ================================================ FILE: HYBHelperKitSources/UIGestureRecognizer+HYBHelperBlockKit.h ================================================ // // UIGestureRecognizer+HYBHelperBlockKit.h // HYBHelperKit // // Created by huangyibiao on 16/6/30. // Copyright © 2016年 huangyibiao. All rights reserved. // #import #import "HYBCommonKit.h" @interface UIGestureRecognizer (HYBHelperBlockKit) /** * @author https://github.com/CoderJackyHuang * * Make all gestures support block callback. * This will support all kinds of gestures. */ @property (nonatomic, copy) HYBGestureBlock hyb_onGesture; /** * @author https://github.com/CoderJackyHuang * * Make tap gesture support block callback. */ @property (nonatomic, copy) HYBTapGestureBlock hyb_onTaped; /** * @author https://github.com/CoderJackyHuang * * Make long press gesture support block callback. */ @property (nonatomic, copy) HYBLongGestureBlock hyb_onLongPressed; @end ================================================ FILE: HYBHelperKitSources/UIGestureRecognizer+HYBHelperBlockKit.m ================================================ // // UIGestureRecognizer+HYBHelperBlockKit.m // HYBHelperKit // // Created by huangyibiao on 16/6/30. // Copyright © 2016年 huangyibiao. All rights reserved. // #import "UIGestureRecognizer+HYBHelperBlockKit.h" #import static const void *s_hyb_gestureKey = "s_hyb_gestureKey"; static const void *s_hyb_tap_gestureKey = "s_hyb_tap_gestureKey"; static const void *s_hyb_long_gestureKey = "s_hyb_long_gestureKey"; @implementation UIGestureRecognizer (HYBHelperBlockKit) - (HYBGestureBlock)hyb_onGesture { return objc_getAssociatedObject(self, s_hyb_gestureKey); } - (void)setHyb_onGesture:(HYBGestureBlock)hyb_onGesture { objc_setAssociatedObject(self, s_hyb_gestureKey, hyb_onGesture, OBJC_ASSOCIATION_COPY_NONATOMIC); [self removeTarget:self action:@selector(hyb_private_onGesture:)]; if (hyb_onGesture) { [self addTarget:self action:@selector(hyb_private_onGesture:)]; } } - (HYBTapGestureBlock)hyb_onTaped { return objc_getAssociatedObject(self, s_hyb_tap_gestureKey); } - (void)setHyb_onTaped:(HYBTapGestureBlock)hyb_onTaped { objc_setAssociatedObject(self, s_hyb_tap_gestureKey, hyb_onTaped, OBJC_ASSOCIATION_COPY_NONATOMIC); [self removeTarget:self action:@selector(hyb_private_onTaped:)]; if (hyb_onTaped) { [self addTarget:self action:@selector(hyb_private_onTaped:)]; } } - (HYBLongGestureBlock)hyb_onLongPressed { return objc_getAssociatedObject(self, s_hyb_long_gestureKey); } - (void)setHyb_onLongPressed:(HYBLongGestureBlock)hyb_onLongPressed { objc_setAssociatedObject(self, s_hyb_long_gestureKey, hyb_onLongPressed, OBJC_ASSOCIATION_COPY_NONATOMIC); [self removeTarget:self action:@selector(hyb_private_onLongPressed:)]; if (hyb_onLongPressed) { [self addTarget:self action:@selector(hyb_private_onLongPressed:)]; } } #pragma mark - Private - (void)hyb_private_onGesture:(UIGestureRecognizer *)sender { HYBGestureBlock block = [self hyb_onGesture]; if (block) { block(sender); } } - (void)hyb_private_onTaped:(UITapGestureRecognizer *)sender { HYBTapGestureBlock block = [self hyb_onTaped]; if (block) { block(sender); } } - (void)hyb_private_onLongPressed:(UILongPressGestureRecognizer *)sender { HYBLongGestureBlock block = [self hyb_onLongPressed]; if (block) { block(sender); } } @end ================================================ FILE: HYBHelperKitSources/UIImageView+HYBMasonryKit.h ================================================ // // UIImageView+HYBMasonryKit.h // HYBHelperKit // // Created by huangyibiao on 16/7/6. // Copyright © 2016年 huangyibiao. All rights reserved. // #import #import "HYBHelperKit.h" @interface UIImageView (HYBMasonryKit) /** * @author https://github.com/CoderJackyHuang * * Create a default image view with scale to fill content mode * * @return Instance of UIImageView. */ + (instancetype)hyb_imageView; + (instancetype)hyb_imageViewWithSuperView:(UIView *)superView constraints:(HYBConstraintMaker)constraints; + (instancetype)hyb_imageViewWithSuperView:(UIView *)superView constraints:(HYBConstraintMaker)constraints onTaped:(HYBTapGestureBlock)onTaped; + (instancetype)hyb_imageViewWithImage:(id)image superView:(UIView *)superView constraints:(HYBConstraintMaker)constraints; + (instancetype)hyb_imageViewWithImage:(id)image superView:(UIView *)superView constraints:(HYBConstraintMaker)constraints onTaped:(HYBTapGestureBlock)onTaped; + (instancetype)hyb_imageViewWithImage:(id)image isCircle:(BOOL)isCircle superView:(UIView *)superView constraints:(HYBConstraintMaker)constraints onTaped:(HYBTapGestureBlock)onTaped; @end ================================================ FILE: HYBHelperKitSources/UIImageView+HYBMasonryKit.m ================================================ // // UIImageView+HYBMasonryKit.m // HYBHelperKit // // Created by huangyibiao on 16/7/6. // Copyright © 2016年 huangyibiao. All rights reserved. // #import "UIImageView+HYBMasonryKit.h" @implementation UIImageView (HYBMasonryKit) + (instancetype)hyb_imageView { return [self hyb_imageViewWithSuperView:nil constraints:nil]; } + (instancetype)hyb_imageViewWithSuperView:(UIView *)superView constraints:(HYBConstraintMaker)constraints { return [self hyb_imageViewWithSuperView:superView constraints:constraints onTaped:nil]; } + (instancetype)hyb_imageViewWithSuperView:(UIView *)superView constraints:(HYBConstraintMaker)constraints onTaped:(HYBTapGestureBlock)onTaped { return [self hyb_imageViewWithImage:nil isCircle:NO superView:superView constraints:constraints onTaped:onTaped]; } + (instancetype)hyb_imageViewWithImage:(id)image superView:(UIView *)superView constraints:(HYBConstraintMaker)constraints { return [self hyb_imageViewWithImage:image superView:superView constraints:constraints onTaped:nil]; } + (instancetype)hyb_imageViewWithImage:(id)image superView:(UIView *)superView constraints:(HYBConstraintMaker)constraints onTaped:(HYBTapGestureBlock)onTaped { return [self hyb_imageViewWithImage:image isCircle:NO superView:superView constraints:constraints onTaped:onTaped]; } + (instancetype)hyb_imageViewWithImage:(id)image isCircle:(BOOL)isCircle superView:(UIView *)superView constraints:(HYBConstraintMaker)constraints onTaped:(HYBTapGestureBlock)onTaped { UIImageView *imgView = [[UIImageView alloc] init]; if (image != nil) { if ([image isKindOfClass:[NSString class]]) { imgView.image = kImage(image); } else { imgView.image = image; } } imgView.contentMode = UIViewContentModeScaleToFill; [superView addSubview:imgView]; if (onTaped) { [imgView hyb_addTapGestureWithCallback:onTaped]; } if (constraints && superView) { [imgView mas_makeConstraints:^(MASConstraintMaker *make) { constraints(make); }]; } if (isCircle) { [imgView performSelector:@selector(updateLayerToCircle:) withObject:imgView afterDelay:0.0]; } return imgView; } - (void)updateLayerToCircle:(UIImageView *)imgView { imgView.layer.cornerRadius = imgView.hyb_width / 2.0; imgView.layer.masksToBounds = YES; imgView.clipsToBounds = YES; } @end ================================================ FILE: HYBHelperKitSources/UILabel+HYBMasonryKit.h ================================================ // // UILabel+HYBMasonryKit.h // HYBHelperKit // // Created by huangyibiao on 16/7/6. // Copyright © 2016年 huangyibiao. All rights reserved. // #import #import "HYBHelperKit.h" @interface UILabel (HYBMasonryKit) /** * @author https://github.com/CoderJackyHuang * * By default, create a label which it has black text color, and the font size. * Label will be aligned to left, and set to only one line, no constraints. * * @return Instance of UILabel. */ + (instancetype)hyb_labelWithFont:(CGFloat)font; /** * @author https://github.com/CoderJackyHuang * * By default, create a label which it has black text color, and the font size. * Label will be aligned to left, and set to only one line, no constraints. * * * @param text The default text * @param font The font size * * @return Instance of UILabel. */ + (instancetype)hyb_labelWithText:(NSString *)text font:(CGFloat)font; /** * @author https://github.com/CoderJackyHuang * * Create a label with font, super view and constraints. * * @param font The font size of UILabel. * @param superView The label's super view. * @param constraints The constraints added to the label. * * @return The instance of UILabel. */ + (instancetype)hyb_labelWithFont:(CGFloat)font superView:(UIView *)superView constraints:(HYBConstraintMaker)constraints; /** * @author https://github.com/CoderJackyHuang * * Create a label with text, font size, super view and constraints. * It will only have one line. * * @param text The default text * @param font The font size * @param superView The super view of label. * @param constraints The constraints. * * @return Instance of UILabel. */ + (instancetype)hyb_labelWithText:(NSString *)text font:(CGFloat)font superView:(UIView *)superView constraints:(HYBConstraintMaker)constraints; /** * @author https://github.com/CoderJackyHuang * * Create a label with text, font size, super view and constraints. * * @param text The default text * @param font The font size * @param lines How many lines. * @param superView The super view of label. * @param constraints The constraints. * * @return Instance of UILabel. */ + (instancetype)hyb_labelWithText:(NSString *)text font:(CGFloat)font lines:(NSInteger)lines superView:(UIView *)superView constraints:(HYBConstraintMaker)constraints; @end ================================================ FILE: HYBHelperKitSources/UILabel+HYBMasonryKit.m ================================================ // // UILabel+HYBMasonryKit.m // HYBHelperKit // // Created by huangyibiao on 16/7/6. // Copyright © 2016年 huangyibiao. All rights reserved. // #import "UILabel+HYBMasonryKit.h" @implementation UILabel (HYBMasonryKit) + (instancetype)hyb_labelWithFont:(CGFloat)font { return [self hyb_labelWithText:nil font:font]; } + (instancetype)hyb_labelWithText:(NSString *)text font:(CGFloat)font { return [self hyb_labelWithText:text font:font superView:nil constraints:nil]; } + (instancetype)hyb_labelWithText:(NSString *)text font:(CGFloat)font superView:(UIView *)superView constraints:(HYBConstraintMaker)constraints { return [self hyb_labelWithText:text font:font lines:1 superView:superView constraints:constraints]; } + (instancetype)hyb_labelWithFont:(CGFloat)font superView:(UIView *)superView constraints:(HYBConstraintMaker)constraints { return [self hyb_labelWithText:nil font:font superView:superView constraints:constraints]; } + (instancetype)hyb_labelWithText:(NSString *)text font:(CGFloat)font lines:(NSInteger)lines superView:(UIView *)superView constraints:(HYBConstraintMaker)constraints { UILabel *label = [[UILabel alloc] init]; label.text = text; label.font = kFontWithSize(font); label.textAlignment = NSTextAlignmentLeft; label.textColor = kBlackColor; label.backgroundColor = kClearColor; label.numberOfLines = lines; if (lines <= 0) { label.lineBreakMode = NSLineBreakByWordWrapping; } else { label.lineBreakMode = NSLineBreakByTruncatingTail; } [superView addSubview:label]; if (superView && constraints) { [label mas_makeConstraints:^(MASConstraintMaker *make) { constraints(make); }]; } return label; } @end ================================================ FILE: HYBHelperKitSources/UIScrollView+HYBMasonryKit.h ================================================ // // UIScrollView+HYBMasonryKit.h // HYBHelperKit // // Created by huangyibiao on 16/7/6. // Copyright © 2016年 huangyibiao. All rights reserved. // #import #import "HYBHelperKit.h" @interface UIScrollView (HYBMasonryKit) /** * @author https://github.com/CoderJackyHuang * * Create a scroll view with delegate, without layout. * * @param delegate The scroll view delegate * * @return Instance of UIScrollView. */ + (instancetype)hyb_scrollViewWithDelegate:(id)delegate; /** * @author https://github.com/CoderJackyHuang * * Create a scroll view with delegate and superview, and will make it * hold it's super view's edges. * * @param delegate The scroll view delegate * @param superView The scroll view's super view. * * @return Instance of UIScrollView. */ + (instancetype)hyb_scrollViewWithDelegate:(id)delegate superView:(UIView *)superView; /** * @author https://github.com/CoderJackyHuang * * Create a scroll view with delegate, superview, and add constraints to it. * If super view is nil, constraints will be ignored. * * @param delegate The scroll view delegate * @param superView The scroll view's super view. * @param constraints Add constraints to the scroll view. * * @return Instance of UIScrollView. */ + (instancetype)hyb_scrollViewWithDelegate:(id)delegate superView:(UIView *)superView constraints:(HYBConstraintMaker)constraints; @end ================================================ FILE: HYBHelperKitSources/UIScrollView+HYBMasonryKit.m ================================================ // // UIScrollView+HYBMasonryKit.m // HYBHelperKit // // Created by huangyibiao on 16/7/6. // Copyright © 2016年 huangyibiao. All rights reserved. // #import "UIScrollView+HYBMasonryKit.h" @implementation UIScrollView (HYBMasonryKit) + (instancetype)hyb_scrollViewWithDelegate:(id)delegate { return [self hyb_scrollViewWithDelegate:delegate superView:nil]; } + (instancetype)hyb_scrollViewWithDelegate:(id)delegate superView:(UIView *)superView { if (superView == nil) { return [self hyb_scrollViewWithDelegate:delegate superView:superView constraints:nil]; } return [self hyb_scrollViewWithDelegate:delegate superView:superView constraints:^(MASConstraintMaker *make) { make.edges.mas_equalTo(superView); }]; } + (instancetype)hyb_scrollViewWithDelegate:(id)delegate superView:(UIView *)superView constraints:(HYBConstraintMaker)constraints { UIScrollView *scrollView = [[UIScrollView alloc] init]; [superView addSubview:scrollView]; if (superView && constraints) { [scrollView mas_makeConstraints:^(MASConstraintMaker *make) { constraints(make); }]; } scrollView.delegate = delegate; scrollView.pagingEnabled = YES; scrollView.showsHorizontalScrollIndicator = YES; scrollView.showsVerticalScrollIndicator = NO; return scrollView; } @end ================================================ FILE: HYBHelperKitSources/UITableView+HYBMasonryKit.h ================================================ // // UITableView+HYBMasonryKit.h // HYBHelperKit // // Created by huangyibiao on 16/6/30. // Copyright © 2016年 huangyibiao. All rights reserved. // #import #import "HYBCommonKit.h" #import "HYBHelperBlocksKit.h" @interface UITableView (HYBMasonryKit) /** * @author https://github.com/CoderJackyHuang * * Create a table view, if superview is not nil, it will be added constraints * and it's edge will be always equal to super view. * * @param superView The super view for table view. * * @return The table view instance. */ + (instancetype)hyb_tableViewWithSuperview:(UIView *)superView; /** * @author https://github.com/CoderJackyHuang * * Create a table view, if superview is nil, constraints will be ignored. * * @param superView The super view for table view. * @param constraints Make constraints for table view. * * @return The table view instance. */ + (instancetype)hyb_tableViewWithSuperview:(UIView *)superView constraints:(HYBConstraintMaker)constraints; /** * @author https://github.com/CoderJackyHuang * * Create a table view, if superview is not nil, it will be added constraints * and it's edge will be always equal to super view. * * @param superView The super view for table view. * @param delegate Delgate and dataSource. * * @return The table view instance. */ + (instancetype)hyb_tableViewWithSuperview:(UIView *)superView delegate:(id)delegate; /** * @author https://github.com/CoderJackyHuang * * Create a table view, if superview is nil, constraints will be ignored. * * @param superView The super view for table view. * @param delegate Delgate and dataSource. * @param constraints Make constraints for table view. * * @return The table view instance. */ + (instancetype)hyb_tableViewWithSuperview:(UIView *)superView delegate:(id)delegate constraints:(HYBConstraintMaker)constraints; /** * @author https://github.com/CoderJackyHuang * * Create a table view, if superview is nil, constraints will be ignored. Can * specify table view style. * * @param superView The super view for table view. * @param delegate Delgate and dataSource. * @param style @see UITableViewStyle. * @param constraints Make constraints for table view. * * @return The table view instance. */ + (instancetype)hyb_tableViewWithSuperview:(UIView *)superView delegate:(id)delegate style:(UITableViewStyle)style constraints:(HYBConstraintMaker)constraints; @end ================================================ FILE: HYBHelperKitSources/UITableView+HYBMasonryKit.m ================================================ // // UITableView+HYBMasonryKit.m // HYBHelperKit // // Created by huangyibiao on 16/6/30. // Copyright © 2016年 huangyibiao. All rights reserved. // #import "UITableView+HYBMasonryKit.h" @implementation UITableView (HYBMasonryKit) + (instancetype)hyb_tableViewWithSuperview:(UIView *)superView { return [self hyb_tableViewWithSuperview:superView delegate:nil]; } + (instancetype)hyb_tableViewWithSuperview:(UIView *)superView constraints:(HYBConstraintMaker)constraints { return [self hyb_tableViewWithSuperview:superView delegate:nil constraints:constraints]; } + (instancetype)hyb_tableViewWithSuperview:(UIView *)superView delegate:(id)delegate { return [self hyb_tableViewWithSuperview:superView delegate:delegate constraints:^(MASConstraintMaker *make) { if (superView) { make.edges.mas_equalTo(superView); } }]; } + (instancetype)hyb_tableViewWithSuperview:(UIView *)superView delegate:(id)delegate constraints:(HYBConstraintMaker)constraints { return [self hyb_tableViewWithSuperview:superView delegate:delegate style:UITableViewStylePlain constraints:constraints]; } + (instancetype)hyb_tableViewWithSuperview:(UIView *)superView delegate:(id)delegate style:(UITableViewStyle)style constraints:(HYBConstraintMaker)constraints { UITableView *tableView = [[UITableView alloc] initWithFrame:CGRectZero style:style]; tableView.delegate = delegate; tableView.dataSource = delegate; tableView.separatorStyle = UITableViewCellSeparatorStyleNone; [superView addSubview:tableView]; if (superView && constraints) { [tableView mas_makeConstraints:^(MASConstraintMaker *make) { constraints(make); }]; } return tableView; } @end ================================================ FILE: HYBHelperKitSources/UITextField+HYBMasonryKit.h ================================================ // // UITextField+HYBMasonryKit.h // HYBHelperKit // // Created by huangyibiao on 16/6/30. // Copyright © 2016年 huangyibiao. All rights reserved. // #import #import "HYBHelperBlocksKit.h" @interface UITextField (HYBMasonryKit) /** * @author https://github.com/CoderJackyHuang * * If you want to specify a left margin before cursor, just define this. * * @default The default value is 8px. */ @property (nonatomic, assign) CGFloat hyb_leftMarginOfCursor; /** * @author https://github.com/CoderJackyHuang * * Create a text field with holder, super view and constraints. * * @param holder The place holder. * @param superView The super view of created text field. * @param constraints Add constraints to the text field, if superview is nil, it will be ignored. * * @return The text field instance. */ + (instancetype)hyb_textFieldWithHolder:(NSString *)holder superView:(UIView *)superView constraints:(HYBConstraintMaker)constraints; /** * @author https://github.com/CoderJackyHuang * * Create a text field with holder, super view and constraints. * * @param holder The place holder. * @param delegate The text field delegate. * @param superView The super view of created text field. * @param constraints Add constraints to the text field, if superview is nil, it will be ignored. * * @return The text field instance. */ + (UITextField *)hyb_textFieldWithHolder:(NSString *)holder delegate:(id)delegate superView:(UIView *)superView constraints:(HYBConstraintMaker)constraints; /** * @author https://github.com/CoderJackyHuang * * Create a text field with holder, text, super view and constraints. * * @param holder The place holder. * @param text The text field default text. * @param superView The super view of created text field. * @param constraints Add constraints to the text field, if superview is nil, it will be ignored. * * @return The text field instance. */ + (UITextField *)hyb_textFieldWithHolder:(NSString *)holder text:(NSString *)text superView:(UIView *)superView constraints:(HYBConstraintMaker)constraints; /** * @author https://github.com/CoderJackyHuang * * Create a text field with holder, text, super view and constraints. * * @param holder The place holder. * @param text The text field default text. * @param delegate The text field delegate. * @param superView The super view of created text field. * @param constraints Add constraints to the text field, if superview is nil, it will be ignored. * * @return The text field instance. */ + (UITextField *)hyb_textFieldWithHolder:(NSString *)holder text:(NSString *)text delegate:(id)delegate superView:(UIView *)superView constraints:(HYBConstraintMaker)constraints; @end ================================================ FILE: HYBHelperKitSources/UITextField+HYBMasonryKit.m ================================================ // // UITextField+HYBMasonryKit.m // HYBHelperKit // // Created by huangyibiao on 16/6/30. // Copyright © 2016年 huangyibiao. All rights reserved. // #import "UITextField+HYBMasonryKit.h" #import #import "UIView+HYBHelperKitUIKit.h" static const void *s_leftMarginOfCursorKey = "s_leftMarginOfCursor"; @implementation UITextField (HYBMasonryKit) - (CGFloat)hyb_leftMarginOfCursor { NSNumber *number = objc_getAssociatedObject(self, s_leftMarginOfCursorKey); if ([number respondsToSelector:@selector(floatValue)]) { return [number floatValue]; } return 8.0; } - (void)setHyb_leftMarginOfCursor:(CGFloat)hyb_leftMarginOfCursor { objc_setAssociatedObject(self, s_leftMarginOfCursorKey, @(hyb_leftMarginOfCursor), OBJC_ASSOCIATION_RETAIN_NONATOMIC); if (self.leftView) { self.leftView.hyb_width = hyb_leftMarginOfCursor; } } + (instancetype)hyb_textFieldWithHolder:(NSString *)holder superView:(UIView *)superView constraints:(HYBConstraintMaker)constraints { return [self hyb_textFieldWithHolder:holder text:nil superView:superView constraints:constraints]; } + (UITextField *)hyb_textFieldWithHolder:(NSString *)holder text:(NSString *)text superView:(UIView *)superView constraints:(HYBConstraintMaker)constraints { return [self hyb_textFieldWithHolder:holder text:text delegate:nil superView:superView constraints:constraints]; } + (UITextField *)hyb_textFieldWithHolder:(NSString *)holder delegate:(id)delegate superView:(UIView *)superView constraints:(HYBConstraintMaker)constraints { return [self hyb_textFieldWithHolder:holder text:nil delegate:delegate superView:superView constraints:constraints]; } + (UITextField *)hyb_textFieldWithHolder:(NSString *)holder text:(NSString *)text delegate:(id)delegate superView:(UIView *)superView constraints:(HYBConstraintMaker)constraints { UITextField *textField = [[UITextField alloc] init]; textField.borderStyle = UITextBorderStyleNone; textField.leftView = [[UIView alloc] init]; textField.leftView.backgroundColor = [UIColor clearColor]; textField.leftView.hyb_width = textField.hyb_leftMarginOfCursor; textField.autocapitalizationType = UITextAutocapitalizationTypeNone; textField.autocorrectionType = UITextAutocorrectionTypeNo; textField.spellCheckingType = UITextSpellCheckingTypeNo; textField.delegate = delegate; [superView addSubview:textField]; textField.placeholder = holder; textField.text = text; if (superView && constraints) { [textField mas_makeConstraints:^(MASConstraintMaker *make) { constraints(make); }]; } return textField; } @end ================================================ FILE: HYBHelperKitSources/UIView+HYBHelperBlockKit.h ================================================ // // UIView+HYBHelperBlockKit.h // HYBHelperKit // // Created by huangyibiao on 16/7/6. // Copyright © 2016年 huangyibiao. All rights reserved. // #import #import "HYBhelperkit.h" @interface UIView (HYBHelperBlockKit) /** * @author https://github.com/CoderJackyHuang * * The tap gesture getter. @see hyb_addTapGestureWithCallback */ @property (nonatomic, strong, readonly) UITapGestureRecognizer *hyb_tapGesture; /** * @author https://github.com/CoderJackyHuang * * The long press gesture getter, @see hyb_addLongGestureWithCallback */ @property (nonatomic, strong, readonly) UILongPressGestureRecognizer *hyb_longGesure; /** * @author https://github.com/CoderJackyHuang * * Add a tap gesture with callback. It will automatically open userInterface to YES. * * @param onTaped The callback block when taped. */ - (void)hyb_addTapGestureWithCallback:(HYBTapGestureBlock)onTaped; /** * @author https://github.com/CoderJackyHuang * * Add long press gesture with callback. It will automatically open userInterface to YES. * * @param onLongPressed The long press callback when long pressed. */ - (void)hyb_addLongGestureWithCallback:(HYBLongGestureBlock)onLongPressed; @end ================================================ FILE: HYBHelperKitSources/UIView+HYBHelperBlockKit.m ================================================ // // UIView+HYBHelperBlockKit.m // HYBHelperKit // // Created by huangyibiao on 16/7/6. // Copyright © 2016年 huangyibiao. All rights reserved. // #import "UIView+HYBHelperBlockKit.h" #import static const void *s_hyb_tapGestureKey = "s_hyb_tapGestureKey"; static const void *s_hyb_longGestureKey = "s_hyb_longGestureKey"; @implementation UIView (HYBHelperBlockKit) - (UITapGestureRecognizer *)hyb_tapGesture { return objc_getAssociatedObject(self, s_hyb_tapGestureKey); } - (UILongPressGestureRecognizer *)hyb_longGesure { return objc_getAssociatedObject(self, s_hyb_longGestureKey); } - (void)hyb_addTapGestureWithCallback:(HYBTapGestureBlock)onTaped { self.userInteractionEnabled = YES; UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] init]; tap.hyb_onTaped = onTaped; [self addGestureRecognizer:tap]; objc_setAssociatedObject(self, s_hyb_tapGestureKey, tap, OBJC_ASSOCIATION_RETAIN_NONATOMIC); } - (void)hyb_addLongGestureWithCallback:(HYBLongGestureBlock)onLongPressed { self.userInteractionEnabled = YES; UILongPressGestureRecognizer *gesture = [[UILongPressGestureRecognizer alloc] init]; gesture.hyb_onLongPressed = onLongPressed; [self addGestureRecognizer:gesture]; objc_setAssociatedObject(self, s_hyb_longGestureKey, gesture, OBJC_ASSOCIATION_COPY_NONATOMIC); } #pragma mark - Private @end ================================================ FILE: HYBHelperKitSources/UIView+HYBHelperKitUIKit.h ================================================ // // UIView+HYBHelperKitUIKit.h // HYBHelperKit // // Created by huangyibiao on 16/6/30. // Copyright © 2016年 huangyibiao. All rights reserved. // #import @interface UIView (HYBHelperKitUIKit) #pragma mark - Convenience frame api /** * view.frame.origin.x */ @property (nonatomic, assign) CGFloat hyb_originX; /** * view.frame.origin.y */ @property (nonatomic, assign) CGFloat hyb_originY; /** * view.frame.origin */ @property (nonatomic, assign) CGPoint hyb_origin; /** * view.center.x */ @property (nonatomic, assign) CGFloat hyb_centerX; /** * view.center.y */ @property (nonatomic, assign) CGFloat hyb_centerY; /** * view.center */ @property (nonatomic, assign) CGPoint hyb_center; /** * view.frame.size.width */ @property (nonatomic, assign) CGFloat hyb_width; /** * view.frame.size.height */ @property (nonatomic, assign) CGFloat hyb_height; /** * view.frame.size */ @property (nonatomic, assign) CGSize hyb_size; /** * view.frame.size.height + view.frame.origin.y */ @property (nonatomic, assign) CGFloat hyb_bottomY; /** * view.frame.size.width + view.frame.origin.x */ @property (nonatomic, assign) CGFloat hyb_rightX; @end ================================================ FILE: HYBHelperKitSources/UIView+HYBHelperKitUIKit.m ================================================ // // UIView+HYBHelperKitUIKit.m // HYBHelperKit // // Created by huangyibiao on 16/6/30. // Copyright © 2016年 huangyibiao. All rights reserved. // #import "UIView+HYBHelperKitUIKit.h" @implementation UIView (HYBHelperKitUIKit) - (void)setHyb_origin:(CGPoint)hyb_origin { CGRect frame = self.frame; frame.origin = hyb_origin; self.frame = frame; } - (CGPoint)hyb_origin { return self.frame.origin; } - (void)setHyb_originX:(CGFloat)hyb_originX { [self setHyb_origin:CGPointMake(hyb_originX, self.hyb_originY)]; } - (CGFloat)hyb_originX { return self.hyb_origin.x; } - (void)setHyb_originY:(CGFloat)hyb_originY { [self setHyb_origin:CGPointMake(self.hyb_originX, hyb_originY)]; } - (CGFloat)hyb_originY { return self.hyb_origin.y; } - (void)setHyb_center:(CGPoint)hyb_center { self.center = hyb_center; } - (CGPoint)hyb_center { return self.center; } - (void)setHyb_centerX:(CGFloat)hyb_centerX { [self setHyb_center:CGPointMake(hyb_centerX, self.hyb_centerY)]; } - (CGFloat)hyb_centerX { return self.hyb_center.x; } - (void)setHyb_centerY:(CGFloat)hyb_centerY { [self setHyb_center:CGPointMake(self.hyb_centerX, hyb_centerY)]; } - (CGFloat)hyb_centerY { return self.hyb_center.y; } - (void)setHyb_size:(CGSize)hyb_size { CGRect frame = self.frame; frame.size = hyb_size; self.frame = frame; } - (CGSize)hyb_size { return self.frame.size; } - (void)setHyb_width:(CGFloat)hyb_width { self.hyb_size = CGSizeMake(hyb_width, self.hyb_height); } - (CGFloat)hyb_width { return self.hyb_size.width; } - (void)setHyb_height:(CGFloat)hyb_height { self.hyb_size = CGSizeMake(self.hyb_width, hyb_height); } - (CGFloat)hyb_height { return self.hyb_size.height; } - (CGFloat)hyb_bottomY { return self.hyb_originY + self.hyb_height; } - (void)setHyb_bottomY:(CGFloat)hyb_bottomY { self.hyb_originY = hyb_bottomY - self.hyb_height; } - (CGFloat)hyb_rightX { return self.hyb_originX + self.hyb_width; } - (void)setHyb_rightX:(CGFloat)hyb_rightX { self.hyb_originX = hyb_rightX - self.hyb_width; } @end ================================================ FILE: HYBHelperKitSources/UIView+HYBMasonryKit.h ================================================ // // UIView+HYBMasonryKit.h // HYBHelperKit // // Created by huangyibiao on 16/7/6. // Copyright © 2016年 huangyibiao. All rights reserved. // #import #import "HYBHelperKit.h" @interface UIView (HYBMasonryKit) #pragma mark - Create view /** * @author https://github.com/CoderJackyHuang * * Create an empty view with super view, if superView is not nil, * it will be added constraints to the view which edges equal to superView. * * @param superView The super view of created view. * * @return The view instance. */ + (instancetype)hyb_viewWithSuperView:(UIView *)superView; /** * @author https://github.com/CoderJackyHuang * * Create an empty view with super view, if superView is not nil, * it will be added constraints to the view which edges equal to superView. * When onTaped is not nil, tap gesture will be added to it. * * @param superView The super view of created view. * @param onTaped The tap gesture callback. * * @return The view instance. */ + (instancetype)hyb_viewWithSuperView:(UIView *)superView onTaped:(HYBTapGestureBlock)onTaped; /** * @author https://github.com/CoderJackyHuang * * Create an empty view with super view, if superView is not nil, * it will be added constraints to the view which edges equal to superView. * * @param superView The super view of created view. * @param constraints The added contraints of view. * * @return The view instance. */ + (instancetype)hyb_viewWithSuperView:(UIView *)superView constraints:(HYBConstraintMaker)constraints; /** * @author https://github.com/CoderJackyHuang * * Create an empty view with super view, if superView is not nil, * it will be added constraints to the view which edges equal to superView. * When onTaped is not nil, tap gesture will be added to it. * * @param superView The super view of created view. * @param constraints The added contraints of view. * @param onTaped The tap gesture callback. * * @return The view instance. */ + (instancetype)hyb_viewWithSuperView:(UIView *)superView constraints:(HYBConstraintMaker)constraints onTaped:(HYBTapGestureBlock)onTaped; #pragma mark - Horizontal Line /** * @author https://github.com/CoderJackyHuang * * Add a line to the view of top. * * @param toView The view that needs to add a line. * @param height The line height * @param color The color of line. * * @return The instance of UILabel. */ + (instancetype)hyb_addTopLineToView:(UIView *)toView height:(CGFloat)height color:(UIColor *)color; /** * @author https://github.com/CoderJackyHuang * * Add a line to the view of top and add a distance to top. * * @param toView The view that needs to add a line. * @param distance The distance to the top. * @param height The line height * @param color The color of line. * * @return The instance of UILabel. */ + (instancetype)hyb_addTopLineToView:(UIView *)toView distance:(CGFloat)distance height:(CGFloat)height color:(UIColor *)color; /** * @author https://github.com/CoderJackyHuang * * Add a line to the view of bottom. * * @param toView The view that needs to add a line. * @param height The line height * @param color The color of line. * * @return The instance of UILabel. */ + (instancetype)hyb_addBottomLineToView:(UIView *)toView height:(CGFloat)height color:(UIColor *)color; /** * @author https://github.com/CoderJackyHuang * * Add a line to the view of bottom with a distance of top. * * @param toView The view that needs to add a line. * @param distance The distance to the top. * @param height The line height. * @param color The line's background color. * * @return The instance of UILabel. */ + (instancetype)hyb_addBottomLineToView:(UIView *)toView distance:(CGFloat)distance height:(CGFloat)height color:(UIColor *)color; /** * @author https://github.com/CoderJackyHuang * * Add a line to the view of top with left and right padding. * * @param toView The view that needs to add a line. * @param leftPadding The padding of left. * @param rightPadding The padding of right. * @param height The line height. * @param color The line's color. * * @return The instance of UILabel. */ + (instancetype)hyb_addTopLineToView:(UIView *)toView leftPadding:(CGFloat)leftPadding rightPadding:(CGFloat)rightPadding height:(CGFloat)height color:(UIColor *)color; /** * @author https://github.com/CoderJackyHuang * * Add a line to the view of Bottom with left and right padding. * * @param toView The view that needs to add a line. * @param leftPadding The padding of left. * @param rightPadding The padding of right. * @param height The line height. * @param color The line's color. * * @return The instance of UILabel. */ + (instancetype)hyb_addBottomLineToView:(UIView *)toView leftPadding:(CGFloat)leftPadding rightPadding:(CGFloat)rightPadding height:(CGFloat)height color:(UIColor *)color; @end ================================================ FILE: HYBHelperKitSources/UIView+HYBMasonryKit.m ================================================ // // UIView+HYBMasonryKit.m // HYBHelperKit // // Created by huangyibiao on 16/7/6. // Copyright © 2016年 huangyibiao. All rights reserved. // #import "UIView+HYBMasonryKit.h" @implementation UIView (HYBMasonryKit) + (instancetype)hyb_viewWithSuperView:(UIView *)superView { return [self hyb_viewWithSuperView:superView onTaped:nil]; } + (instancetype)hyb_viewWithSuperView:(UIView *)superView onTaped:(HYBTapGestureBlock)onTaped { return [self hyb_viewWithSuperView:superView constraints:nil onTaped:onTaped]; } + (instancetype)hyb_viewWithSuperView:(UIView *)superView constraints:(HYBConstraintMaker)constraints { return [self hyb_viewWithSuperView:superView constraints:constraints onTaped:nil]; } + (instancetype)hyb_viewWithSuperView:(UIView *)superView constraints:(HYBConstraintMaker)constraints onTaped:(HYBTapGestureBlock)onTaped { UIView *view = [[[self class] alloc] init]; if (onTaped) { [view hyb_addTapGestureWithCallback:onTaped]; } view.backgroundColor = kWhiteColor; [superView addSubview:view]; if (superView) { if (constraints) { [view mas_makeConstraints:^(MASConstraintMaker *make) { constraints(make); }]; } else { [view mas_makeConstraints:^(MASConstraintMaker *make) { make.edges.mas_equalTo(superView); }]; } } return view; } + (instancetype)hyb_addTopLineToView:(UIView *)toView height:(CGFloat)height color:(UIColor *)color { return [self hyb_addTopLineToView:toView leftPadding:0 rightPadding:0 height:height color:color]; } + (instancetype)hyb_addTopLineToView:(UIView *)toView distance:(CGFloat)distance height:(CGFloat)height color:(UIColor *)color { return [self hyb_private_addLineToView:toView isTop:YES distance:distance leftPadding:0 rightPadding:0 height:height color:color]; } + (instancetype)hyb_addTopLineToView:(UIView *)toView leftPadding:(CGFloat)leftPadding rightPadding:(CGFloat)rightPadding height:(CGFloat)height color:(UIColor *)color { return [self hyb_private_addLineToView:toView isTop:YES distance:0 leftPadding:leftPadding rightPadding:rightPadding height:height color:color]; } + (instancetype)hyb_addBottomLineToView:(UIView *)toView height:(CGFloat)height color:(UIColor *)color { return [self hyb_addBottomLineToView:toView leftPadding:0 rightPadding:0 height:height color:color]; } + (instancetype)hyb_addBottomLineToView:(UIView *)toView distance:(CGFloat)distance height:(CGFloat)height color:(UIColor *)color { return [self hyb_private_addLineToView:toView isTop:NO distance:distance leftPadding:0 rightPadding:0 height:height color:color]; } + (instancetype)hyb_addBottomLineToView:(UIView *)toView leftPadding:(CGFloat)leftPadding rightPadding:(CGFloat)rightPadding height:(CGFloat)height color:(UIColor *)color { return [self hyb_private_addLineToView:toView isTop:NO distance:0 leftPadding:leftPadding rightPadding:rightPadding height:height color:color]; } #pragma mark - Private + (instancetype)hyb_private_addLineToView:(UIView *)toView isTop:(BOOL)isTop distance:(CGFloat)distance leftPadding:(CGFloat)leftPadding rightPadding:(CGFloat)rightPadding height:(CGFloat)height color:(UIColor *)color { UIView *lineView = [[UIView alloc] init]; lineView.backgroundColor = color; [toView addSubview:lineView]; if (toView) { [lineView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(leftPadding); if (isTop) { make.top.mas_equalTo(distance); } else { make.bottom.mas_equalTo(distance); } make.right.mas_equalTo(rightPadding); make.height.mas_equalTo(height); }]; } return lineView; } @end ================================================ FILE: HYBHelperKitSources/UIWebView+HYBMasonryKit.h ================================================ // // HYBMasonryKit.h // HYBHelperKit // // Created by huangyibiao on 16/7/9. // Copyright © 2016年 huangyibiao. All rights reserved. // #import #import "HYBHelperKit.h" @interface UIWebView (HYBMasonryKit) /** * @author https://github.com/CoderJackyHuang * * Create a web view without layout. * * @param delegate UIWebViewDelegate * * @return The instance of UIWebView. */ + (instancetype)hyb_webViewWithDelegate:(id)delegate; /** * @author https://github.com/CoderJackyHuang * * Create a web view with a super view and add edges as layout. * * @param delegate UIWebViewDelegate * @param superView The super view of web view. * * @return The instance of UIWebView. */ + (instancetype)hyb_webViewWithDelegate:(id)delegate superView:(UIView *)superView; /** * @author https://github.com/CoderJackyHuang * * Create a web view with a super view and add edges as layout. * * @param delegate UIWebViewDelegate * @param superView The super view of web view. * @param edges The edges inset. * * @return The instance of UIWebView. */ + (instancetype)hyb_webViewWithDelegate:(id)delegate superView:(UIView *)superView edges:(UIEdgeInsets)edges; /** * @author https://github.com/CoderJackyHuang * * Create a web view with a super view and specify layout. * * @param delegate UIWebViewDelegate * @param superView The super view of web view. * @param constraints The constraints added to the web view. * * @return The instance of UIWebView. */ + (instancetype)hyb_webViewWithDelegate:(id)delegate superView:(UIView *)superView constraints:(HYBConstraintMaker)constraints; @end ================================================ FILE: HYBHelperKitSources/UIWebView+HYBMasonryKit.m ================================================ // // HYBMasonryKit.m // HYBHelperKit // // Created by huangyibiao on 16/7/9. // Copyright © 2016年 huangyibiao. All rights reserved. // #import "UIWebView+HYBMasonryKit.h" @implementation UIWebView (HYBMasonryKit) + (instancetype)hyb_webViewWithDelegate:(id)delegate { return [self hyb_webViewWithDelegate:delegate superView:nil]; } + (instancetype)hyb_webViewWithDelegate:(id)delegate superView:(UIView *)superView { return [self hyb_webViewWithDelegate:delegate superView:superView edges:UIEdgeInsetsZero]; } + (instancetype)hyb_webViewWithDelegate:(id)delegate superView:(UIView *)superView edges:(UIEdgeInsets)edges { return [self hyb_webViewWithDelegate:delegate superView:superView constraints:^(MASConstraintMaker *make) { make.edges.mas_equalTo(superView).insets(edges); }]; } + (instancetype)hyb_webViewWithDelegate:(id)delegate superView:(UIView *)superView constraints:(HYBConstraintMaker)constraints { UIWebView *webView = [[UIWebView alloc] init]; // 自适应屏幕大小进行缩放 webView.userInteractionEnabled = YES; webView.delegate = delegate; webView.scalesPageToFit = YES; webView.scrollView.showsVerticalScrollIndicator = NO; [superView addSubview:webView]; if (superView) { if (constraints) { [webView mas_makeConstraints:^(MASConstraintMaker *make) { constraints(make); }]; } else { [webView mas_makeConstraints:^(MASConstraintMaker *make) { make.edges.equalTo(superView); }]; } } return webView; } @end ================================================ FILE: HYBHelperKitTests/ArrayTests.m ================================================ // // ArrayTests.m // HYBHelperKit // // Created by huangyibiao on 16/6/29. // Copyright © 2016年 huangyibiao. All rights reserved. // #import #import "NSArray+HYBHelperKit.h" #import "NSMutableArray+HYBHelperKit.h" @interface ArrayTests : XCTestCase @end @implementation ArrayTests - (void)setUp { [super setUp]; // Put setup code here. This method is called before the invocation of each test method in the class. } - (void)tearDown { // Put teardown code here. This method is called after the invocation of each test method in the class. [super tearDown]; } - (void)testExample { NSArray *array = @[@"sdf", @"s"]; XCTAssert([[array hyb_objectAtIndex:0] isEqualToString:@"sdf"]); XCTAssert([[array hyb_objectAtIndex:1] isEqualToString:@"s"]); XCTAssert([array hyb_objectAtIndex:2] == nil); XCTAssert([array hyb_isContainsString:@"sdf"]); XCTAssert([array hyb_isContainsString:@"sdfs"] == NO); NSMutableArray *anotherArray = [[NSMutableArray alloc] init]; XCTAssert([anotherArray hyb_addObject:nil] == NO); XCTAssert([anotherArray hyb_addObject:@"sdf"]); XCTAssert([anotherArray hyb_insertObject:@"sdf2" atIndex:0] == YES); XCTAssert([anotherArray hyb_insertObject:@"sdf5" atIndex:anotherArray.count] == YES); XCTAssert([anotherArray hyb_insertObject:@"sdf1" atIndex:anotherArray.count+1] == NO); XCTAssert([anotherArray hyb_removeObjectAtIndex:0] == YES); XCTAssert([anotherArray hyb_removeObjectAtIndex:10] == NO); XCTAssert([anotherArray hyb_removeObjectAtIndex:[anotherArray count]] == NO); } - (void)testPerformanceExample { // This is an example of a performance test case. [self measureBlock:^{ // Put the code you want to measure the time of here. }]; } @end ================================================ FILE: HYBHelperKitTests/DictionaryTests.m ================================================ // // DictionaryTests.m // HYBHelperKit // // Created by huangyibiao on 16/6/30. // Copyright © 2016年 huangyibiao. All rights reserved. // #import #import "NSDictionary+HYBHelperKit.h" #import "NSMutableDictionary+HYBHelperKit.h" @interface DictionaryTests : XCTestCase @end @implementation DictionaryTests - (void)setUp { [super setUp]; // Put setup code here. This method is called before the invocation of each test method in the class. } - (void)tearDown { // Put teardown code here. This method is called after the invocation of each test method in the class. [super tearDown]; } - (void)testExample { XCTAssertNotNil([@{@"1": @"23"} hyb_objectForKey:@"1"]); XCTAssertEqual([@{@"1": @"23"} hyb_objectForKey:@"1"], @"23"); XCTAssertNil([@{@"1": @"23"} hyb_objectForKey:@"23"]); XCTAssertNil([@{@"1": @"23"} hyb_objectForKey:@""]); XCTAssertNil([@{@"1": @"23"} hyb_objectForKey:nil]); NSDictionary *dict = @{@"key" : @"value1", @"key1" : @(2), @"key2" : @(1), @"key3" : @(YES), @"key4" : @(NO), @"key5" : @{@"s": @"sdf"}, @"key6" : @[@1, @2, @3]}; XCTAssertEqual([dict hyb_integerForKey:@"key"], 0); XCTAssertEqual([dict hyb_integerForKey:@"key1"], 2); XCTAssertEqual([dict hyb_integerForKey:@"key2"], 1); XCTAssertEqual([dict hyb_integerForKey:@"key3"], 1); XCTAssertEqual([dict hyb_integerForKey:@"key4"], 0); XCTAssertEqual([dict hyb_numberForKey:@"key"], nil); XCTAssertEqual([dict hyb_numberForKey:@"key1"], @(2)); XCTAssertEqual([dict hyb_numberForKey:@"key2"], @1); XCTAssertEqual([dict hyb_numberForKey:@"key3"], @YES); XCTAssertEqual([dict hyb_numberForKey:@"key4"], @NO); XCTAssertEqual([dict hyb_floatForKey:@"key"], 0); XCTAssertEqual([dict hyb_floatForKey:@"key1"], 2); XCTAssertEqual([dict hyb_floatForKey:@"key2"], 1); XCTAssertEqual([dict hyb_floatForKey:@"key3"], 1); XCTAssertEqual([dict hyb_floatForKey:@"key4"], 0); XCTAssertEqual([dict hyb_doubleForKey:@"key"], 0); XCTAssertEqual([dict hyb_doubleForKey:@"key1"], 2); XCTAssertEqual([dict hyb_doubleForKey:@"key2"], 1); XCTAssertEqual([dict hyb_doubleForKey:@"key3"], 1); XCTAssertEqual([dict hyb_doubleForKey:@"key4"], 0); XCTAssert([[dict hyb_stringForKey:@"key"] isEqualToString:@"value1"]); XCTAssert([[dict hyb_stringForKey:@"key1"] isEqualToString:@"2"]); XCTAssert([[dict hyb_stringForKey:@"key2"] isEqualToString: @"1"]); XCTAssert([[dict hyb_stringForKey:@"key3"] isEqualToString:@"1"]); XCTAssert([[dict hyb_stringForKey:@"key4"] isEqualToString: @"0"]); XCTAssertEqual([dict hyb_dictionaryForKey:@"key"], nil); XCTAssertEqual([dict hyb_dictionaryForKey:@"key1"], nil); XCTAssertEqual([dict hyb_dictionaryForKey:@"key2"], nil); XCTAssertEqual([dict hyb_dictionaryForKey:@"key3"], nil); XCTAssertEqual([dict hyb_dictionaryForKey:@"key4"], nil); XCTAssert([[[dict hyb_dictionaryForKey:@"key5"] objectForKey:@"s"] isEqualToString: @"sdf"]); XCTAssertEqual([dict hyb_dictionaryForKey:@"key6"], nil); XCTAssertEqual([dict hyb_arrayForKey:@"key"], nil); XCTAssertEqual([dict hyb_arrayForKey:@"key1"], nil); XCTAssertEqual([dict hyb_arrayForKey:@"key2"], nil); XCTAssertEqual([dict hyb_arrayForKey:@"key3"], nil); XCTAssertEqual([dict hyb_arrayForKey:@"key4"], nil); XCTAssertEqual([dict hyb_arrayForKey:@"key5"], nil); XCTAssertEqual([[dict hyb_arrayForKey:@"key6"] objectAtIndex:0], @1); XCTAssertEqual([dict hyb_boolForKey:@"key"], NO); XCTAssertEqual([dict hyb_boolForKey:@"key1"], YES); XCTAssertEqual([dict hyb_boolForKey:@"key2"], YES); XCTAssertEqual([dict hyb_boolForKey:@"key3"], YES); XCTAssertEqual([dict hyb_boolForKey:@"key4"], NO); XCTAssertEqual([dict hyb_boolForKey:@"key5"], NO); XCTAssertEqual([dict hyb_boolForKey:@"key6"], NO); } - (void)testPerformanceExample { // This is an example of a performance test case. [self measureBlock:^{ // Put the code you want to measure the time of here. }]; } @end ================================================ FILE: HYBHelperKitTests/HYBHelperKitTests.m ================================================ // // HYBHelperKitTests.m // HYBHelperKitTests // // Created by huangyibiao on 16/6/29. // Copyright © 2016年 huangyibiao. All rights reserved. // #import #import "NSTimer+HYBHelperKit.h" #import "NSNumber+HYBHelperKit.h" @interface HYBHelperKitTests : XCTestCase @property (nonatomic, strong) NSTimer *timer; @property (nonatomic, strong) NSTimer *timer1; @end @implementation HYBHelperKitTests - (void)setUp { [super setUp]; NSUInteger count = 10; self.timer = [NSTimer hyb_scheduledTimerWithTimeInterval:0.5 repeats:YES callback:^(NSTimer *timer) { if (count <= 0) { [timer hyb_invalidate]; } }]; } - (void)tearDown { // Put teardown code here. This method is called after the invocation of each test method in the class. [super tearDown]; [self.timer hyb_invalidate]; } - (void)testNumber { NSNumber *v = @(10); XCTAssert([v.hyb_toString isEqualToString:@"10"]); } - (void)testTimerCount { NSUInteger count = 0; self.timer1 = [NSTimer hyb_scheduledTimerWithTimeInterval:0.5 count:2 callback:^(NSTimer *timer) { XCTAssert(count <= 2); }]; } - (void)testPerformanceExample { // This is an example of a performance test case. [self measureBlock:^{ // Put the code you want to measure the time of here. }]; } @end ================================================ FILE: HYBHelperKitTests/Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName $(PRODUCT_NAME) CFBundlePackageType BNDL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1 ================================================ FILE: HYBHelperKitTests/NSObjectTests.m ================================================ // // NSObjectTests.m // HYBHelperKit // // Created by huangyibiao on 16/6/29. // Copyright © 2016年 huangyibiao. All rights reserved. // #import #import "NSObject+HYBHelperKit.h" @interface NSObjectTests : XCTestCase @end @implementation NSObjectTests - (void)setUp { [super setUp]; // Put setup code here. This method is called before the invocation of each test method in the class. } - (void)tearDown { // Put teardown code here. This method is called after the invocation of each test method in the class. [super tearDown]; } - (void)testExample { XCTAssert([[self hyb_className] isEqualToString:@"NSObjectTests"]); } - (void)testPerformanceExample { // This is an example of a performance test case. [self measureBlock:^{ // Put the code you want to measure the time of here. }]; } @end ================================================ FILE: HYBHelperKitTests/NSStringTests.m ================================================ // // NSStringTests.m // HYBHelperKit // // Created by huangyibiao on 16/6/29. // Copyright © 2016年 huangyibiao. All rights reserved. // #import #import "NSString+HYBHelperKit.h" @interface NSStringTests : XCTestCase @end @implementation NSStringTests - (void)setUp { [super setUp]; // Put setup code here. This method is called before the invocation of each test method in the class. } - (void)tearDown { // Put teardown code here. This method is called after the invocation of each test method in the class. [super tearDown]; } - (void)testExample { XCTAssert([[@"123456" hyb_toMD5] isEqualToString:@"e10adc3949ba59abbe56e057f20f883e"]); XCTAssert([[@"123456" hyb_to16MD5] isEqualToString:@"49ba59abbe56e057"]); XCTAssert([[@"123456" hyb_sha1] isEqualToString:@"7c4a8d09ca3762af61e59520943dc26494f8941b"]); XCTAssert([[@"123456" hyb_sha256] isEqualToString:@"8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92"]); XCTAssert([[@"123456" hyb_sha512] isEqualToString:@"ba3253876aed6bc22d4a6ff53d8406c6ad864195ed144ab5c87621b6c233b548baeae6956df346ec8c17f5ea10f35ee3cbc514797ed7ddd3145464e2a0bab413"]); XCTAssert([@"123456" hyb_toData] != nil); XCTAssert([[NSString hyb_toStringWithData:[@"123456" hyb_toData]] isEqualToString:@"123456"]); XCTAssert([@"123" hyb_isEmail] == NO); XCTAssert([@"123@123" hyb_isEmail] == NO); XCTAssert([@"123@163.com" hyb_isEmail] == YES); XCTAssert([@"15001112099" hyb_isMobilePhone] == YES); XCTAssert([@"13001112099" hyb_isMobilePhone] == YES); XCTAssert([@"11001112099" hyb_isMobilePhone] == NO); XCTAssert([@"12001112099" hyb_isMobilePhone] == NO); XCTAssert([@"17001112099" hyb_isMobilePhone] == YES); XCTAssert([@"1235232" hyb_isContainString:@"123"] == YES); XCTAssert([@"1235232" hyb_isContainString:@"123s"] == NO); } - (void)testPerformanceExample { // This is an example of a performance test case. [self measureBlock:^{ // Put the code you want to measure the time of here. }]; } @end ================================================ FILE: HYBHelperKitTests/NSTimerTests.m ================================================ // // NSTimerTests.m // HYBHelperKit // // Created by huangyibiao on 16/6/29. // Copyright © 2016年 huangyibiao. All rights reserved. // #import @interface NSTimerTests : XCTestCase @end @implementation NSTimerTests - (void)setUp { [super setUp]; // Put setup code here. This method is called before the invocation of each test method in the class. } - (void)tearDown { // Put teardown code here. This method is called after the invocation of each test method in the class. [super tearDown]; } - (void)testExample { // This is an example of a functional test case. // Use XCTAssert and related functions to verify your tests produce the correct results. } - (void)testPerformanceExample { // This is an example of a performance test case. [self measureBlock:^{ // Put the code you want to measure the time of here. }]; } @end ================================================ FILE: HYBHelperKitTests/NSUserDefaultsTests.m ================================================ // // NSUserDefaultsTests.m // HYBHelperKit // // Created by huangyibiao on 16/6/29. // Copyright © 2016年 huangyibiao. All rights reserved. // #import #import "NSUserDefaults+HYBHelperKit.h" @interface NSUserDefaultsTests : XCTestCase @end @implementation NSUserDefaultsTests - (void)setUp { [super setUp]; // Put setup code here. This method is called before the invocation of each test method in the class. } - (void)tearDown { // Put teardown code here. This method is called after the invocation of each test method in the class. [super tearDown]; } - (void)testNullNilObject { NSDictionary *dict = @{@"key1" : [NSNull null], @"key2" : @[@"s", @"df", @"null"]}; BOOL ok = [[NSUserDefaults standardUserDefaults] hyb_setSafeObject:dict forKey:@"s"]; XCTAssert(ok); ok = [[NSUserDefaults standardUserDefaults] hyb_setSafeObject:dict forKey:@""]; XCTAssert(ok); ok = [[NSUserDefaults standardUserDefaults] hyb_setSafeObject:dict forKey:nil]; XCTAssert(ok == NO); ok = [[NSUserDefaults standardUserDefaults] hyb_setSafeObject:nil forKey:@"s"]; XCTAssert(ok == NO); ok = [[NSUserDefaults standardUserDefaults] hyb_setSafeObject:[NSNull null] forKey:@"s"]; XCTAssert(ok == NO); } - (void)testPerformanceExample { // This is an example of a performance test case. [self measureBlock:^{ // Put the code you want to measure the time of here. }]; } @end ================================================ FILE: LICENSE ================================================ The MIT License (MIT) Copyright (c) 2016 JackyHuang Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: Podfile ================================================ source 'https://github.com/CocoaPods/Specs.git' platform :ios, '7.0' target 'HYBHelperKit' do pod 'Masonry', '~> 1.0.1' end target 'HYBHelperKitTests' do end ================================================ FILE: Pods/Masonry/LICENSE ================================================ Copyright (c) 2011-2012 Masonry Team - https://github.com/Masonry Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: Pods/Masonry/Masonry/MASCompositeConstraint.h ================================================ // // MASCompositeConstraint.h // Masonry // // Created by Jonas Budelmann on 21/07/13. // Copyright (c) 2013 cloudling. All rights reserved. // #import "MASConstraint.h" #import "MASUtilities.h" /** * A group of MASConstraint objects */ @interface MASCompositeConstraint : MASConstraint /** * Creates a composite with a predefined array of children * * @param children child MASConstraints * * @return a composite constraint */ - (id)initWithChildren:(NSArray *)children; @end ================================================ FILE: Pods/Masonry/Masonry/MASCompositeConstraint.m ================================================ // // MASCompositeConstraint.m // Masonry // // Created by Jonas Budelmann on 21/07/13. // Copyright (c) 2013 cloudling. All rights reserved. // #import "MASCompositeConstraint.h" #import "MASConstraint+Private.h" @interface MASCompositeConstraint () @property (nonatomic, strong) id mas_key; @property (nonatomic, strong) NSMutableArray *childConstraints; @end @implementation MASCompositeConstraint - (id)initWithChildren:(NSArray *)children { self = [super init]; if (!self) return nil; _childConstraints = [children mutableCopy]; for (MASConstraint *constraint in _childConstraints) { constraint.delegate = self; } return self; } #pragma mark - MASConstraintDelegate - (void)constraint:(MASConstraint *)constraint shouldBeReplacedWithConstraint:(MASConstraint *)replacementConstraint { NSUInteger index = [self.childConstraints indexOfObject:constraint]; NSAssert(index != NSNotFound, @"Could not find constraint %@", constraint); [self.childConstraints replaceObjectAtIndex:index withObject:replacementConstraint]; } - (MASConstraint *)constraint:(MASConstraint __unused *)constraint addConstraintWithLayoutAttribute:(NSLayoutAttribute)layoutAttribute { id strongDelegate = self.delegate; MASConstraint *newConstraint = [strongDelegate constraint:self addConstraintWithLayoutAttribute:layoutAttribute]; newConstraint.delegate = self; [self.childConstraints addObject:newConstraint]; return newConstraint; } #pragma mark - NSLayoutConstraint multiplier proxies - (MASConstraint * (^)(CGFloat))multipliedBy { return ^id(CGFloat multiplier) { for (MASConstraint *constraint in self.childConstraints) { constraint.multipliedBy(multiplier); } return self; }; } - (MASConstraint * (^)(CGFloat))dividedBy { return ^id(CGFloat divider) { for (MASConstraint *constraint in self.childConstraints) { constraint.dividedBy(divider); } return self; }; } #pragma mark - MASLayoutPriority proxy - (MASConstraint * (^)(MASLayoutPriority))priority { return ^id(MASLayoutPriority priority) { for (MASConstraint *constraint in self.childConstraints) { constraint.priority(priority); } return self; }; } #pragma mark - NSLayoutRelation proxy - (MASConstraint * (^)(id, NSLayoutRelation))equalToWithRelation { return ^id(id attr, NSLayoutRelation relation) { for (MASConstraint *constraint in self.childConstraints.copy) { constraint.equalToWithRelation(attr, relation); } return self; }; } #pragma mark - attribute chaining - (MASConstraint *)addConstraintWithLayoutAttribute:(NSLayoutAttribute)layoutAttribute { [self constraint:self addConstraintWithLayoutAttribute:layoutAttribute]; return self; } #pragma mark - Animator proxy #if TARGET_OS_MAC && !(TARGET_OS_IPHONE || TARGET_OS_TV) - (MASConstraint *)animator { for (MASConstraint *constraint in self.childConstraints) { [constraint animator]; } return self; } #endif #pragma mark - debug helpers - (MASConstraint * (^)(id))key { return ^id(id key) { self.mas_key = key; int i = 0; for (MASConstraint *constraint in self.childConstraints) { constraint.key([NSString stringWithFormat:@"%@[%d]", key, i++]); } return self; }; } #pragma mark - NSLayoutConstraint constant setters - (void)setInsets:(MASEdgeInsets)insets { for (MASConstraint *constraint in self.childConstraints) { constraint.insets = insets; } } - (void)setOffset:(CGFloat)offset { for (MASConstraint *constraint in self.childConstraints) { constraint.offset = offset; } } - (void)setSizeOffset:(CGSize)sizeOffset { for (MASConstraint *constraint in self.childConstraints) { constraint.sizeOffset = sizeOffset; } } - (void)setCenterOffset:(CGPoint)centerOffset { for (MASConstraint *constraint in self.childConstraints) { constraint.centerOffset = centerOffset; } } #pragma mark - MASConstraint - (void)activate { for (MASConstraint *constraint in self.childConstraints) { [constraint activate]; } } - (void)deactivate { for (MASConstraint *constraint in self.childConstraints) { [constraint deactivate]; } } - (void)install { for (MASConstraint *constraint in self.childConstraints) { constraint.updateExisting = self.updateExisting; [constraint install]; } } - (void)uninstall { for (MASConstraint *constraint in self.childConstraints) { [constraint uninstall]; } } @end ================================================ FILE: Pods/Masonry/Masonry/MASConstraint+Private.h ================================================ // // MASConstraint+Private.h // Masonry // // Created by Nick Tymchenko on 29/04/14. // Copyright (c) 2014 cloudling. All rights reserved. // #import "MASConstraint.h" @protocol MASConstraintDelegate; @interface MASConstraint () /** * Whether or not to check for an existing constraint instead of adding constraint */ @property (nonatomic, assign) BOOL updateExisting; /** * Usually MASConstraintMaker but could be a parent MASConstraint */ @property (nonatomic, weak) id delegate; /** * Based on a provided value type, is equal to calling: * NSNumber - setOffset: * NSValue with CGPoint - setPointOffset: * NSValue with CGSize - setSizeOffset: * NSValue with MASEdgeInsets - setInsets: */ - (void)setLayoutConstantWithValue:(NSValue *)value; @end @interface MASConstraint (Abstract) /** * Sets the constraint relation to given NSLayoutRelation * returns a block which accepts one of the following: * MASViewAttribute, UIView, NSValue, NSArray * see readme for more details. */ - (MASConstraint * (^)(id, NSLayoutRelation))equalToWithRelation; /** * Override to set a custom chaining behaviour */ - (MASConstraint *)addConstraintWithLayoutAttribute:(NSLayoutAttribute)layoutAttribute; @end @protocol MASConstraintDelegate /** * Notifies the delegate when the constraint needs to be replaced with another constraint. For example * A MASViewConstraint may turn into a MASCompositeConstraint when an array is passed to one of the equality blocks */ - (void)constraint:(MASConstraint *)constraint shouldBeReplacedWithConstraint:(MASConstraint *)replacementConstraint; - (MASConstraint *)constraint:(MASConstraint *)constraint addConstraintWithLayoutAttribute:(NSLayoutAttribute)layoutAttribute; @end ================================================ FILE: Pods/Masonry/Masonry/MASConstraint.h ================================================ // // MASConstraint.h // Masonry // // Created by Jonas Budelmann on 22/07/13. // Copyright (c) 2013 cloudling. All rights reserved. // #import "MASUtilities.h" /** * Enables Constraints to be created with chainable syntax * Constraint can represent single NSLayoutConstraint (MASViewConstraint) * or a group of NSLayoutConstraints (MASComposisteConstraint) */ @interface MASConstraint : NSObject // Chaining Support /** * Modifies the NSLayoutConstraint constant, * only affects MASConstraints in which the first item's NSLayoutAttribute is one of the following * NSLayoutAttributeTop, NSLayoutAttributeLeft, NSLayoutAttributeBottom, NSLayoutAttributeRight */ - (MASConstraint * (^)(MASEdgeInsets insets))insets; /** * Modifies the NSLayoutConstraint constant, * only affects MASConstraints in which the first item's NSLayoutAttribute is one of the following * NSLayoutAttributeWidth, NSLayoutAttributeHeight */ - (MASConstraint * (^)(CGSize offset))sizeOffset; /** * Modifies the NSLayoutConstraint constant, * only affects MASConstraints in which the first item's NSLayoutAttribute is one of the following * NSLayoutAttributeCenterX, NSLayoutAttributeCenterY */ - (MASConstraint * (^)(CGPoint offset))centerOffset; /** * Modifies the NSLayoutConstraint constant */ - (MASConstraint * (^)(CGFloat offset))offset; /** * Modifies the NSLayoutConstraint constant based on a value type */ - (MASConstraint * (^)(NSValue *value))valueOffset; /** * Sets the NSLayoutConstraint multiplier property */ - (MASConstraint * (^)(CGFloat multiplier))multipliedBy; /** * Sets the NSLayoutConstraint multiplier to 1.0/dividedBy */ - (MASConstraint * (^)(CGFloat divider))dividedBy; /** * Sets the NSLayoutConstraint priority to a float or MASLayoutPriority */ - (MASConstraint * (^)(MASLayoutPriority priority))priority; /** * Sets the NSLayoutConstraint priority to MASLayoutPriorityLow */ - (MASConstraint * (^)())priorityLow; /** * Sets the NSLayoutConstraint priority to MASLayoutPriorityMedium */ - (MASConstraint * (^)())priorityMedium; /** * Sets the NSLayoutConstraint priority to MASLayoutPriorityHigh */ - (MASConstraint * (^)())priorityHigh; /** * Sets the constraint relation to NSLayoutRelationEqual * returns a block which accepts one of the following: * MASViewAttribute, UIView, NSValue, NSArray * see readme for more details. */ - (MASConstraint * (^)(id attr))equalTo; /** * Sets the constraint relation to NSLayoutRelationGreaterThanOrEqual * returns a block which accepts one of the following: * MASViewAttribute, UIView, NSValue, NSArray * see readme for more details. */ - (MASConstraint * (^)(id attr))greaterThanOrEqualTo; /** * Sets the constraint relation to NSLayoutRelationLessThanOrEqual * returns a block which accepts one of the following: * MASViewAttribute, UIView, NSValue, NSArray * see readme for more details. */ - (MASConstraint * (^)(id attr))lessThanOrEqualTo; /** * Optional semantic property which has no effect but improves the readability of constraint */ - (MASConstraint *)with; /** * Optional semantic property which has no effect but improves the readability of constraint */ - (MASConstraint *)and; /** * Creates a new MASCompositeConstraint with the called attribute and reciever */ - (MASConstraint *)left; - (MASConstraint *)top; - (MASConstraint *)right; - (MASConstraint *)bottom; - (MASConstraint *)leading; - (MASConstraint *)trailing; - (MASConstraint *)width; - (MASConstraint *)height; - (MASConstraint *)centerX; - (MASConstraint *)centerY; - (MASConstraint *)baseline; #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100) - (MASConstraint *)firstBaseline; - (MASConstraint *)lastBaseline; #endif #if TARGET_OS_IPHONE || TARGET_OS_TV - (MASConstraint *)leftMargin; - (MASConstraint *)rightMargin; - (MASConstraint *)topMargin; - (MASConstraint *)bottomMargin; - (MASConstraint *)leadingMargin; - (MASConstraint *)trailingMargin; - (MASConstraint *)centerXWithinMargins; - (MASConstraint *)centerYWithinMargins; #endif /** * Sets the constraint debug name */ - (MASConstraint * (^)(id key))key; // NSLayoutConstraint constant Setters // for use outside of mas_updateConstraints/mas_makeConstraints blocks /** * Modifies the NSLayoutConstraint constant, * only affects MASConstraints in which the first item's NSLayoutAttribute is one of the following * NSLayoutAttributeTop, NSLayoutAttributeLeft, NSLayoutAttributeBottom, NSLayoutAttributeRight */ - (void)setInsets:(MASEdgeInsets)insets; /** * Modifies the NSLayoutConstraint constant, * only affects MASConstraints in which the first item's NSLayoutAttribute is one of the following * NSLayoutAttributeWidth, NSLayoutAttributeHeight */ - (void)setSizeOffset:(CGSize)sizeOffset; /** * Modifies the NSLayoutConstraint constant, * only affects MASConstraints in which the first item's NSLayoutAttribute is one of the following * NSLayoutAttributeCenterX, NSLayoutAttributeCenterY */ - (void)setCenterOffset:(CGPoint)centerOffset; /** * Modifies the NSLayoutConstraint constant */ - (void)setOffset:(CGFloat)offset; // NSLayoutConstraint Installation support #if TARGET_OS_MAC && !(TARGET_OS_IPHONE || TARGET_OS_TV) /** * Whether or not to go through the animator proxy when modifying the constraint */ @property (nonatomic, copy, readonly) MASConstraint *animator; #endif /** * Activates an NSLayoutConstraint if it's supported by an OS. * Invokes install otherwise. */ - (void)activate; /** * Deactivates previously installed/activated NSLayoutConstraint. */ - (void)deactivate; /** * Creates a NSLayoutConstraint and adds it to the appropriate view. */ - (void)install; /** * Removes previously installed NSLayoutConstraint */ - (void)uninstall; @end /** * Convenience auto-boxing macros for MASConstraint methods. * * Defining MAS_SHORTHAND_GLOBALS will turn on auto-boxing for default syntax. * A potential drawback of this is that the unprefixed macros will appear in global scope. */ #define mas_equalTo(...) equalTo(MASBoxValue((__VA_ARGS__))) #define mas_greaterThanOrEqualTo(...) greaterThanOrEqualTo(MASBoxValue((__VA_ARGS__))) #define mas_lessThanOrEqualTo(...) lessThanOrEqualTo(MASBoxValue((__VA_ARGS__))) #define mas_offset(...) valueOffset(MASBoxValue((__VA_ARGS__))) #ifdef MAS_SHORTHAND_GLOBALS #define equalTo(...) mas_equalTo(__VA_ARGS__) #define greaterThanOrEqualTo(...) mas_greaterThanOrEqualTo(__VA_ARGS__) #define lessThanOrEqualTo(...) mas_lessThanOrEqualTo(__VA_ARGS__) #define offset(...) mas_offset(__VA_ARGS__) #endif @interface MASConstraint (AutoboxingSupport) /** * Aliases to corresponding relation methods (for shorthand macros) * Also needed to aid autocompletion */ - (MASConstraint * (^)(id attr))mas_equalTo; - (MASConstraint * (^)(id attr))mas_greaterThanOrEqualTo; - (MASConstraint * (^)(id attr))mas_lessThanOrEqualTo; /** * A dummy method to aid autocompletion */ - (MASConstraint * (^)(id offset))mas_offset; @end ================================================ FILE: Pods/Masonry/Masonry/MASConstraint.m ================================================ // // MASConstraint.m // Masonry // // Created by Nick Tymchenko on 1/20/14. // #import "MASConstraint.h" #import "MASConstraint+Private.h" #define MASMethodNotImplemented() \ @throw [NSException exceptionWithName:NSInternalInconsistencyException \ reason:[NSString stringWithFormat:@"You must override %@ in a subclass.", NSStringFromSelector(_cmd)] \ userInfo:nil] @implementation MASConstraint #pragma mark - Init - (id)init { NSAssert(![self isMemberOfClass:[MASConstraint class]], @"MASConstraint is an abstract class, you should not instantiate it directly."); return [super init]; } #pragma mark - NSLayoutRelation proxies - (MASConstraint * (^)(id))equalTo { return ^id(id attribute) { return self.equalToWithRelation(attribute, NSLayoutRelationEqual); }; } - (MASConstraint * (^)(id))mas_equalTo { return ^id(id attribute) { return self.equalToWithRelation(attribute, NSLayoutRelationEqual); }; } - (MASConstraint * (^)(id))greaterThanOrEqualTo { return ^id(id attribute) { return self.equalToWithRelation(attribute, NSLayoutRelationGreaterThanOrEqual); }; } - (MASConstraint * (^)(id))mas_greaterThanOrEqualTo { return ^id(id attribute) { return self.equalToWithRelation(attribute, NSLayoutRelationGreaterThanOrEqual); }; } - (MASConstraint * (^)(id))lessThanOrEqualTo { return ^id(id attribute) { return self.equalToWithRelation(attribute, NSLayoutRelationLessThanOrEqual); }; } - (MASConstraint * (^)(id))mas_lessThanOrEqualTo { return ^id(id attribute) { return self.equalToWithRelation(attribute, NSLayoutRelationLessThanOrEqual); }; } #pragma mark - MASLayoutPriority proxies - (MASConstraint * (^)())priorityLow { return ^id{ self.priority(MASLayoutPriorityDefaultLow); return self; }; } - (MASConstraint * (^)())priorityMedium { return ^id{ self.priority(MASLayoutPriorityDefaultMedium); return self; }; } - (MASConstraint * (^)())priorityHigh { return ^id{ self.priority(MASLayoutPriorityDefaultHigh); return self; }; } #pragma mark - NSLayoutConstraint constant proxies - (MASConstraint * (^)(MASEdgeInsets))insets { return ^id(MASEdgeInsets insets){ self.insets = insets; return self; }; } - (MASConstraint * (^)(CGSize))sizeOffset { return ^id(CGSize offset) { self.sizeOffset = offset; return self; }; } - (MASConstraint * (^)(CGPoint))centerOffset { return ^id(CGPoint offset) { self.centerOffset = offset; return self; }; } - (MASConstraint * (^)(CGFloat))offset { return ^id(CGFloat offset){ self.offset = offset; return self; }; } - (MASConstraint * (^)(NSValue *value))valueOffset { return ^id(NSValue *offset) { NSAssert([offset isKindOfClass:NSValue.class], @"expected an NSValue offset, got: %@", offset); [self setLayoutConstantWithValue:offset]; return self; }; } - (MASConstraint * (^)(id offset))mas_offset { // Will never be called due to macro return nil; } #pragma mark - NSLayoutConstraint constant setter - (void)setLayoutConstantWithValue:(NSValue *)value { if ([value isKindOfClass:NSNumber.class]) { self.offset = [(NSNumber *)value doubleValue]; } else if (strcmp(value.objCType, @encode(CGPoint)) == 0) { CGPoint point; [value getValue:&point]; self.centerOffset = point; } else if (strcmp(value.objCType, @encode(CGSize)) == 0) { CGSize size; [value getValue:&size]; self.sizeOffset = size; } else if (strcmp(value.objCType, @encode(MASEdgeInsets)) == 0) { MASEdgeInsets insets; [value getValue:&insets]; self.insets = insets; } else { NSAssert(NO, @"attempting to set layout constant with unsupported value: %@", value); } } #pragma mark - Semantic properties - (MASConstraint *)with { return self; } - (MASConstraint *)and { return self; } #pragma mark - Chaining - (MASConstraint *)addConstraintWithLayoutAttribute:(NSLayoutAttribute __unused)layoutAttribute { MASMethodNotImplemented(); } - (MASConstraint *)left { return [self addConstraintWithLayoutAttribute:NSLayoutAttributeLeft]; } - (MASConstraint *)top { return [self addConstraintWithLayoutAttribute:NSLayoutAttributeTop]; } - (MASConstraint *)right { return [self addConstraintWithLayoutAttribute:NSLayoutAttributeRight]; } - (MASConstraint *)bottom { return [self addConstraintWithLayoutAttribute:NSLayoutAttributeBottom]; } - (MASConstraint *)leading { return [self addConstraintWithLayoutAttribute:NSLayoutAttributeLeading]; } - (MASConstraint *)trailing { return [self addConstraintWithLayoutAttribute:NSLayoutAttributeTrailing]; } - (MASConstraint *)width { return [self addConstraintWithLayoutAttribute:NSLayoutAttributeWidth]; } - (MASConstraint *)height { return [self addConstraintWithLayoutAttribute:NSLayoutAttributeHeight]; } - (MASConstraint *)centerX { return [self addConstraintWithLayoutAttribute:NSLayoutAttributeCenterX]; } - (MASConstraint *)centerY { return [self addConstraintWithLayoutAttribute:NSLayoutAttributeCenterY]; } - (MASConstraint *)baseline { return [self addConstraintWithLayoutAttribute:NSLayoutAttributeBaseline]; } #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100) - (MASConstraint *)firstBaseline { return [self addConstraintWithLayoutAttribute:NSLayoutAttributeFirstBaseline]; } - (MASConstraint *)lastBaseline { return [self addConstraintWithLayoutAttribute:NSLayoutAttributeLastBaseline]; } #endif #if TARGET_OS_IPHONE || TARGET_OS_TV - (MASConstraint *)leftMargin { return [self addConstraintWithLayoutAttribute:NSLayoutAttributeLeftMargin]; } - (MASConstraint *)rightMargin { return [self addConstraintWithLayoutAttribute:NSLayoutAttributeRightMargin]; } - (MASConstraint *)topMargin { return [self addConstraintWithLayoutAttribute:NSLayoutAttributeTopMargin]; } - (MASConstraint *)bottomMargin { return [self addConstraintWithLayoutAttribute:NSLayoutAttributeBottomMargin]; } - (MASConstraint *)leadingMargin { return [self addConstraintWithLayoutAttribute:NSLayoutAttributeLeadingMargin]; } - (MASConstraint *)trailingMargin { return [self addConstraintWithLayoutAttribute:NSLayoutAttributeTrailingMargin]; } - (MASConstraint *)centerXWithinMargins { return [self addConstraintWithLayoutAttribute:NSLayoutAttributeCenterXWithinMargins]; } - (MASConstraint *)centerYWithinMargins { return [self addConstraintWithLayoutAttribute:NSLayoutAttributeCenterYWithinMargins]; } #endif #pragma mark - Abstract - (MASConstraint * (^)(CGFloat multiplier))multipliedBy { MASMethodNotImplemented(); } - (MASConstraint * (^)(CGFloat divider))dividedBy { MASMethodNotImplemented(); } - (MASConstraint * (^)(MASLayoutPriority priority))priority { MASMethodNotImplemented(); } - (MASConstraint * (^)(id, NSLayoutRelation))equalToWithRelation { MASMethodNotImplemented(); } - (MASConstraint * (^)(id key))key { MASMethodNotImplemented(); } - (void)setInsets:(MASEdgeInsets __unused)insets { MASMethodNotImplemented(); } - (void)setSizeOffset:(CGSize __unused)sizeOffset { MASMethodNotImplemented(); } - (void)setCenterOffset:(CGPoint __unused)centerOffset { MASMethodNotImplemented(); } - (void)setOffset:(CGFloat __unused)offset { MASMethodNotImplemented(); } #if TARGET_OS_MAC && !(TARGET_OS_IPHONE || TARGET_OS_TV) - (MASConstraint *)animator { MASMethodNotImplemented(); } #endif - (void)activate { MASMethodNotImplemented(); } - (void)deactivate { MASMethodNotImplemented(); } - (void)install { MASMethodNotImplemented(); } - (void)uninstall { MASMethodNotImplemented(); } @end ================================================ FILE: Pods/Masonry/Masonry/MASConstraintMaker.h ================================================ // // MASConstraintBuilder.h // Masonry // // Created by Jonas Budelmann on 20/07/13. // Copyright (c) 2013 cloudling. All rights reserved. // #import "MASConstraint.h" #import "MASUtilities.h" typedef NS_OPTIONS(NSInteger, MASAttribute) { MASAttributeLeft = 1 << NSLayoutAttributeLeft, MASAttributeRight = 1 << NSLayoutAttributeRight, MASAttributeTop = 1 << NSLayoutAttributeTop, MASAttributeBottom = 1 << NSLayoutAttributeBottom, MASAttributeLeading = 1 << NSLayoutAttributeLeading, MASAttributeTrailing = 1 << NSLayoutAttributeTrailing, MASAttributeWidth = 1 << NSLayoutAttributeWidth, MASAttributeHeight = 1 << NSLayoutAttributeHeight, MASAttributeCenterX = 1 << NSLayoutAttributeCenterX, MASAttributeCenterY = 1 << NSLayoutAttributeCenterY, MASAttributeBaseline = 1 << NSLayoutAttributeBaseline, #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100) MASAttributeFirstBaseline = 1 << NSLayoutAttributeFirstBaseline, MASAttributeLastBaseline = 1 << NSLayoutAttributeLastBaseline, #endif #if TARGET_OS_IPHONE || TARGET_OS_TV MASAttributeLeftMargin = 1 << NSLayoutAttributeLeftMargin, MASAttributeRightMargin = 1 << NSLayoutAttributeRightMargin, MASAttributeTopMargin = 1 << NSLayoutAttributeTopMargin, MASAttributeBottomMargin = 1 << NSLayoutAttributeBottomMargin, MASAttributeLeadingMargin = 1 << NSLayoutAttributeLeadingMargin, MASAttributeTrailingMargin = 1 << NSLayoutAttributeTrailingMargin, MASAttributeCenterXWithinMargins = 1 << NSLayoutAttributeCenterXWithinMargins, MASAttributeCenterYWithinMargins = 1 << NSLayoutAttributeCenterYWithinMargins, #endif }; /** * Provides factory methods for creating MASConstraints. * Constraints are collected until they are ready to be installed * */ @interface MASConstraintMaker : NSObject /** * The following properties return a new MASViewConstraint * with the first item set to the makers associated view and the appropriate MASViewAttribute */ @property (nonatomic, strong, readonly) MASConstraint *left; @property (nonatomic, strong, readonly) MASConstraint *top; @property (nonatomic, strong, readonly) MASConstraint *right; @property (nonatomic, strong, readonly) MASConstraint *bottom; @property (nonatomic, strong, readonly) MASConstraint *leading; @property (nonatomic, strong, readonly) MASConstraint *trailing; @property (nonatomic, strong, readonly) MASConstraint *width; @property (nonatomic, strong, readonly) MASConstraint *height; @property (nonatomic, strong, readonly) MASConstraint *centerX; @property (nonatomic, strong, readonly) MASConstraint *centerY; @property (nonatomic, strong, readonly) MASConstraint *baseline; #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100) @property (nonatomic, strong, readonly) MASConstraint *firstBaseline; @property (nonatomic, strong, readonly) MASConstraint *lastBaseline; #endif #if TARGET_OS_IPHONE || TARGET_OS_TV @property (nonatomic, strong, readonly) MASConstraint *leftMargin; @property (nonatomic, strong, readonly) MASConstraint *rightMargin; @property (nonatomic, strong, readonly) MASConstraint *topMargin; @property (nonatomic, strong, readonly) MASConstraint *bottomMargin; @property (nonatomic, strong, readonly) MASConstraint *leadingMargin; @property (nonatomic, strong, readonly) MASConstraint *trailingMargin; @property (nonatomic, strong, readonly) MASConstraint *centerXWithinMargins; @property (nonatomic, strong, readonly) MASConstraint *centerYWithinMargins; #endif /** * Returns a block which creates a new MASCompositeConstraint with the first item set * to the makers associated view and children corresponding to the set bits in the * MASAttribute parameter. Combine multiple attributes via binary-or. */ @property (nonatomic, strong, readonly) MASConstraint *(^attributes)(MASAttribute attrs); /** * Creates a MASCompositeConstraint with type MASCompositeConstraintTypeEdges * which generates the appropriate MASViewConstraint children (top, left, bottom, right) * with the first item set to the makers associated view */ @property (nonatomic, strong, readonly) MASConstraint *edges; /** * Creates a MASCompositeConstraint with type MASCompositeConstraintTypeSize * which generates the appropriate MASViewConstraint children (width, height) * with the first item set to the makers associated view */ @property (nonatomic, strong, readonly) MASConstraint *size; /** * Creates a MASCompositeConstraint with type MASCompositeConstraintTypeCenter * which generates the appropriate MASViewConstraint children (centerX, centerY) * with the first item set to the makers associated view */ @property (nonatomic, strong, readonly) MASConstraint *center; /** * Whether or not to check for an existing constraint instead of adding constraint */ @property (nonatomic, assign) BOOL updateExisting; /** * Whether or not to remove existing constraints prior to installing */ @property (nonatomic, assign) BOOL removeExisting; /** * initialises the maker with a default view * * @param view any MASConstrait are created with this view as the first item * * @return a new MASConstraintMaker */ - (id)initWithView:(MAS_VIEW *)view; /** * Calls install method on any MASConstraints which have been created by this maker * * @return an array of all the installed MASConstraints */ - (NSArray *)install; - (MASConstraint * (^)(dispatch_block_t))group; @end ================================================ FILE: Pods/Masonry/Masonry/MASConstraintMaker.m ================================================ // // MASConstraintBuilder.m // Masonry // // Created by Jonas Budelmann on 20/07/13. // Copyright (c) 2013 cloudling. All rights reserved. // #import "MASConstraintMaker.h" #import "MASViewConstraint.h" #import "MASCompositeConstraint.h" #import "MASConstraint+Private.h" #import "MASViewAttribute.h" #import "View+MASAdditions.h" @interface MASConstraintMaker () @property (nonatomic, weak) MAS_VIEW *view; @property (nonatomic, strong) NSMutableArray *constraints; @end @implementation MASConstraintMaker - (id)initWithView:(MAS_VIEW *)view { self = [super init]; if (!self) return nil; self.view = view; self.constraints = NSMutableArray.new; return self; } - (NSArray *)install { if (self.removeExisting) { NSArray *installedConstraints = [MASViewConstraint installedConstraintsForView:self.view]; for (MASConstraint *constraint in installedConstraints) { [constraint uninstall]; } } NSArray *constraints = self.constraints.copy; for (MASConstraint *constraint in constraints) { constraint.updateExisting = self.updateExisting; [constraint install]; } [self.constraints removeAllObjects]; return constraints; } #pragma mark - MASConstraintDelegate - (void)constraint:(MASConstraint *)constraint shouldBeReplacedWithConstraint:(MASConstraint *)replacementConstraint { NSUInteger index = [self.constraints indexOfObject:constraint]; NSAssert(index != NSNotFound, @"Could not find constraint %@", constraint); [self.constraints replaceObjectAtIndex:index withObject:replacementConstraint]; } - (MASConstraint *)constraint:(MASConstraint *)constraint addConstraintWithLayoutAttribute:(NSLayoutAttribute)layoutAttribute { MASViewAttribute *viewAttribute = [[MASViewAttribute alloc] initWithView:self.view layoutAttribute:layoutAttribute]; MASViewConstraint *newConstraint = [[MASViewConstraint alloc] initWithFirstViewAttribute:viewAttribute]; if ([constraint isKindOfClass:MASViewConstraint.class]) { //replace with composite constraint NSArray *children = @[constraint, newConstraint]; MASCompositeConstraint *compositeConstraint = [[MASCompositeConstraint alloc] initWithChildren:children]; compositeConstraint.delegate = self; [self constraint:constraint shouldBeReplacedWithConstraint:compositeConstraint]; return compositeConstraint; } if (!constraint) { newConstraint.delegate = self; [self.constraints addObject:newConstraint]; } return newConstraint; } - (MASConstraint *)addConstraintWithAttributes:(MASAttribute)attrs { __unused MASAttribute anyAttribute = (MASAttributeLeft | MASAttributeRight | MASAttributeTop | MASAttributeBottom | MASAttributeLeading | MASAttributeTrailing | MASAttributeWidth | MASAttributeHeight | MASAttributeCenterX | MASAttributeCenterY | MASAttributeBaseline #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100) | MASAttributeFirstBaseline | MASAttributeLastBaseline #endif #if TARGET_OS_IPHONE || TARGET_OS_TV | MASAttributeLeftMargin | MASAttributeRightMargin | MASAttributeTopMargin | MASAttributeBottomMargin | MASAttributeLeadingMargin | MASAttributeTrailingMargin | MASAttributeCenterXWithinMargins | MASAttributeCenterYWithinMargins #endif ); NSAssert((attrs & anyAttribute) != 0, @"You didn't pass any attribute to make.attributes(...)"); NSMutableArray *attributes = [NSMutableArray array]; if (attrs & MASAttributeLeft) [attributes addObject:self.view.mas_left]; if (attrs & MASAttributeRight) [attributes addObject:self.view.mas_right]; if (attrs & MASAttributeTop) [attributes addObject:self.view.mas_top]; if (attrs & MASAttributeBottom) [attributes addObject:self.view.mas_bottom]; if (attrs & MASAttributeLeading) [attributes addObject:self.view.mas_leading]; if (attrs & MASAttributeTrailing) [attributes addObject:self.view.mas_trailing]; if (attrs & MASAttributeWidth) [attributes addObject:self.view.mas_width]; if (attrs & MASAttributeHeight) [attributes addObject:self.view.mas_height]; if (attrs & MASAttributeCenterX) [attributes addObject:self.view.mas_centerX]; if (attrs & MASAttributeCenterY) [attributes addObject:self.view.mas_centerY]; if (attrs & MASAttributeBaseline) [attributes addObject:self.view.mas_baseline]; #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100) if (attrs & MASAttributeFirstBaseline) [attributes addObject:self.view.mas_firstBaseline]; if (attrs & MASAttributeLastBaseline) [attributes addObject:self.view.mas_lastBaseline]; #endif #if TARGET_OS_IPHONE || TARGET_OS_TV if (attrs & MASAttributeLeftMargin) [attributes addObject:self.view.mas_leftMargin]; if (attrs & MASAttributeRightMargin) [attributes addObject:self.view.mas_rightMargin]; if (attrs & MASAttributeTopMargin) [attributes addObject:self.view.mas_topMargin]; if (attrs & MASAttributeBottomMargin) [attributes addObject:self.view.mas_bottomMargin]; if (attrs & MASAttributeLeadingMargin) [attributes addObject:self.view.mas_leadingMargin]; if (attrs & MASAttributeTrailingMargin) [attributes addObject:self.view.mas_trailingMargin]; if (attrs & MASAttributeCenterXWithinMargins) [attributes addObject:self.view.mas_centerXWithinMargins]; if (attrs & MASAttributeCenterYWithinMargins) [attributes addObject:self.view.mas_centerYWithinMargins]; #endif NSMutableArray *children = [NSMutableArray arrayWithCapacity:attributes.count]; for (MASViewAttribute *a in attributes) { [children addObject:[[MASViewConstraint alloc] initWithFirstViewAttribute:a]]; } MASCompositeConstraint *constraint = [[MASCompositeConstraint alloc] initWithChildren:children]; constraint.delegate = self; [self.constraints addObject:constraint]; return constraint; } #pragma mark - standard Attributes - (MASConstraint *)addConstraintWithLayoutAttribute:(NSLayoutAttribute)layoutAttribute { return [self constraint:nil addConstraintWithLayoutAttribute:layoutAttribute]; } - (MASConstraint *)left { return [self addConstraintWithLayoutAttribute:NSLayoutAttributeLeft]; } - (MASConstraint *)top { return [self addConstraintWithLayoutAttribute:NSLayoutAttributeTop]; } - (MASConstraint *)right { return [self addConstraintWithLayoutAttribute:NSLayoutAttributeRight]; } - (MASConstraint *)bottom { return [self addConstraintWithLayoutAttribute:NSLayoutAttributeBottom]; } - (MASConstraint *)leading { return [self addConstraintWithLayoutAttribute:NSLayoutAttributeLeading]; } - (MASConstraint *)trailing { return [self addConstraintWithLayoutAttribute:NSLayoutAttributeTrailing]; } - (MASConstraint *)width { return [self addConstraintWithLayoutAttribute:NSLayoutAttributeWidth]; } - (MASConstraint *)height { return [self addConstraintWithLayoutAttribute:NSLayoutAttributeHeight]; } - (MASConstraint *)centerX { return [self addConstraintWithLayoutAttribute:NSLayoutAttributeCenterX]; } - (MASConstraint *)centerY { return [self addConstraintWithLayoutAttribute:NSLayoutAttributeCenterY]; } - (MASConstraint *)baseline { return [self addConstraintWithLayoutAttribute:NSLayoutAttributeBaseline]; } - (MASConstraint *(^)(MASAttribute))attributes { return ^(MASAttribute attrs){ return [self addConstraintWithAttributes:attrs]; }; } #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100) - (MASConstraint *)firstBaseline { return [self addConstraintWithLayoutAttribute:NSLayoutAttributeFirstBaseline]; } - (MASConstraint *)lastBaseline { return [self addConstraintWithLayoutAttribute:NSLayoutAttributeLastBaseline]; } #endif #if TARGET_OS_IPHONE || TARGET_OS_TV - (MASConstraint *)leftMargin { return [self addConstraintWithLayoutAttribute:NSLayoutAttributeLeftMargin]; } - (MASConstraint *)rightMargin { return [self addConstraintWithLayoutAttribute:NSLayoutAttributeRightMargin]; } - (MASConstraint *)topMargin { return [self addConstraintWithLayoutAttribute:NSLayoutAttributeTopMargin]; } - (MASConstraint *)bottomMargin { return [self addConstraintWithLayoutAttribute:NSLayoutAttributeBottomMargin]; } - (MASConstraint *)leadingMargin { return [self addConstraintWithLayoutAttribute:NSLayoutAttributeLeadingMargin]; } - (MASConstraint *)trailingMargin { return [self addConstraintWithLayoutAttribute:NSLayoutAttributeTrailingMargin]; } - (MASConstraint *)centerXWithinMargins { return [self addConstraintWithLayoutAttribute:NSLayoutAttributeCenterXWithinMargins]; } - (MASConstraint *)centerYWithinMargins { return [self addConstraintWithLayoutAttribute:NSLayoutAttributeCenterYWithinMargins]; } #endif #pragma mark - composite Attributes - (MASConstraint *)edges { return [self addConstraintWithAttributes:MASAttributeTop | MASAttributeLeft | MASAttributeRight | MASAttributeBottom]; } - (MASConstraint *)size { return [self addConstraintWithAttributes:MASAttributeWidth | MASAttributeHeight]; } - (MASConstraint *)center { return [self addConstraintWithAttributes:MASAttributeCenterX | MASAttributeCenterY]; } #pragma mark - grouping - (MASConstraint *(^)(dispatch_block_t group))group { return ^id(dispatch_block_t group) { NSInteger previousCount = self.constraints.count; group(); NSArray *children = [self.constraints subarrayWithRange:NSMakeRange(previousCount, self.constraints.count - previousCount)]; MASCompositeConstraint *constraint = [[MASCompositeConstraint alloc] initWithChildren:children]; constraint.delegate = self; return constraint; }; } @end ================================================ FILE: Pods/Masonry/Masonry/MASLayoutConstraint.h ================================================ // // MASLayoutConstraint.h // Masonry // // Created by Jonas Budelmann on 3/08/13. // Copyright (c) 2013 Jonas Budelmann. All rights reserved. // #import "MASUtilities.h" /** * When you are debugging or printing the constraints attached to a view this subclass * makes it easier to identify which constraints have been created via Masonry */ @interface MASLayoutConstraint : NSLayoutConstraint /** * a key to associate with this constraint */ @property (nonatomic, strong) id mas_key; @end ================================================ FILE: Pods/Masonry/Masonry/MASLayoutConstraint.m ================================================ // // MASLayoutConstraint.m // Masonry // // Created by Jonas Budelmann on 3/08/13. // Copyright (c) 2013 Jonas Budelmann. All rights reserved. // #import "MASLayoutConstraint.h" @implementation MASLayoutConstraint @end ================================================ FILE: Pods/Masonry/Masonry/MASUtilities.h ================================================ // // MASUtilities.h // Masonry // // Created by Jonas Budelmann on 19/08/13. // Copyright (c) 2013 Jonas Budelmann. All rights reserved. // #import #if TARGET_OS_IPHONE || TARGET_OS_TV #import #define MAS_VIEW UIView #define MAS_VIEW_CONTROLLER UIViewController #define MASEdgeInsets UIEdgeInsets typedef UILayoutPriority MASLayoutPriority; static const MASLayoutPriority MASLayoutPriorityRequired = UILayoutPriorityRequired; static const MASLayoutPriority MASLayoutPriorityDefaultHigh = UILayoutPriorityDefaultHigh; static const MASLayoutPriority MASLayoutPriorityDefaultMedium = 500; static const MASLayoutPriority MASLayoutPriorityDefaultLow = UILayoutPriorityDefaultLow; static const MASLayoutPriority MASLayoutPriorityFittingSizeLevel = UILayoutPriorityFittingSizeLevel; #elif TARGET_OS_MAC #import #define MAS_VIEW NSView #define MASEdgeInsets NSEdgeInsets typedef NSLayoutPriority MASLayoutPriority; static const MASLayoutPriority MASLayoutPriorityRequired = NSLayoutPriorityRequired; static const MASLayoutPriority MASLayoutPriorityDefaultHigh = NSLayoutPriorityDefaultHigh; static const MASLayoutPriority MASLayoutPriorityDragThatCanResizeWindow = NSLayoutPriorityDragThatCanResizeWindow; static const MASLayoutPriority MASLayoutPriorityDefaultMedium = 501; static const MASLayoutPriority MASLayoutPriorityWindowSizeStayPut = NSLayoutPriorityWindowSizeStayPut; static const MASLayoutPriority MASLayoutPriorityDragThatCannotResizeWindow = NSLayoutPriorityDragThatCannotResizeWindow; static const MASLayoutPriority MASLayoutPriorityDefaultLow = NSLayoutPriorityDefaultLow; static const MASLayoutPriority MASLayoutPriorityFittingSizeCompression = NSLayoutPriorityFittingSizeCompression; #endif /** * Allows you to attach keys to objects matching the variable names passed. * * view1.mas_key = @"view1", view2.mas_key = @"view2"; * * is equivalent to: * * MASAttachKeys(view1, view2); */ #define MASAttachKeys(...) \ { \ NSDictionary *keyPairs = NSDictionaryOfVariableBindings(__VA_ARGS__); \ for (id key in keyPairs.allKeys) { \ id obj = keyPairs[key]; \ NSAssert([obj respondsToSelector:@selector(setMas_key:)], \ @"Cannot attach mas_key to %@", obj); \ [obj setMas_key:key]; \ } \ } /** * Used to create object hashes * Based on http://www.mikeash.com/pyblog/friday-qa-2010-06-18-implementing-equality-and-hashing.html */ #define MAS_NSUINT_BIT (CHAR_BIT * sizeof(NSUInteger)) #define MAS_NSUINTROTATE(val, howmuch) ((((NSUInteger)val) << howmuch) | (((NSUInteger)val) >> (MAS_NSUINT_BIT - howmuch))) /** * Given a scalar or struct value, wraps it in NSValue * Based on EXPObjectify: https://github.com/specta/expecta */ static inline id _MASBoxValue(const char *type, ...) { va_list v; va_start(v, type); id obj = nil; if (strcmp(type, @encode(id)) == 0) { id actual = va_arg(v, id); obj = actual; } else if (strcmp(type, @encode(CGPoint)) == 0) { CGPoint actual = (CGPoint)va_arg(v, CGPoint); obj = [NSValue value:&actual withObjCType:type]; } else if (strcmp(type, @encode(CGSize)) == 0) { CGSize actual = (CGSize)va_arg(v, CGSize); obj = [NSValue value:&actual withObjCType:type]; } else if (strcmp(type, @encode(MASEdgeInsets)) == 0) { MASEdgeInsets actual = (MASEdgeInsets)va_arg(v, MASEdgeInsets); obj = [NSValue value:&actual withObjCType:type]; } else if (strcmp(type, @encode(double)) == 0) { double actual = (double)va_arg(v, double); obj = [NSNumber numberWithDouble:actual]; } else if (strcmp(type, @encode(float)) == 0) { float actual = (float)va_arg(v, double); obj = [NSNumber numberWithFloat:actual]; } else if (strcmp(type, @encode(int)) == 0) { int actual = (int)va_arg(v, int); obj = [NSNumber numberWithInt:actual]; } else if (strcmp(type, @encode(long)) == 0) { long actual = (long)va_arg(v, long); obj = [NSNumber numberWithLong:actual]; } else if (strcmp(type, @encode(long long)) == 0) { long long actual = (long long)va_arg(v, long long); obj = [NSNumber numberWithLongLong:actual]; } else if (strcmp(type, @encode(short)) == 0) { short actual = (short)va_arg(v, int); obj = [NSNumber numberWithShort:actual]; } else if (strcmp(type, @encode(char)) == 0) { char actual = (char)va_arg(v, int); obj = [NSNumber numberWithChar:actual]; } else if (strcmp(type, @encode(bool)) == 0) { bool actual = (bool)va_arg(v, int); obj = [NSNumber numberWithBool:actual]; } else if (strcmp(type, @encode(unsigned char)) == 0) { unsigned char actual = (unsigned char)va_arg(v, unsigned int); obj = [NSNumber numberWithUnsignedChar:actual]; } else if (strcmp(type, @encode(unsigned int)) == 0) { unsigned int actual = (unsigned int)va_arg(v, unsigned int); obj = [NSNumber numberWithUnsignedInt:actual]; } else if (strcmp(type, @encode(unsigned long)) == 0) { unsigned long actual = (unsigned long)va_arg(v, unsigned long); obj = [NSNumber numberWithUnsignedLong:actual]; } else if (strcmp(type, @encode(unsigned long long)) == 0) { unsigned long long actual = (unsigned long long)va_arg(v, unsigned long long); obj = [NSNumber numberWithUnsignedLongLong:actual]; } else if (strcmp(type, @encode(unsigned short)) == 0) { unsigned short actual = (unsigned short)va_arg(v, unsigned int); obj = [NSNumber numberWithUnsignedShort:actual]; } va_end(v); return obj; } #define MASBoxValue(value) _MASBoxValue(@encode(__typeof__((value))), (value)) ================================================ FILE: Pods/Masonry/Masonry/MASViewAttribute.h ================================================ // // MASAttribute.h // Masonry // // Created by Jonas Budelmann on 21/07/13. // Copyright (c) 2013 cloudling. All rights reserved. // #import "MASUtilities.h" /** * An immutable tuple which stores the view and the related NSLayoutAttribute. * Describes part of either the left or right hand side of a constraint equation */ @interface MASViewAttribute : NSObject /** * The view which the reciever relates to. Can be nil if item is not a view. */ @property (nonatomic, weak, readonly) MAS_VIEW *view; /** * The item which the reciever relates to. */ @property (nonatomic, weak, readonly) id item; /** * The attribute which the reciever relates to */ @property (nonatomic, assign, readonly) NSLayoutAttribute layoutAttribute; /** * Convenience initializer. */ - (id)initWithView:(MAS_VIEW *)view layoutAttribute:(NSLayoutAttribute)layoutAttribute; /** * The designated initializer. */ - (id)initWithView:(MAS_VIEW *)view item:(id)item layoutAttribute:(NSLayoutAttribute)layoutAttribute; /** * Determine whether the layoutAttribute is a size attribute * * @return YES if layoutAttribute is equal to NSLayoutAttributeWidth or NSLayoutAttributeHeight */ - (BOOL)isSizeAttribute; @end ================================================ FILE: Pods/Masonry/Masonry/MASViewAttribute.m ================================================ // // MASAttribute.m // Masonry // // Created by Jonas Budelmann on 21/07/13. // Copyright (c) 2013 cloudling. All rights reserved. // #import "MASViewAttribute.h" @implementation MASViewAttribute - (id)initWithView:(MAS_VIEW *)view layoutAttribute:(NSLayoutAttribute)layoutAttribute { self = [self initWithView:view item:view layoutAttribute:layoutAttribute]; return self; } - (id)initWithView:(MAS_VIEW *)view item:(id)item layoutAttribute:(NSLayoutAttribute)layoutAttribute { self = [super init]; if (!self) return nil; _view = view; _item = item; _layoutAttribute = layoutAttribute; return self; } - (BOOL)isSizeAttribute { return self.layoutAttribute == NSLayoutAttributeWidth || self.layoutAttribute == NSLayoutAttributeHeight; } - (BOOL)isEqual:(MASViewAttribute *)viewAttribute { if ([viewAttribute isKindOfClass:self.class]) { return self.view == viewAttribute.view && self.layoutAttribute == viewAttribute.layoutAttribute; } return [super isEqual:viewAttribute]; } - (NSUInteger)hash { return MAS_NSUINTROTATE([self.view hash], MAS_NSUINT_BIT / 2) ^ self.layoutAttribute; } @end ================================================ FILE: Pods/Masonry/Masonry/MASViewConstraint.h ================================================ // // MASConstraint.h // Masonry // // Created by Jonas Budelmann on 20/07/13. // Copyright (c) 2013 cloudling. All rights reserved. // #import "MASViewAttribute.h" #import "MASConstraint.h" #import "MASLayoutConstraint.h" #import "MASUtilities.h" /** * A single constraint. * Contains the attributes neccessary for creating a NSLayoutConstraint and adding it to the appropriate view */ @interface MASViewConstraint : MASConstraint /** * First item/view and first attribute of the NSLayoutConstraint */ @property (nonatomic, strong, readonly) MASViewAttribute *firstViewAttribute; /** * Second item/view and second attribute of the NSLayoutConstraint */ @property (nonatomic, strong, readonly) MASViewAttribute *secondViewAttribute; /** * initialises the MASViewConstraint with the first part of the equation * * @param firstViewAttribute view.mas_left, view.mas_width etc. * * @return a new view constraint */ - (id)initWithFirstViewAttribute:(MASViewAttribute *)firstViewAttribute; /** * Returns all MASViewConstraints installed with this view as a first item. * * @param view A view to retrieve constraints for. * * @return An array of MASViewConstraints. */ + (NSArray *)installedConstraintsForView:(MAS_VIEW *)view; @end ================================================ FILE: Pods/Masonry/Masonry/MASViewConstraint.m ================================================ // // MASConstraint.m // Masonry // // Created by Jonas Budelmann on 20/07/13. // Copyright (c) 2013 cloudling. All rights reserved. // #import "MASViewConstraint.h" #import "MASConstraint+Private.h" #import "MASCompositeConstraint.h" #import "MASLayoutConstraint.h" #import "View+MASAdditions.h" #import @interface MAS_VIEW (MASConstraints) @property (nonatomic, readonly) NSMutableSet *mas_installedConstraints; @end @implementation MAS_VIEW (MASConstraints) static char kInstalledConstraintsKey; - (NSMutableSet *)mas_installedConstraints { NSMutableSet *constraints = objc_getAssociatedObject(self, &kInstalledConstraintsKey); if (!constraints) { constraints = [NSMutableSet set]; objc_setAssociatedObject(self, &kInstalledConstraintsKey, constraints, OBJC_ASSOCIATION_RETAIN_NONATOMIC); } return constraints; } @end @interface MASViewConstraint () @property (nonatomic, strong, readwrite) MASViewAttribute *secondViewAttribute; @property (nonatomic, weak) MAS_VIEW *installedView; @property (nonatomic, weak) MASLayoutConstraint *layoutConstraint; @property (nonatomic, assign) NSLayoutRelation layoutRelation; @property (nonatomic, assign) MASLayoutPriority layoutPriority; @property (nonatomic, assign) CGFloat layoutMultiplier; @property (nonatomic, assign) CGFloat layoutConstant; @property (nonatomic, assign) BOOL hasLayoutRelation; @property (nonatomic, strong) id mas_key; @property (nonatomic, assign) BOOL useAnimator; @end @implementation MASViewConstraint - (id)initWithFirstViewAttribute:(MASViewAttribute *)firstViewAttribute { self = [super init]; if (!self) return nil; _firstViewAttribute = firstViewAttribute; self.layoutPriority = MASLayoutPriorityRequired; self.layoutMultiplier = 1; return self; } #pragma mark - NSCoping - (id)copyWithZone:(NSZone __unused *)zone { MASViewConstraint *constraint = [[MASViewConstraint alloc] initWithFirstViewAttribute:self.firstViewAttribute]; constraint.layoutConstant = self.layoutConstant; constraint.layoutRelation = self.layoutRelation; constraint.layoutPriority = self.layoutPriority; constraint.layoutMultiplier = self.layoutMultiplier; constraint.delegate = self.delegate; return constraint; } #pragma mark - Public + (NSArray *)installedConstraintsForView:(MAS_VIEW *)view { return [view.mas_installedConstraints allObjects]; } #pragma mark - Private - (void)setLayoutConstant:(CGFloat)layoutConstant { _layoutConstant = layoutConstant; #if TARGET_OS_MAC && !(TARGET_OS_IPHONE || TARGET_OS_TV) if (self.useAnimator) { [self.layoutConstraint.animator setConstant:layoutConstant]; } else { self.layoutConstraint.constant = layoutConstant; } #else self.layoutConstraint.constant = layoutConstant; #endif } - (void)setLayoutRelation:(NSLayoutRelation)layoutRelation { _layoutRelation = layoutRelation; self.hasLayoutRelation = YES; } - (BOOL)supportsActiveProperty { return [self.layoutConstraint respondsToSelector:@selector(isActive)]; } - (BOOL)isActive { BOOL active = YES; if ([self supportsActiveProperty]) { active = [self.layoutConstraint isActive]; } return active; } - (BOOL)hasBeenInstalled { return (self.layoutConstraint != nil) && [self isActive]; } - (void)setSecondViewAttribute:(id)secondViewAttribute { if ([secondViewAttribute isKindOfClass:NSValue.class]) { [self setLayoutConstantWithValue:secondViewAttribute]; } else if ([secondViewAttribute isKindOfClass:MAS_VIEW.class]) { _secondViewAttribute = [[MASViewAttribute alloc] initWithView:secondViewAttribute layoutAttribute:self.firstViewAttribute.layoutAttribute]; } else if ([secondViewAttribute isKindOfClass:MASViewAttribute.class]) { _secondViewAttribute = secondViewAttribute; } else { NSAssert(NO, @"attempting to add unsupported attribute: %@", secondViewAttribute); } } #pragma mark - NSLayoutConstraint multiplier proxies - (MASConstraint * (^)(CGFloat))multipliedBy { return ^id(CGFloat multiplier) { NSAssert(!self.hasBeenInstalled, @"Cannot modify constraint multiplier after it has been installed"); self.layoutMultiplier = multiplier; return self; }; } - (MASConstraint * (^)(CGFloat))dividedBy { return ^id(CGFloat divider) { NSAssert(!self.hasBeenInstalled, @"Cannot modify constraint multiplier after it has been installed"); self.layoutMultiplier = 1.0/divider; return self; }; } #pragma mark - MASLayoutPriority proxy - (MASConstraint * (^)(MASLayoutPriority))priority { return ^id(MASLayoutPriority priority) { NSAssert(!self.hasBeenInstalled, @"Cannot modify constraint priority after it has been installed"); self.layoutPriority = priority; return self; }; } #pragma mark - NSLayoutRelation proxy - (MASConstraint * (^)(id, NSLayoutRelation))equalToWithRelation { return ^id(id attribute, NSLayoutRelation relation) { if ([attribute isKindOfClass:NSArray.class]) { NSAssert(!self.hasLayoutRelation, @"Redefinition of constraint relation"); NSMutableArray *children = NSMutableArray.new; for (id attr in attribute) { MASViewConstraint *viewConstraint = [self copy]; viewConstraint.secondViewAttribute = attr; [children addObject:viewConstraint]; } MASCompositeConstraint *compositeConstraint = [[MASCompositeConstraint alloc] initWithChildren:children]; compositeConstraint.delegate = self.delegate; [self.delegate constraint:self shouldBeReplacedWithConstraint:compositeConstraint]; return compositeConstraint; } else { NSAssert(!self.hasLayoutRelation || self.layoutRelation == relation && [attribute isKindOfClass:NSValue.class], @"Redefinition of constraint relation"); self.layoutRelation = relation; self.secondViewAttribute = attribute; return self; } }; } #pragma mark - Semantic properties - (MASConstraint *)with { return self; } - (MASConstraint *)and { return self; } #pragma mark - attribute chaining - (MASConstraint *)addConstraintWithLayoutAttribute:(NSLayoutAttribute)layoutAttribute { NSAssert(!self.hasLayoutRelation, @"Attributes should be chained before defining the constraint relation"); return [self.delegate constraint:self addConstraintWithLayoutAttribute:layoutAttribute]; } #pragma mark - Animator proxy #if TARGET_OS_MAC && !(TARGET_OS_IPHONE || TARGET_OS_TV) - (MASConstraint *)animator { self.useAnimator = YES; return self; } #endif #pragma mark - debug helpers - (MASConstraint * (^)(id))key { return ^id(id key) { self.mas_key = key; return self; }; } #pragma mark - NSLayoutConstraint constant setters - (void)setInsets:(MASEdgeInsets)insets { NSLayoutAttribute layoutAttribute = self.firstViewAttribute.layoutAttribute; switch (layoutAttribute) { case NSLayoutAttributeLeft: case NSLayoutAttributeLeading: self.layoutConstant = insets.left; break; case NSLayoutAttributeTop: self.layoutConstant = insets.top; break; case NSLayoutAttributeBottom: self.layoutConstant = -insets.bottom; break; case NSLayoutAttributeRight: case NSLayoutAttributeTrailing: self.layoutConstant = -insets.right; break; default: break; } } - (void)setOffset:(CGFloat)offset { self.layoutConstant = offset; } - (void)setSizeOffset:(CGSize)sizeOffset { NSLayoutAttribute layoutAttribute = self.firstViewAttribute.layoutAttribute; switch (layoutAttribute) { case NSLayoutAttributeWidth: self.layoutConstant = sizeOffset.width; break; case NSLayoutAttributeHeight: self.layoutConstant = sizeOffset.height; break; default: break; } } - (void)setCenterOffset:(CGPoint)centerOffset { NSLayoutAttribute layoutAttribute = self.firstViewAttribute.layoutAttribute; switch (layoutAttribute) { case NSLayoutAttributeCenterX: self.layoutConstant = centerOffset.x; break; case NSLayoutAttributeCenterY: self.layoutConstant = centerOffset.y; break; default: break; } } #pragma mark - MASConstraint - (void)activate { [self install]; } - (void)deactivate { [self uninstall]; } - (void)install { if (self.hasBeenInstalled) { return; } if ([self supportsActiveProperty] && self.layoutConstraint) { self.layoutConstraint.active = YES; [self.firstViewAttribute.view.mas_installedConstraints addObject:self]; return; } MAS_VIEW *firstLayoutItem = self.firstViewAttribute.item; NSLayoutAttribute firstLayoutAttribute = self.firstViewAttribute.layoutAttribute; MAS_VIEW *secondLayoutItem = self.secondViewAttribute.item; NSLayoutAttribute secondLayoutAttribute = self.secondViewAttribute.layoutAttribute; // alignment attributes must have a secondViewAttribute // therefore we assume that is refering to superview // eg make.left.equalTo(@10) if (!self.firstViewAttribute.isSizeAttribute && !self.secondViewAttribute) { secondLayoutItem = self.firstViewAttribute.view.superview; secondLayoutAttribute = firstLayoutAttribute; } MASLayoutConstraint *layoutConstraint = [MASLayoutConstraint constraintWithItem:firstLayoutItem attribute:firstLayoutAttribute relatedBy:self.layoutRelation toItem:secondLayoutItem attribute:secondLayoutAttribute multiplier:self.layoutMultiplier constant:self.layoutConstant]; layoutConstraint.priority = self.layoutPriority; layoutConstraint.mas_key = self.mas_key; if (self.secondViewAttribute.view) { MAS_VIEW *closestCommonSuperview = [self.firstViewAttribute.view mas_closestCommonSuperview:self.secondViewAttribute.view]; NSAssert(closestCommonSuperview, @"couldn't find a common superview for %@ and %@", self.firstViewAttribute.view, self.secondViewAttribute.view); self.installedView = closestCommonSuperview; } else if (self.firstViewAttribute.isSizeAttribute) { self.installedView = self.firstViewAttribute.view; } else { self.installedView = self.firstViewAttribute.view.superview; } MASLayoutConstraint *existingConstraint = nil; if (self.updateExisting) { existingConstraint = [self layoutConstraintSimilarTo:layoutConstraint]; } if (existingConstraint) { // just update the constant existingConstraint.constant = layoutConstraint.constant; self.layoutConstraint = existingConstraint; } else { [self.installedView addConstraint:layoutConstraint]; self.layoutConstraint = layoutConstraint; [firstLayoutItem.mas_installedConstraints addObject:self]; } } - (MASLayoutConstraint *)layoutConstraintSimilarTo:(MASLayoutConstraint *)layoutConstraint { // check if any constraints are the same apart from the only mutable property constant // go through constraints in reverse as we do not want to match auto-resizing or interface builder constraints // and they are likely to be added first. for (NSLayoutConstraint *existingConstraint in self.installedView.constraints.reverseObjectEnumerator) { if (![existingConstraint isKindOfClass:MASLayoutConstraint.class]) continue; if (existingConstraint.firstItem != layoutConstraint.firstItem) continue; if (existingConstraint.secondItem != layoutConstraint.secondItem) continue; if (existingConstraint.firstAttribute != layoutConstraint.firstAttribute) continue; if (existingConstraint.secondAttribute != layoutConstraint.secondAttribute) continue; if (existingConstraint.relation != layoutConstraint.relation) continue; if (existingConstraint.multiplier != layoutConstraint.multiplier) continue; if (existingConstraint.priority != layoutConstraint.priority) continue; return (id)existingConstraint; } return nil; } - (void)uninstall { if ([self supportsActiveProperty]) { self.layoutConstraint.active = NO; [self.firstViewAttribute.view.mas_installedConstraints removeObject:self]; return; } [self.installedView removeConstraint:self.layoutConstraint]; self.layoutConstraint = nil; self.installedView = nil; [self.firstViewAttribute.view.mas_installedConstraints removeObject:self]; } @end ================================================ FILE: Pods/Masonry/Masonry/Masonry.h ================================================ // // Masonry.h // Masonry // // Created by Jonas Budelmann on 20/07/13. // Copyright (c) 2013 cloudling. All rights reserved. // #import //! Project version number for Masonry. FOUNDATION_EXPORT double MasonryVersionNumber; //! Project version string for Masonry. FOUNDATION_EXPORT const unsigned char MasonryVersionString[]; #import "MASUtilities.h" #import "View+MASAdditions.h" #import "View+MASShorthandAdditions.h" #import "ViewController+MASAdditions.h" #import "NSArray+MASAdditions.h" #import "NSArray+MASShorthandAdditions.h" #import "MASConstraint.h" #import "MASCompositeConstraint.h" #import "MASViewAttribute.h" #import "MASViewConstraint.h" #import "MASConstraintMaker.h" #import "MASLayoutConstraint.h" #import "NSLayoutConstraint+MASDebugAdditions.h" ================================================ FILE: Pods/Masonry/Masonry/NSArray+MASAdditions.h ================================================ // // NSArray+MASAdditions.h // // // Created by Daniel Hammond on 11/26/13. // // #import "MASUtilities.h" #import "MASConstraintMaker.h" #import "MASViewAttribute.h" typedef NS_ENUM(NSUInteger, MASAxisType) { MASAxisTypeHorizontal, MASAxisTypeVertical }; @interface NSArray (MASAdditions) /** * Creates a MASConstraintMaker with each view in the callee. * Any constraints defined are added to the view or the appropriate superview once the block has finished executing on each view * * @param block scope within which you can build up the constraints which you wish to apply to each view. * * @return Array of created MASConstraints */ - (NSArray *)mas_makeConstraints:(void (^)(MASConstraintMaker *make))block; /** * Creates a MASConstraintMaker with each view in the callee. * Any constraints defined are added to each view or the appropriate superview once the block has finished executing on each view. * If an existing constraint exists then it will be updated instead. * * @param block scope within which you can build up the constraints which you wish to apply to each view. * * @return Array of created/updated MASConstraints */ - (NSArray *)mas_updateConstraints:(void (^)(MASConstraintMaker *make))block; /** * Creates a MASConstraintMaker with each view in the callee. * Any constraints defined are added to each view or the appropriate superview once the block has finished executing on each view. * All constraints previously installed for the views will be removed. * * @param block scope within which you can build up the constraints which you wish to apply to each view. * * @return Array of created/updated MASConstraints */ - (NSArray *)mas_remakeConstraints:(void (^)(MASConstraintMaker *make))block; /** * distribute with fixed spacing * * @param axisType which axis to distribute items along * @param fixedSpacing the spacing between each item * @param leadSpacing the spacing before the first item and the container * @param tailSpacing the spacing after the last item and the container */ - (void)mas_distributeViewsAlongAxis:(MASAxisType)axisType withFixedSpacing:(CGFloat)fixedSpacing leadSpacing:(CGFloat)leadSpacing tailSpacing:(CGFloat)tailSpacing; /** * distribute with fixed item size * * @param axisType which axis to distribute items along * @param fixedItemLength the fixed length of each item * @param leadSpacing the spacing before the first item and the container * @param tailSpacing the spacing after the last item and the container */ - (void)mas_distributeViewsAlongAxis:(MASAxisType)axisType withFixedItemLength:(CGFloat)fixedItemLength leadSpacing:(CGFloat)leadSpacing tailSpacing:(CGFloat)tailSpacing; @end ================================================ FILE: Pods/Masonry/Masonry/NSArray+MASAdditions.m ================================================ // // NSArray+MASAdditions.m // // // Created by Daniel Hammond on 11/26/13. // // #import "NSArray+MASAdditions.h" #import "View+MASAdditions.h" @implementation NSArray (MASAdditions) - (NSArray *)mas_makeConstraints:(void(^)(MASConstraintMaker *make))block { NSMutableArray *constraints = [NSMutableArray array]; for (MAS_VIEW *view in self) { NSAssert([view isKindOfClass:[MAS_VIEW class]], @"All objects in the array must be views"); [constraints addObjectsFromArray:[view mas_makeConstraints:block]]; } return constraints; } - (NSArray *)mas_updateConstraints:(void(^)(MASConstraintMaker *make))block { NSMutableArray *constraints = [NSMutableArray array]; for (MAS_VIEW *view in self) { NSAssert([view isKindOfClass:[MAS_VIEW class]], @"All objects in the array must be views"); [constraints addObjectsFromArray:[view mas_updateConstraints:block]]; } return constraints; } - (NSArray *)mas_remakeConstraints:(void(^)(MASConstraintMaker *make))block { NSMutableArray *constraints = [NSMutableArray array]; for (MAS_VIEW *view in self) { NSAssert([view isKindOfClass:[MAS_VIEW class]], @"All objects in the array must be views"); [constraints addObjectsFromArray:[view mas_remakeConstraints:block]]; } return constraints; } - (void)mas_distributeViewsAlongAxis:(MASAxisType)axisType withFixedSpacing:(CGFloat)fixedSpacing leadSpacing:(CGFloat)leadSpacing tailSpacing:(CGFloat)tailSpacing { if (self.count < 2) { NSAssert(self.count>1,@"views to distribute need to bigger than one"); return; } MAS_VIEW *tempSuperView = [self mas_commonSuperviewOfViews]; if (axisType == MASAxisTypeHorizontal) { MAS_VIEW *prev; for (int i = 0; i < self.count; i++) { MAS_VIEW *v = self[i]; [v mas_makeConstraints:^(MASConstraintMaker *make) { if (prev) { make.width.equalTo(prev); make.left.equalTo(prev.mas_right).offset(fixedSpacing); if (i == self.count - 1) {//last one make.right.equalTo(tempSuperView).offset(-tailSpacing); } } else {//first one make.left.equalTo(tempSuperView).offset(leadSpacing); } }]; prev = v; } } else { MAS_VIEW *prev; for (int i = 0; i < self.count; i++) { MAS_VIEW *v = self[i]; [v mas_makeConstraints:^(MASConstraintMaker *make) { if (prev) { make.height.equalTo(prev); make.top.equalTo(prev.mas_bottom).offset(fixedSpacing); if (i == self.count - 1) {//last one make.bottom.equalTo(tempSuperView).offset(-tailSpacing); } } else {//first one make.top.equalTo(tempSuperView).offset(leadSpacing); } }]; prev = v; } } } - (void)mas_distributeViewsAlongAxis:(MASAxisType)axisType withFixedItemLength:(CGFloat)fixedItemLength leadSpacing:(CGFloat)leadSpacing tailSpacing:(CGFloat)tailSpacing { if (self.count < 2) { NSAssert(self.count>1,@"views to distribute need to bigger than one"); return; } MAS_VIEW *tempSuperView = [self mas_commonSuperviewOfViews]; if (axisType == MASAxisTypeHorizontal) { MAS_VIEW *prev; for (int i = 0; i < self.count; i++) { MAS_VIEW *v = self[i]; [v mas_makeConstraints:^(MASConstraintMaker *make) { if (prev) { CGFloat offset = (1-(i/((CGFloat)self.count-1)))*(fixedItemLength+leadSpacing)-i*tailSpacing/(((CGFloat)self.count-1)); make.width.equalTo(@(fixedItemLength)); if (i == self.count - 1) {//last one make.right.equalTo(tempSuperView).offset(-tailSpacing); } else { make.right.equalTo(tempSuperView).multipliedBy(i/((CGFloat)self.count-1)).with.offset(offset); } } else {//first one make.left.equalTo(tempSuperView).offset(leadSpacing); make.width.equalTo(@(fixedItemLength)); } }]; prev = v; } } else { MAS_VIEW *prev; for (int i = 0; i < self.count; i++) { MAS_VIEW *v = self[i]; [v mas_makeConstraints:^(MASConstraintMaker *make) { if (prev) { CGFloat offset = (1-(i/((CGFloat)self.count-1)))*(fixedItemLength+leadSpacing)-i*tailSpacing/(((CGFloat)self.count-1)); make.height.equalTo(@(fixedItemLength)); if (i == self.count - 1) {//last one make.bottom.equalTo(tempSuperView).offset(-tailSpacing); } else { make.bottom.equalTo(tempSuperView).multipliedBy(i/((CGFloat)self.count-1)).with.offset(offset); } } else {//first one make.top.equalTo(tempSuperView).offset(leadSpacing); make.height.equalTo(@(fixedItemLength)); } }]; prev = v; } } } - (MAS_VIEW *)mas_commonSuperviewOfViews { MAS_VIEW *commonSuperview = nil; MAS_VIEW *previousView = nil; for (id object in self) { if ([object isKindOfClass:[MAS_VIEW class]]) { MAS_VIEW *view = (MAS_VIEW *)object; if (previousView) { commonSuperview = [view mas_closestCommonSuperview:commonSuperview]; } else { commonSuperview = view; } previousView = view; } } NSAssert(commonSuperview, @"Can't constrain views that do not share a common superview. Make sure that all the views in this array have been added into the same view hierarchy."); return commonSuperview; } @end ================================================ FILE: Pods/Masonry/Masonry/NSArray+MASShorthandAdditions.h ================================================ // // NSArray+MASShorthandAdditions.h // Masonry // // Created by Jonas Budelmann on 22/07/13. // Copyright (c) 2013 Jonas Budelmann. All rights reserved. // #import "NSArray+MASAdditions.h" #ifdef MAS_SHORTHAND /** * Shorthand array additions without the 'mas_' prefixes, * only enabled if MAS_SHORTHAND is defined */ @interface NSArray (MASShorthandAdditions) - (NSArray *)makeConstraints:(void(^)(MASConstraintMaker *make))block; - (NSArray *)updateConstraints:(void(^)(MASConstraintMaker *make))block; - (NSArray *)remakeConstraints:(void(^)(MASConstraintMaker *make))block; @end @implementation NSArray (MASShorthandAdditions) - (NSArray *)makeConstraints:(void(^)(MASConstraintMaker *))block { return [self mas_makeConstraints:block]; } - (NSArray *)updateConstraints:(void(^)(MASConstraintMaker *))block { return [self mas_updateConstraints:block]; } - (NSArray *)remakeConstraints:(void(^)(MASConstraintMaker *))block { return [self mas_remakeConstraints:block]; } @end #endif ================================================ FILE: Pods/Masonry/Masonry/NSLayoutConstraint+MASDebugAdditions.h ================================================ // // NSLayoutConstraint+MASDebugAdditions.h // Masonry // // Created by Jonas Budelmann on 3/08/13. // Copyright (c) 2013 Jonas Budelmann. All rights reserved. // #import "MASUtilities.h" /** * makes debug and log output of NSLayoutConstraints more readable */ @interface NSLayoutConstraint (MASDebugAdditions) @end ================================================ FILE: Pods/Masonry/Masonry/NSLayoutConstraint+MASDebugAdditions.m ================================================ // // NSLayoutConstraint+MASDebugAdditions.m // Masonry // // Created by Jonas Budelmann on 3/08/13. // Copyright (c) 2013 Jonas Budelmann. All rights reserved. // #import "NSLayoutConstraint+MASDebugAdditions.h" #import "MASConstraint.h" #import "MASLayoutConstraint.h" @implementation NSLayoutConstraint (MASDebugAdditions) #pragma mark - description maps + (NSDictionary *)layoutRelationDescriptionsByValue { static dispatch_once_t once; static NSDictionary *descriptionMap; dispatch_once(&once, ^{ descriptionMap = @{ @(NSLayoutRelationEqual) : @"==", @(NSLayoutRelationGreaterThanOrEqual) : @">=", @(NSLayoutRelationLessThanOrEqual) : @"<=", }; }); return descriptionMap; } + (NSDictionary *)layoutAttributeDescriptionsByValue { static dispatch_once_t once; static NSDictionary *descriptionMap; dispatch_once(&once, ^{ descriptionMap = @{ @(NSLayoutAttributeTop) : @"top", @(NSLayoutAttributeLeft) : @"left", @(NSLayoutAttributeBottom) : @"bottom", @(NSLayoutAttributeRight) : @"right", @(NSLayoutAttributeLeading) : @"leading", @(NSLayoutAttributeTrailing) : @"trailing", @(NSLayoutAttributeWidth) : @"width", @(NSLayoutAttributeHeight) : @"height", @(NSLayoutAttributeCenterX) : @"centerX", @(NSLayoutAttributeCenterY) : @"centerY", @(NSLayoutAttributeBaseline) : @"baseline", #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100) @(NSLayoutAttributeFirstBaseline) : @"firstBaseline", @(NSLayoutAttributeLastBaseline) : @"lastBaseline", #endif #if TARGET_OS_IPHONE || TARGET_OS_TV @(NSLayoutAttributeLeftMargin) : @"leftMargin", @(NSLayoutAttributeRightMargin) : @"rightMargin", @(NSLayoutAttributeTopMargin) : @"topMargin", @(NSLayoutAttributeBottomMargin) : @"bottomMargin", @(NSLayoutAttributeLeadingMargin) : @"leadingMargin", @(NSLayoutAttributeTrailingMargin) : @"trailingMargin", @(NSLayoutAttributeCenterXWithinMargins) : @"centerXWithinMargins", @(NSLayoutAttributeCenterYWithinMargins) : @"centerYWithinMargins", #endif }; }); return descriptionMap; } + (NSDictionary *)layoutPriorityDescriptionsByValue { static dispatch_once_t once; static NSDictionary *descriptionMap; dispatch_once(&once, ^{ #if TARGET_OS_IPHONE || TARGET_OS_TV descriptionMap = @{ @(MASLayoutPriorityDefaultHigh) : @"high", @(MASLayoutPriorityDefaultLow) : @"low", @(MASLayoutPriorityDefaultMedium) : @"medium", @(MASLayoutPriorityRequired) : @"required", @(MASLayoutPriorityFittingSizeLevel) : @"fitting size", }; #elif TARGET_OS_MAC descriptionMap = @{ @(MASLayoutPriorityDefaultHigh) : @"high", @(MASLayoutPriorityDragThatCanResizeWindow) : @"drag can resize window", @(MASLayoutPriorityDefaultMedium) : @"medium", @(MASLayoutPriorityWindowSizeStayPut) : @"window size stay put", @(MASLayoutPriorityDragThatCannotResizeWindow) : @"drag cannot resize window", @(MASLayoutPriorityDefaultLow) : @"low", @(MASLayoutPriorityFittingSizeCompression) : @"fitting size", @(MASLayoutPriorityRequired) : @"required", }; #endif }); return descriptionMap; } #pragma mark - description override + (NSString *)descriptionForObject:(id)obj { if ([obj respondsToSelector:@selector(mas_key)] && [obj mas_key]) { return [NSString stringWithFormat:@"%@:%@", [obj class], [obj mas_key]]; } return [NSString stringWithFormat:@"%@:%p", [obj class], obj]; } - (NSString *)description { NSMutableString *description = [[NSMutableString alloc] initWithString:@"<"]; [description appendString:[self.class descriptionForObject:self]]; [description appendFormat:@" %@", [self.class descriptionForObject:self.firstItem]]; if (self.firstAttribute != NSLayoutAttributeNotAnAttribute) { [description appendFormat:@".%@", self.class.layoutAttributeDescriptionsByValue[@(self.firstAttribute)]]; } [description appendFormat:@" %@", self.class.layoutRelationDescriptionsByValue[@(self.relation)]]; if (self.secondItem) { [description appendFormat:@" %@", [self.class descriptionForObject:self.secondItem]]; } if (self.secondAttribute != NSLayoutAttributeNotAnAttribute) { [description appendFormat:@".%@", self.class.layoutAttributeDescriptionsByValue[@(self.secondAttribute)]]; } if (self.multiplier != 1) { [description appendFormat:@" * %g", self.multiplier]; } if (self.secondAttribute == NSLayoutAttributeNotAnAttribute) { [description appendFormat:@" %g", self.constant]; } else { if (self.constant) { [description appendFormat:@" %@ %g", (self.constant < 0 ? @"-" : @"+"), ABS(self.constant)]; } } if (self.priority != MASLayoutPriorityRequired) { [description appendFormat:@" ^%@", self.class.layoutPriorityDescriptionsByValue[@(self.priority)] ?: [NSNumber numberWithDouble:self.priority]]; } [description appendString:@">"]; return description; } @end ================================================ FILE: Pods/Masonry/Masonry/View+MASAdditions.h ================================================ // // UIView+MASAdditions.h // Masonry // // Created by Jonas Budelmann on 20/07/13. // Copyright (c) 2013 cloudling. All rights reserved. // #import "MASUtilities.h" #import "MASConstraintMaker.h" #import "MASViewAttribute.h" /** * Provides constraint maker block * and convience methods for creating MASViewAttribute which are view + NSLayoutAttribute pairs */ @interface MAS_VIEW (MASAdditions) /** * following properties return a new MASViewAttribute with current view and appropriate NSLayoutAttribute */ @property (nonatomic, strong, readonly) MASViewAttribute *mas_left; @property (nonatomic, strong, readonly) MASViewAttribute *mas_top; @property (nonatomic, strong, readonly) MASViewAttribute *mas_right; @property (nonatomic, strong, readonly) MASViewAttribute *mas_bottom; @property (nonatomic, strong, readonly) MASViewAttribute *mas_leading; @property (nonatomic, strong, readonly) MASViewAttribute *mas_trailing; @property (nonatomic, strong, readonly) MASViewAttribute *mas_width; @property (nonatomic, strong, readonly) MASViewAttribute *mas_height; @property (nonatomic, strong, readonly) MASViewAttribute *mas_centerX; @property (nonatomic, strong, readonly) MASViewAttribute *mas_centerY; @property (nonatomic, strong, readonly) MASViewAttribute *mas_baseline; @property (nonatomic, strong, readonly) MASViewAttribute *(^mas_attribute)(NSLayoutAttribute attr); #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100) @property (nonatomic, strong, readonly) MASViewAttribute *mas_firstBaseline; @property (nonatomic, strong, readonly) MASViewAttribute *mas_lastBaseline; #endif #if TARGET_OS_IPHONE || TARGET_OS_TV @property (nonatomic, strong, readonly) MASViewAttribute *mas_leftMargin; @property (nonatomic, strong, readonly) MASViewAttribute *mas_rightMargin; @property (nonatomic, strong, readonly) MASViewAttribute *mas_topMargin; @property (nonatomic, strong, readonly) MASViewAttribute *mas_bottomMargin; @property (nonatomic, strong, readonly) MASViewAttribute *mas_leadingMargin; @property (nonatomic, strong, readonly) MASViewAttribute *mas_trailingMargin; @property (nonatomic, strong, readonly) MASViewAttribute *mas_centerXWithinMargins; @property (nonatomic, strong, readonly) MASViewAttribute *mas_centerYWithinMargins; #endif /** * a key to associate with this view */ @property (nonatomic, strong) id mas_key; /** * Finds the closest common superview between this view and another view * * @param view other view * * @return returns nil if common superview could not be found */ - (instancetype)mas_closestCommonSuperview:(MAS_VIEW *)view; /** * Creates a MASConstraintMaker with the callee view. * Any constraints defined are added to the view or the appropriate superview once the block has finished executing * * @param block scope within which you can build up the constraints which you wish to apply to the view. * * @return Array of created MASConstraints */ - (NSArray *)mas_makeConstraints:(void(^)(MASConstraintMaker *make))block; /** * Creates a MASConstraintMaker with the callee view. * Any constraints defined are added to the view or the appropriate superview once the block has finished executing. * If an existing constraint exists then it will be updated instead. * * @param block scope within which you can build up the constraints which you wish to apply to the view. * * @return Array of created/updated MASConstraints */ - (NSArray *)mas_updateConstraints:(void(^)(MASConstraintMaker *make))block; /** * Creates a MASConstraintMaker with the callee view. * Any constraints defined are added to the view or the appropriate superview once the block has finished executing. * All constraints previously installed for the view will be removed. * * @param block scope within which you can build up the constraints which you wish to apply to the view. * * @return Array of created/updated MASConstraints */ - (NSArray *)mas_remakeConstraints:(void(^)(MASConstraintMaker *make))block; @end ================================================ FILE: Pods/Masonry/Masonry/View+MASAdditions.m ================================================ // // UIView+MASAdditions.m // Masonry // // Created by Jonas Budelmann on 20/07/13. // Copyright (c) 2013 cloudling. All rights reserved. // #import "View+MASAdditions.h" #import @implementation MAS_VIEW (MASAdditions) - (NSArray *)mas_makeConstraints:(void(^)(MASConstraintMaker *))block { self.translatesAutoresizingMaskIntoConstraints = NO; MASConstraintMaker *constraintMaker = [[MASConstraintMaker alloc] initWithView:self]; block(constraintMaker); return [constraintMaker install]; } - (NSArray *)mas_updateConstraints:(void(^)(MASConstraintMaker *))block { self.translatesAutoresizingMaskIntoConstraints = NO; MASConstraintMaker *constraintMaker = [[MASConstraintMaker alloc] initWithView:self]; constraintMaker.updateExisting = YES; block(constraintMaker); return [constraintMaker install]; } - (NSArray *)mas_remakeConstraints:(void(^)(MASConstraintMaker *make))block { self.translatesAutoresizingMaskIntoConstraints = NO; MASConstraintMaker *constraintMaker = [[MASConstraintMaker alloc] initWithView:self]; constraintMaker.removeExisting = YES; block(constraintMaker); return [constraintMaker install]; } #pragma mark - NSLayoutAttribute properties - (MASViewAttribute *)mas_left { return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeLeft]; } - (MASViewAttribute *)mas_top { return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeTop]; } - (MASViewAttribute *)mas_right { return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeRight]; } - (MASViewAttribute *)mas_bottom { return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeBottom]; } - (MASViewAttribute *)mas_leading { return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeLeading]; } - (MASViewAttribute *)mas_trailing { return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeTrailing]; } - (MASViewAttribute *)mas_width { return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeWidth]; } - (MASViewAttribute *)mas_height { return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeHeight]; } - (MASViewAttribute *)mas_centerX { return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeCenterX]; } - (MASViewAttribute *)mas_centerY { return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeCenterY]; } - (MASViewAttribute *)mas_baseline { return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeBaseline]; } - (MASViewAttribute *(^)(NSLayoutAttribute))mas_attribute { return ^(NSLayoutAttribute attr) { return [[MASViewAttribute alloc] initWithView:self layoutAttribute:attr]; }; } #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100) - (MASViewAttribute *)mas_firstBaseline { return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeFirstBaseline]; } - (MASViewAttribute *)mas_lastBaseline { return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeLastBaseline]; } #endif #if TARGET_OS_IPHONE || TARGET_OS_TV - (MASViewAttribute *)mas_leftMargin { return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeLeftMargin]; } - (MASViewAttribute *)mas_rightMargin { return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeRightMargin]; } - (MASViewAttribute *)mas_topMargin { return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeTopMargin]; } - (MASViewAttribute *)mas_bottomMargin { return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeBottomMargin]; } - (MASViewAttribute *)mas_leadingMargin { return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeLeadingMargin]; } - (MASViewAttribute *)mas_trailingMargin { return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeTrailingMargin]; } - (MASViewAttribute *)mas_centerXWithinMargins { return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeCenterXWithinMargins]; } - (MASViewAttribute *)mas_centerYWithinMargins { return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeCenterYWithinMargins]; } #endif #pragma mark - associated properties - (id)mas_key { return objc_getAssociatedObject(self, @selector(mas_key)); } - (void)setMas_key:(id)key { objc_setAssociatedObject(self, @selector(mas_key), key, OBJC_ASSOCIATION_RETAIN_NONATOMIC); } #pragma mark - heirachy - (instancetype)mas_closestCommonSuperview:(MAS_VIEW *)view { MAS_VIEW *closestCommonSuperview = nil; MAS_VIEW *secondViewSuperview = view; while (!closestCommonSuperview && secondViewSuperview) { MAS_VIEW *firstViewSuperview = self; while (!closestCommonSuperview && firstViewSuperview) { if (secondViewSuperview == firstViewSuperview) { closestCommonSuperview = secondViewSuperview; } firstViewSuperview = firstViewSuperview.superview; } secondViewSuperview = secondViewSuperview.superview; } return closestCommonSuperview; } @end ================================================ FILE: Pods/Masonry/Masonry/View+MASShorthandAdditions.h ================================================ // // UIView+MASShorthandAdditions.h // Masonry // // Created by Jonas Budelmann on 22/07/13. // Copyright (c) 2013 Jonas Budelmann. All rights reserved. // #import "View+MASAdditions.h" #ifdef MAS_SHORTHAND /** * Shorthand view additions without the 'mas_' prefixes, * only enabled if MAS_SHORTHAND is defined */ @interface MAS_VIEW (MASShorthandAdditions) @property (nonatomic, strong, readonly) MASViewAttribute *left; @property (nonatomic, strong, readonly) MASViewAttribute *top; @property (nonatomic, strong, readonly) MASViewAttribute *right; @property (nonatomic, strong, readonly) MASViewAttribute *bottom; @property (nonatomic, strong, readonly) MASViewAttribute *leading; @property (nonatomic, strong, readonly) MASViewAttribute *trailing; @property (nonatomic, strong, readonly) MASViewAttribute *width; @property (nonatomic, strong, readonly) MASViewAttribute *height; @property (nonatomic, strong, readonly) MASViewAttribute *centerX; @property (nonatomic, strong, readonly) MASViewAttribute *centerY; @property (nonatomic, strong, readonly) MASViewAttribute *baseline; @property (nonatomic, strong, readonly) MASViewAttribute *(^attribute)(NSLayoutAttribute attr); #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100) @property (nonatomic, strong, readonly) MASViewAttribute *firstBaseline; @property (nonatomic, strong, readonly) MASViewAttribute *lastBaseline; #endif #if TARGET_OS_IPHONE || TARGET_OS_TV @property (nonatomic, strong, readonly) MASViewAttribute *leftMargin; @property (nonatomic, strong, readonly) MASViewAttribute *rightMargin; @property (nonatomic, strong, readonly) MASViewAttribute *topMargin; @property (nonatomic, strong, readonly) MASViewAttribute *bottomMargin; @property (nonatomic, strong, readonly) MASViewAttribute *leadingMargin; @property (nonatomic, strong, readonly) MASViewAttribute *trailingMargin; @property (nonatomic, strong, readonly) MASViewAttribute *centerXWithinMargins; @property (nonatomic, strong, readonly) MASViewAttribute *centerYWithinMargins; #endif - (NSArray *)makeConstraints:(void(^)(MASConstraintMaker *make))block; - (NSArray *)updateConstraints:(void(^)(MASConstraintMaker *make))block; - (NSArray *)remakeConstraints:(void(^)(MASConstraintMaker *make))block; @end #define MAS_ATTR_FORWARD(attr) \ - (MASViewAttribute *)attr { \ return [self mas_##attr]; \ } @implementation MAS_VIEW (MASShorthandAdditions) MAS_ATTR_FORWARD(top); MAS_ATTR_FORWARD(left); MAS_ATTR_FORWARD(bottom); MAS_ATTR_FORWARD(right); MAS_ATTR_FORWARD(leading); MAS_ATTR_FORWARD(trailing); MAS_ATTR_FORWARD(width); MAS_ATTR_FORWARD(height); MAS_ATTR_FORWARD(centerX); MAS_ATTR_FORWARD(centerY); MAS_ATTR_FORWARD(baseline); #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100) MAS_ATTR_FORWARD(firstBaseline); MAS_ATTR_FORWARD(lastBaseline); #endif #if TARGET_OS_IPHONE || TARGET_OS_TV MAS_ATTR_FORWARD(leftMargin); MAS_ATTR_FORWARD(rightMargin); MAS_ATTR_FORWARD(topMargin); MAS_ATTR_FORWARD(bottomMargin); MAS_ATTR_FORWARD(leadingMargin); MAS_ATTR_FORWARD(trailingMargin); MAS_ATTR_FORWARD(centerXWithinMargins); MAS_ATTR_FORWARD(centerYWithinMargins); #endif - (MASViewAttribute *(^)(NSLayoutAttribute))attribute { return [self mas_attribute]; } - (NSArray *)makeConstraints:(void(^)(MASConstraintMaker *))block { return [self mas_makeConstraints:block]; } - (NSArray *)updateConstraints:(void(^)(MASConstraintMaker *))block { return [self mas_updateConstraints:block]; } - (NSArray *)remakeConstraints:(void(^)(MASConstraintMaker *))block { return [self mas_remakeConstraints:block]; } @end #endif ================================================ FILE: Pods/Masonry/Masonry/ViewController+MASAdditions.h ================================================ // // UIViewController+MASAdditions.h // Masonry // // Created by Craig Siemens on 2015-06-23. // // #import "MASUtilities.h" #import "MASConstraintMaker.h" #import "MASViewAttribute.h" #ifdef MAS_VIEW_CONTROLLER @interface MAS_VIEW_CONTROLLER (MASAdditions) /** * following properties return a new MASViewAttribute with appropriate UILayoutGuide and NSLayoutAttribute */ @property (nonatomic, strong, readonly) MASViewAttribute *mas_topLayoutGuide; @property (nonatomic, strong, readonly) MASViewAttribute *mas_bottomLayoutGuide; @property (nonatomic, strong, readonly) MASViewAttribute *mas_topLayoutGuideTop; @property (nonatomic, strong, readonly) MASViewAttribute *mas_topLayoutGuideBottom; @property (nonatomic, strong, readonly) MASViewAttribute *mas_bottomLayoutGuideTop; @property (nonatomic, strong, readonly) MASViewAttribute *mas_bottomLayoutGuideBottom; @end #endif ================================================ FILE: Pods/Masonry/Masonry/ViewController+MASAdditions.m ================================================ // // UIViewController+MASAdditions.m // Masonry // // Created by Craig Siemens on 2015-06-23. // // #import "ViewController+MASAdditions.h" #ifdef MAS_VIEW_CONTROLLER @implementation MAS_VIEW_CONTROLLER (MASAdditions) - (MASViewAttribute *)mas_topLayoutGuide { return [[MASViewAttribute alloc] initWithView:self.view item:self.topLayoutGuide layoutAttribute:NSLayoutAttributeBottom]; } - (MASViewAttribute *)mas_topLayoutGuideTop { return [[MASViewAttribute alloc] initWithView:self.view item:self.topLayoutGuide layoutAttribute:NSLayoutAttributeTop]; } - (MASViewAttribute *)mas_topLayoutGuideBottom { return [[MASViewAttribute alloc] initWithView:self.view item:self.topLayoutGuide layoutAttribute:NSLayoutAttributeBottom]; } - (MASViewAttribute *)mas_bottomLayoutGuide { return [[MASViewAttribute alloc] initWithView:self.view item:self.bottomLayoutGuide layoutAttribute:NSLayoutAttributeTop]; } - (MASViewAttribute *)mas_bottomLayoutGuideTop { return [[MASViewAttribute alloc] initWithView:self.view item:self.bottomLayoutGuide layoutAttribute:NSLayoutAttributeTop]; } - (MASViewAttribute *)mas_bottomLayoutGuideBottom { return [[MASViewAttribute alloc] initWithView:self.view item:self.bottomLayoutGuide layoutAttribute:NSLayoutAttributeBottom]; } @end #endif ================================================ FILE: Pods/Masonry/README.md ================================================ #Masonry [![Build Status](https://travis-ci.org/SnapKit/Masonry.svg?branch=master)](https://travis-ci.org/SnapKit/Masonry) [![Coverage Status](https://img.shields.io/coveralls/SnapKit/Masonry.svg?style=flat-square)](https://coveralls.io/r/SnapKit/Masonry) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) **Masonry is still actively maintained, we are committed to fixing bugs and merging good quality PRs from the wider community. However if you're using Swift in your project, we recommend using [SnapKit](https://github.com/SnapKit/SnapKit) as it provides better type safety with a simpler API.** Masonry is a light-weight layout framework which wraps AutoLayout with a nicer syntax. Masonry has its own layout DSL which provides a chainable way of describing your NSLayoutConstraints which results in layout code that is more concise and readable. Masonry supports iOS and Mac OS X. For examples take a look at the **Masonry iOS Examples** project in the Masonry workspace. You will need to run `pod install` after downloading. ## What's wrong with NSLayoutConstraints? Under the hood Auto Layout is a powerful and flexible way of organising and laying out your views. However creating constraints from code is verbose and not very descriptive. Imagine a simple example in which you want to have a view fill its superview but inset by 10 pixels on every side ```obj-c UIView *superview = self.view; UIView *view1 = [[UIView alloc] init]; view1.translatesAutoresizingMaskIntoConstraints = NO; view1.backgroundColor = [UIColor greenColor]; [superview addSubview:view1]; UIEdgeInsets padding = UIEdgeInsetsMake(10, 10, 10, 10); [superview addConstraints:@[ //view1 constraints [NSLayoutConstraint constraintWithItem:view1 attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:superview attribute:NSLayoutAttributeTop multiplier:1.0 constant:padding.top], [NSLayoutConstraint constraintWithItem:view1 attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:superview attribute:NSLayoutAttributeLeft multiplier:1.0 constant:padding.left], [NSLayoutConstraint constraintWithItem:view1 attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:superview attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-padding.bottom], [NSLayoutConstraint constraintWithItem:view1 attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:superview attribute:NSLayoutAttributeRight multiplier:1 constant:-padding.right], ]]; ``` Even with such a simple example the code needed is quite verbose and quickly becomes unreadable when you have more than 2 or 3 views. Another option is to use Visual Format Language (VFL), which is a bit less long winded. However the ASCII type syntax has its own pitfalls and its also a bit harder to animate as `NSLayoutConstraint constraintsWithVisualFormat:` returns an array. ## Prepare to meet your Maker! Heres the same constraints created using MASConstraintMaker ```obj-c UIEdgeInsets padding = UIEdgeInsetsMake(10, 10, 10, 10); [view1 mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(superview.mas_top).with.offset(padding.top); //with is an optional semantic filler make.left.equalTo(superview.mas_left).with.offset(padding.left); make.bottom.equalTo(superview.mas_bottom).with.offset(-padding.bottom); make.right.equalTo(superview.mas_right).with.offset(-padding.right); }]; ``` Or even shorter ```obj-c [view1 mas_makeConstraints:^(MASConstraintMaker *make) { make.edges.equalTo(superview).with.insets(padding); }]; ``` Also note in the first example we had to add the constraints to the superview `[superview addConstraints:...`. Masonry however will automagically add constraints to the appropriate view. Masonry will also call `view1.translatesAutoresizingMaskIntoConstraints = NO;` for you. ## Not all things are created equal > `.equalTo` equivalent to **NSLayoutRelationEqual** > `.lessThanOrEqualTo` equivalent to **NSLayoutRelationLessThanOrEqual** > `.greaterThanOrEqualTo` equivalent to **NSLayoutRelationGreaterThanOrEqual** These three equality constraints accept one argument which can be any of the following: #### 1. MASViewAttribute ```obj-c make.centerX.lessThanOrEqualTo(view2.mas_left); ``` MASViewAttribute | NSLayoutAttribute ------------------------- | -------------------------- view.mas_left | NSLayoutAttributeLeft view.mas_right | NSLayoutAttributeRight view.mas_top | NSLayoutAttributeTop view.mas_bottom | NSLayoutAttributeBottom view.mas_leading | NSLayoutAttributeLeading view.mas_trailing | NSLayoutAttributeTrailing view.mas_width | NSLayoutAttributeWidth view.mas_height | NSLayoutAttributeHeight view.mas_centerX | NSLayoutAttributeCenterX view.mas_centerY | NSLayoutAttributeCenterY view.mas_baseline | NSLayoutAttributeBaseline #### 2. UIView/NSView if you want view.left to be greater than or equal to label.left : ```obj-c //these two constraints are exactly the same make.left.greaterThanOrEqualTo(label); make.left.greaterThanOrEqualTo(label.mas_left); ``` #### 3. NSNumber Auto Layout allows width and height to be set to constant values. if you want to set view to have a minimum and maximum width you could pass a number to the equality blocks: ```obj-c //width >= 200 && width <= 400 make.width.greaterThanOrEqualTo(@200); make.width.lessThanOrEqualTo(@400) ``` However Auto Layout does not allow alignment attributes such as left, right, centerY etc to be set to constant values. So if you pass a NSNumber for these attributes Masonry will turn these into constraints relative to the view’s superview ie: ```obj-c //creates view.left = view.superview.left + 10 make.left.lessThanOrEqualTo(@10) ``` Instead of using NSNumber, you can use primitives and structs to build your constraints, like so: ```obj-c make.top.mas_equalTo(42); make.height.mas_equalTo(20); make.size.mas_equalTo(CGSizeMake(50, 100)); make.edges.mas_equalTo(UIEdgeInsetsMake(10, 0, 10, 0)); make.left.mas_equalTo(view).mas_offset(UIEdgeInsetsMake(10, 0, 10, 0)); ``` By default, macros which support [autoboxing](https://en.wikipedia.org/wiki/Autoboxing#Autoboxing) are prefixed with `mas_`. Unprefixed versions are available by defining `MAS_SHORTHAND_GLOBALS` before importing Masonry. #### 4. NSArray An array of a mixture of any of the previous types ```obj-c make.height.equalTo(@[view1.mas_height, view2.mas_height]); make.height.equalTo(@[view1, view2]); make.left.equalTo(@[view1, @100, view3.right]); ```` ## Learn to prioritize > `.priority` allows you to specify an exact priority > `.priorityHigh` equivalent to **UILayoutPriorityDefaultHigh** > `.priorityMedium` is half way between high and low > `.priorityLow` equivalent to **UILayoutPriorityDefaultLow** Priorities are can be tacked on to the end of a constraint chain like so: ```obj-c make.left.greaterThanOrEqualTo(label.mas_left).with.priorityLow(); make.top.equalTo(label.mas_top).with.priority(600); ``` ## Composition, composition, composition Masonry also gives you a few convenience methods which create multiple constraints at the same time. These are called MASCompositeConstraints #### edges ```obj-c // make top, left, bottom, right equal view2 make.edges.equalTo(view2); // make top = superview.top + 5, left = superview.left + 10, // bottom = superview.bottom - 15, right = superview.right - 20 make.edges.equalTo(superview).insets(UIEdgeInsetsMake(5, 10, 15, 20)) ``` #### size ```obj-c // make width and height greater than or equal to titleLabel make.size.greaterThanOrEqualTo(titleLabel) // make width = superview.width + 100, height = superview.height - 50 make.size.equalTo(superview).sizeOffset(CGSizeMake(100, -50)) ``` #### center ```obj-c // make centerX and centerY = button1 make.center.equalTo(button1) // make centerX = superview.centerX - 5, centerY = superview.centerY + 10 make.center.equalTo(superview).centerOffset(CGPointMake(-5, 10)) ``` You can chain view attributes for increased readability: ```obj-c // All edges but the top should equal those of the superview make.left.right.and.bottom.equalTo(superview); make.top.equalTo(otherView); ``` ## Hold on for dear life Sometimes you need modify existing constraints in order to animate or remove/replace constraints. In Masonry there are a few different approaches to updating constraints. #### 1. References You can hold on to a reference of a particular constraint by assigning the result of a constraint make expression to a local variable or a class property. You could also reference multiple constraints by storing them away in an array. ```obj-c // in public/private interface @property (nonatomic, strong) MASConstraint *topConstraint; ... // when making constraints [view1 mas_makeConstraints:^(MASConstraintMaker *make) { self.topConstraint = make.top.equalTo(superview.mas_top).with.offset(padding.top); make.left.equalTo(superview.mas_left).with.offset(padding.left); }]; ... // then later you can call [self.topConstraint uninstall]; ``` #### 2. mas_updateConstraints Alternatively if you are only updating the constant value of the constraint you can use the convience method `mas_updateConstraints` instead of `mas_makeConstraints` ```obj-c // this is Apple's recommended place for adding/updating constraints // this method can get called multiple times in response to setNeedsUpdateConstraints // which can be called by UIKit internally or in your code if you need to trigger an update to your constraints - (void)updateConstraints { [self.growingButton mas_updateConstraints:^(MASConstraintMaker *make) { make.center.equalTo(self); make.width.equalTo(@(self.buttonSize.width)).priorityLow(); make.height.equalTo(@(self.buttonSize.height)).priorityLow(); make.width.lessThanOrEqualTo(self); make.height.lessThanOrEqualTo(self); }]; //according to apple super should be called at end of method [super updateConstraints]; } ``` ### 3. mas_remakeConstraints `mas_updateConstraints` is useful for updating a set of constraints, but doing anything beyond updating constant values can get exhausting. That's where `mas_remakeConstraints` comes in. `mas_remakeConstraints` is similar to `mas_updateConstraints`, but instead of updating constant values, it will remove all of its constraints before installing them again. This lets you provide different constraints without having to keep around references to ones which you want to remove. ```obj-c - (void)changeButtonPosition { [self.button mas_remakeConstraints:^(MASConstraintMaker *make) { make.size.equalTo(self.buttonSize); if (topLeft) { make.top.and.left.offset(10); } else { make.bottom.and.right.offset(-10); } }]; } ``` You can find more detailed examples of all three approaches in the **Masonry iOS Examples** project. ## When the ^&*!@ hits the fan! Laying out your views doesn't always goto plan. So when things literally go pear shaped, you don't want to be looking at console output like this: ```obj-c Unable to simultaneously satisfy constraints.....blah blah blah.... ( "=5000)]>", "", "", "" ) Will attempt to recover by breaking constraint =5000)]> ``` Masonry adds a category to NSLayoutConstraint which overrides the default implementation of `- (NSString *)description`. Now you can give meaningful names to views and constraints, and also easily pick out the constraints created by Masonry. which means your console output can now look like this: ```obj-c Unable to simultaneously satisfy constraints......blah blah blah.... ( "", "= 5000>", "", "" ) Will attempt to recover by breaking constraint = 5000> ``` For an example of how to set this up take a look at the **Masonry iOS Examples** project in the Masonry workspace. ## Where should I create my constraints? ```objc @implementation DIYCustomView - (id)init { self = [super init]; if (!self) return nil; // --- Create your views here --- self.button = [[UIButton alloc] init]; return self; } // tell UIKit that you are using AutoLayout + (BOOL)requiresConstraintBasedLayout { return YES; } // this is Apple's recommended place for adding/updating constraints - (void)updateConstraints { // --- remake/update constraints here [self.button remakeConstraints:^(MASConstraintMaker *make) { make.width.equalTo(@(self.buttonSize.width)); make.height.equalTo(@(self.buttonSize.height)); }]; //according to apple super should be called at end of method [super updateConstraints]; } - (void)didTapButton:(UIButton *)button { // --- Do your changes ie change variables that affect your layout etc --- self.buttonSize = CGSize(200, 200); // tell constraints they need updating [self setNeedsUpdateConstraints]; } @end ``` ## Installation Use the [orsome](http://www.youtube.com/watch?v=YaIZF8uUTtk) [CocoaPods](http://github.com/CocoaPods/CocoaPods). In your Podfile >`pod 'Masonry'` If you want to use masonry without all those pesky 'mas_' prefixes. Add #define MAS_SHORTHAND to your prefix.pch before importing Masonry >`#define MAS_SHORTHAND` Get busy Masoning >`#import "Masonry.h"` ## Code Snippets Copy the included code snippets to ``~/Library/Developer/Xcode/UserData/CodeSnippets`` to write your masonry blocks at lightning speed! `mas_make` -> `[ mas_makeConstraints:^(MASConstraintMaker *make){}];` `mas_update` -> `[ mas_updateConstraints:^(MASConstraintMaker *make){}];` `mas_remake` -> `[ mas_remakeConstraints:^(MASConstraintMaker *make){}];` ## Features * Not limited to subset of Auto Layout. Anything NSLayoutConstraint can do, Masonry can do too! * Great debug support, give your views and constraints meaningful names. * Constraints read like sentences. * No crazy macro magic. Masonry won't pollute the global namespace with macros. * Not string or dictionary based and hence you get compile time checking. ## TODO * Eye candy * Mac example project * More tests and examples ================================================ FILE: Pods/Pods.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 2905381350CEFFBFFA9BC8B5D027F190 /* MASConstraint.h in Headers */ = {isa = PBXBuildFile; fileRef = 3162AC8E29FA7F3BF0D8641F7F4D9B60 /* MASConstraint.h */; settings = {ATTRIBUTES = (Public, ); }; }; 2979E54C4AFD27076576E82ADEED2F00 /* NSLayoutConstraint+MASDebugAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = E158FC65C5404E098F16E26F478DA504 /* NSLayoutConstraint+MASDebugAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; }; 331718BFB4A91CFFE026492905231562 /* ViewController+MASAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = FA891F8E85C079B4FB101DDD5BC7A477 /* ViewController+MASAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; }; 335DCBC17D2469F228020EF6C7B41F7C /* MASConstraintMaker.m in Sources */ = {isa = PBXBuildFile; fileRef = F8AB44751192F0AA8DA5F75A06138D15 /* MASConstraintMaker.m */; }; 3F63C119F95A6735AE627BBB1BEBC4B1 /* MASViewAttribute.h in Headers */ = {isa = PBXBuildFile; fileRef = 915A6FF0E04F5A5C0ACDE0E32BD2F193 /* MASViewAttribute.h */; settings = {ATTRIBUTES = (Public, ); }; }; 432BD50F1E699EDF2EA007E850FFCEF7 /* View+MASShorthandAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A9F610CB90E57B81F8F7DCA2176E0FD /* View+MASShorthandAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; }; 5457FCC2699281B5A4203BA1559F593F /* NSArray+MASAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 8229525E7067F22D3977D2628DF5F2C3 /* NSArray+MASAdditions.m */; }; 62DAADF0C9FB03DB4EF37E440795779D /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A2A6FF208CEC4C2861F1E9D42D651453 /* Foundation.framework */; }; 81403CAF6C4C1D3DC8B199289C3A6F59 /* View+MASAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 2FCC2A09AC3DCD0E4A3D268DAABC5135 /* View+MASAdditions.m */; }; 81599471BAB0420D54E1ADF8507A5113 /* Masonry-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B5A231E76AF7DC6CB887B5B2C522A7A /* Masonry-dummy.m */; }; 9205037BA8C22574B33FC96C5EA829A3 /* Masonry.h in Headers */ = {isa = PBXBuildFile; fileRef = EC0384F145CF471A951BA8E9486AD626 /* Masonry.h */; settings = {ATTRIBUTES = (Public, ); }; }; 945EB2145BBD46F041D00A85AD7DA1DC /* Pods-HYBHelperKit-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 70FA6792CD93759BDF34C503FC36015A /* Pods-HYBHelperKit-dummy.m */; }; 99D8C610BC84BE231C5D3D280F3B12AF /* MASCompositeConstraint.h in Headers */ = {isa = PBXBuildFile; fileRef = 475326F2A929CD1AFFB74850961F32C0 /* MASCompositeConstraint.h */; settings = {ATTRIBUTES = (Public, ); }; }; A44AF130E4C5313CD193D9BF68853026 /* MASViewAttribute.m in Sources */ = {isa = PBXBuildFile; fileRef = 82F28AEAAF722BC62BF5B37D6663BBC2 /* MASViewAttribute.m */; }; A7D31BD1F3AD4ED4612467FAD332F388 /* NSArray+MASShorthandAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = FBE23E70FF64ACC81816A368E171B903 /* NSArray+MASShorthandAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; }; AF4E7187E09A5AF3A0758991203153DC /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E86668F20F252C440D1015B816BE59C5 /* UIKit.framework */; }; AF62B956405F7734F5A9B8F3FD4B1B96 /* ViewController+MASAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 25CED739CF35B6D0A1D95AE17D712A7F /* ViewController+MASAdditions.m */; }; B2B7C90BA9C4DBD9851C75AC801B0E8E /* MASConstraint+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 22E2395DA2EBCF6241A0DA0E1859FF45 /* MASConstraint+Private.h */; settings = {ATTRIBUTES = (Public, ); }; }; BCD4B362C6194513150915437754E2D4 /* MASCompositeConstraint.m in Sources */ = {isa = PBXBuildFile; fileRef = D5EC6EDDDD3E503C5B2E967D3FEECFEB /* MASCompositeConstraint.m */; }; BDD210D7537DD15CFE59AE126005E5F8 /* MASLayoutConstraint.m in Sources */ = {isa = PBXBuildFile; fileRef = 807FFD255E8235D5B42FE078299B5F1B /* MASLayoutConstraint.m */; }; BE024118D329F8F566BD1811A1DC16CB /* MASConstraint.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F937BDEB8DF93A08D20C5355C0FDB5C /* MASConstraint.m */; }; C18632AD31935503078B89057E3E906A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A2A6FF208CEC4C2861F1E9D42D651453 /* Foundation.framework */; }; C6EE194D232E9FE87097C0F1DF91B9FA /* MASLayoutConstraint.h in Headers */ = {isa = PBXBuildFile; fileRef = B48867DE203BCF3BB3DFCAB8FDC7516B /* MASLayoutConstraint.h */; settings = {ATTRIBUTES = (Public, ); }; }; CAE1578107F1A837277105016305211C /* Pods-HYBHelperKitTests-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = EE1C220A5860721F1AAA1830A2A8EA0C /* Pods-HYBHelperKitTests-dummy.m */; }; D3D9F12613E23AD64C1FA5F7081A3668 /* NSLayoutConstraint+MASDebugAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = C762C4F3A304C10AF7EBEA6AAA8508A0 /* NSLayoutConstraint+MASDebugAdditions.m */; }; DD1F717B0527C71229B3339324E35E55 /* View+MASAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 8E7E17DB5590A8C4D9625D67E6FBD243 /* View+MASAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; }; DE31B168D9197213CEB7B90E3ADEB4CC /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A2A6FF208CEC4C2861F1E9D42D651453 /* Foundation.framework */; }; E6B49FBCE3957DB67F691ACCC4CAF4BE /* MASViewConstraint.m in Sources */ = {isa = PBXBuildFile; fileRef = C7C02266037F030E22468AC86802DB57 /* MASViewConstraint.m */; }; EB02AEF303313F801392DE8D90AFF0F7 /* MASViewConstraint.h in Headers */ = {isa = PBXBuildFile; fileRef = 043FB94CF93050E20D8E4C071ACFA5D2 /* MASViewConstraint.h */; settings = {ATTRIBUTES = (Public, ); }; }; EC6CCC98505D2067BC98B4E6223C9DF8 /* MASConstraintMaker.h in Headers */ = {isa = PBXBuildFile; fileRef = 780A86CEB0A0131C88BE12414D500734 /* MASConstraintMaker.h */; settings = {ATTRIBUTES = (Public, ); }; }; FD39EBE3398E1A99965AC003B273450D /* NSArray+MASAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = B179F4D3D34A3CE25A698B8D9AC9D6C2 /* NSArray+MASAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; }; FF682E8B083BAEBBDF38C52D89D45E37 /* MASUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 1321572A3ED9C894C94A131BE29B81B2 /* MASUtilities.h */; settings = {ATTRIBUTES = (Public, ); }; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ B27D35E3A05CDD0911272D11A48878BE /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; proxyType = 1; remoteGlobalIDString = 53480ED0BE09FF49E34B1702D485CAAB; remoteInfo = Masonry; }; /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ 043FB94CF93050E20D8E4C071ACFA5D2 /* MASViewConstraint.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MASViewConstraint.h; path = Masonry/MASViewConstraint.h; sourceTree = ""; }; 1321572A3ED9C894C94A131BE29B81B2 /* MASUtilities.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MASUtilities.h; path = Masonry/MASUtilities.h; sourceTree = ""; }; 1B39B777C639471DA1577E21933D04EA /* libPods-HYBHelperKitTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-HYBHelperKitTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 215515CAD9991A91DD3F9770980BC722 /* Pods-HYBHelperKit-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-HYBHelperKit-resources.sh"; sourceTree = ""; }; 22E2395DA2EBCF6241A0DA0E1859FF45 /* MASConstraint+Private.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "MASConstraint+Private.h"; path = "Masonry/MASConstraint+Private.h"; sourceTree = ""; }; 25CED739CF35B6D0A1D95AE17D712A7F /* ViewController+MASAdditions.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "ViewController+MASAdditions.m"; path = "Masonry/ViewController+MASAdditions.m"; sourceTree = ""; }; 2E4DF2D22770A60F9CCEC443AB877D93 /* Pods-HYBHelperKit-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-HYBHelperKit-frameworks.sh"; sourceTree = ""; }; 2FCC2A09AC3DCD0E4A3D268DAABC5135 /* View+MASAdditions.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "View+MASAdditions.m"; path = "Masonry/View+MASAdditions.m"; sourceTree = ""; }; 3162AC8E29FA7F3BF0D8641F7F4D9B60 /* MASConstraint.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MASConstraint.h; path = Masonry/MASConstraint.h; sourceTree = ""; }; 440C106000E67FB628FF5B14691C1757 /* Pods-HYBHelperKitTests-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-HYBHelperKitTests-acknowledgements.markdown"; sourceTree = ""; }; 475326F2A929CD1AFFB74850961F32C0 /* MASCompositeConstraint.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MASCompositeConstraint.h; path = Masonry/MASCompositeConstraint.h; sourceTree = ""; }; 480E43D5D83BB182BC97D90FC9AE1262 /* Pods-HYBHelperKitTests-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-HYBHelperKitTests-resources.sh"; sourceTree = ""; }; 4A3B844C12D52EA22748806384A329C6 /* Pods-HYBHelperKitTests-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-HYBHelperKitTests-acknowledgements.plist"; sourceTree = ""; }; 4FE404CFCFBDEF12F83661822F0E0F0B /* libMasonry.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libMasonry.a; sourceTree = BUILT_PRODUCTS_DIR; }; 5BAB376A6866A8C00AD546C8D96CECCF /* Pods-HYBHelperKitTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-HYBHelperKitTests.release.xcconfig"; sourceTree = ""; }; 7036F598DB6570810910F466DF8CC974 /* Pods-HYBHelperKitTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-HYBHelperKitTests.debug.xcconfig"; sourceTree = ""; }; 70FA6792CD93759BDF34C503FC36015A /* Pods-HYBHelperKit-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-HYBHelperKit-dummy.m"; sourceTree = ""; }; 780A86CEB0A0131C88BE12414D500734 /* MASConstraintMaker.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MASConstraintMaker.h; path = Masonry/MASConstraintMaker.h; sourceTree = ""; }; 7882AB8492CA4F59F730C76CC3BBF57A /* Masonry.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Masonry.xcconfig; sourceTree = ""; }; 7B5A231E76AF7DC6CB887B5B2C522A7A /* Masonry-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Masonry-dummy.m"; sourceTree = ""; }; 807FFD255E8235D5B42FE078299B5F1B /* MASLayoutConstraint.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = MASLayoutConstraint.m; path = Masonry/MASLayoutConstraint.m; sourceTree = ""; }; 8229525E7067F22D3977D2628DF5F2C3 /* NSArray+MASAdditions.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "NSArray+MASAdditions.m"; path = "Masonry/NSArray+MASAdditions.m"; sourceTree = ""; }; 82F28AEAAF722BC62BF5B37D6663BBC2 /* MASViewAttribute.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = MASViewAttribute.m; path = Masonry/MASViewAttribute.m; sourceTree = ""; }; 85F3055099D8EFE97A7FF054AA8E3042 /* Pods-HYBHelperKitTests-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-HYBHelperKitTests-frameworks.sh"; sourceTree = ""; }; 8A9F610CB90E57B81F8F7DCA2176E0FD /* View+MASShorthandAdditions.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "View+MASShorthandAdditions.h"; path = "Masonry/View+MASShorthandAdditions.h"; sourceTree = ""; }; 8E7E17DB5590A8C4D9625D67E6FBD243 /* View+MASAdditions.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "View+MASAdditions.h"; path = "Masonry/View+MASAdditions.h"; sourceTree = ""; }; 915A6FF0E04F5A5C0ACDE0E32BD2F193 /* MASViewAttribute.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MASViewAttribute.h; path = Masonry/MASViewAttribute.h; sourceTree = ""; }; 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; 9F937BDEB8DF93A08D20C5355C0FDB5C /* MASConstraint.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = MASConstraint.m; path = Masonry/MASConstraint.m; sourceTree = ""; }; A01C92C418752C9213688B928FC8B390 /* Pods-HYBHelperKit.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-HYBHelperKit.debug.xcconfig"; sourceTree = ""; }; A2A6FF208CEC4C2861F1E9D42D651453 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; A2F75C96947B2651F82FC18F66C43B49 /* Masonry-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Masonry-prefix.pch"; sourceTree = ""; }; A83EA4C93EC8C99D31AA72BA94C08894 /* Pods-HYBHelperKit.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-HYBHelperKit.release.xcconfig"; sourceTree = ""; }; A8FCF496D7716B2CF602747F4F360FD1 /* libPods-HYBHelperKit.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-HYBHelperKit.a"; sourceTree = BUILT_PRODUCTS_DIR; }; B179F4D3D34A3CE25A698B8D9AC9D6C2 /* NSArray+MASAdditions.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "NSArray+MASAdditions.h"; path = "Masonry/NSArray+MASAdditions.h"; sourceTree = ""; }; B48867DE203BCF3BB3DFCAB8FDC7516B /* MASLayoutConstraint.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MASLayoutConstraint.h; path = Masonry/MASLayoutConstraint.h; sourceTree = ""; }; C762C4F3A304C10AF7EBEA6AAA8508A0 /* NSLayoutConstraint+MASDebugAdditions.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "NSLayoutConstraint+MASDebugAdditions.m"; path = "Masonry/NSLayoutConstraint+MASDebugAdditions.m"; sourceTree = ""; }; C7C02266037F030E22468AC86802DB57 /* MASViewConstraint.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = MASViewConstraint.m; path = Masonry/MASViewConstraint.m; sourceTree = ""; }; CC90903A199CF2D32B201A52EB14C14C /* Pods-HYBHelperKit-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-HYBHelperKit-acknowledgements.plist"; sourceTree = ""; }; D218B968E2DCF5F23B48155930C8905D /* Pods-HYBHelperKit-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-HYBHelperKit-acknowledgements.markdown"; sourceTree = ""; }; D5EC6EDDDD3E503C5B2E967D3FEECFEB /* MASCompositeConstraint.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = MASCompositeConstraint.m; path = Masonry/MASCompositeConstraint.m; sourceTree = ""; }; E158FC65C5404E098F16E26F478DA504 /* NSLayoutConstraint+MASDebugAdditions.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "NSLayoutConstraint+MASDebugAdditions.h"; path = "Masonry/NSLayoutConstraint+MASDebugAdditions.h"; sourceTree = ""; }; E86668F20F252C440D1015B816BE59C5 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; }; EC0384F145CF471A951BA8E9486AD626 /* Masonry.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = Masonry.h; path = Masonry/Masonry.h; sourceTree = ""; }; EE1C220A5860721F1AAA1830A2A8EA0C /* Pods-HYBHelperKitTests-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-HYBHelperKitTests-dummy.m"; sourceTree = ""; }; F8AB44751192F0AA8DA5F75A06138D15 /* MASConstraintMaker.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = MASConstraintMaker.m; path = Masonry/MASConstraintMaker.m; sourceTree = ""; }; FA891F8E85C079B4FB101DDD5BC7A477 /* ViewController+MASAdditions.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "ViewController+MASAdditions.h"; path = "Masonry/ViewController+MASAdditions.h"; sourceTree = ""; }; FBE23E70FF64ACC81816A368E171B903 /* NSArray+MASShorthandAdditions.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "NSArray+MASShorthandAdditions.h"; path = "Masonry/NSArray+MASShorthandAdditions.h"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 053FE9E0000AE1D98A4C99091D08E612 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( C18632AD31935503078B89057E3E906A /* Foundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; FAB9E9D9BBDB93399D3C2B91469EC4B6 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( DE31B168D9197213CEB7B90E3ADEB4CC /* Foundation.framework in Frameworks */, AF4E7187E09A5AF3A0758991203153DC /* UIKit.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; FDFBAEB90756D26D0B783764468B9041 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 62DAADF0C9FB03DB4EF37E440795779D /* Foundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 3B9FAC5BAEA75CAB3E20372C4D27D7EE /* Masonry */ = { isa = PBXGroup; children = ( 475326F2A929CD1AFFB74850961F32C0 /* MASCompositeConstraint.h */, D5EC6EDDDD3E503C5B2E967D3FEECFEB /* MASCompositeConstraint.m */, 3162AC8E29FA7F3BF0D8641F7F4D9B60 /* MASConstraint.h */, 9F937BDEB8DF93A08D20C5355C0FDB5C /* MASConstraint.m */, 22E2395DA2EBCF6241A0DA0E1859FF45 /* MASConstraint+Private.h */, 780A86CEB0A0131C88BE12414D500734 /* MASConstraintMaker.h */, F8AB44751192F0AA8DA5F75A06138D15 /* MASConstraintMaker.m */, B48867DE203BCF3BB3DFCAB8FDC7516B /* MASLayoutConstraint.h */, 807FFD255E8235D5B42FE078299B5F1B /* MASLayoutConstraint.m */, EC0384F145CF471A951BA8E9486AD626 /* Masonry.h */, 1321572A3ED9C894C94A131BE29B81B2 /* MASUtilities.h */, 915A6FF0E04F5A5C0ACDE0E32BD2F193 /* MASViewAttribute.h */, 82F28AEAAF722BC62BF5B37D6663BBC2 /* MASViewAttribute.m */, 043FB94CF93050E20D8E4C071ACFA5D2 /* MASViewConstraint.h */, C7C02266037F030E22468AC86802DB57 /* MASViewConstraint.m */, B179F4D3D34A3CE25A698B8D9AC9D6C2 /* NSArray+MASAdditions.h */, 8229525E7067F22D3977D2628DF5F2C3 /* NSArray+MASAdditions.m */, FBE23E70FF64ACC81816A368E171B903 /* NSArray+MASShorthandAdditions.h */, E158FC65C5404E098F16E26F478DA504 /* NSLayoutConstraint+MASDebugAdditions.h */, C762C4F3A304C10AF7EBEA6AAA8508A0 /* NSLayoutConstraint+MASDebugAdditions.m */, 8E7E17DB5590A8C4D9625D67E6FBD243 /* View+MASAdditions.h */, 2FCC2A09AC3DCD0E4A3D268DAABC5135 /* View+MASAdditions.m */, 8A9F610CB90E57B81F8F7DCA2176E0FD /* View+MASShorthandAdditions.h */, FA891F8E85C079B4FB101DDD5BC7A477 /* ViewController+MASAdditions.h */, 25CED739CF35B6D0A1D95AE17D712A7F /* ViewController+MASAdditions.m */, 4854BD850DB1ADEB02DE483F0C44E016 /* Support Files */, ); path = Masonry; sourceTree = ""; }; 433CD3331B6C3787F473C941B61FC68F /* Frameworks */ = { isa = PBXGroup; children = ( F302CD3B306AF1ED96B9AF31FCDBC26C /* iOS */, ); name = Frameworks; sourceTree = ""; }; 4854BD850DB1ADEB02DE483F0C44E016 /* Support Files */ = { isa = PBXGroup; children = ( 7882AB8492CA4F59F730C76CC3BBF57A /* Masonry.xcconfig */, 7B5A231E76AF7DC6CB887B5B2C522A7A /* Masonry-dummy.m */, A2F75C96947B2651F82FC18F66C43B49 /* Masonry-prefix.pch */, ); name = "Support Files"; path = "../Target Support Files/Masonry"; sourceTree = ""; }; 7DB346D0F39D3F0E887471402A8071AB = { isa = PBXGroup; children = ( 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */, 433CD3331B6C3787F473C941B61FC68F /* Frameworks */, E9B49E9D4F6BC02AA78DCF86BCED2145 /* Pods */, C59B00811C92682826C8C23C941CA9F1 /* Products */, D12EEF303E7F7321F9CE81FE66787320 /* Targets Support Files */, ); sourceTree = ""; }; 82B54EAD4809430E72C9DBB7001AD0A0 /* Pods-HYBHelperKit */ = { isa = PBXGroup; children = ( D218B968E2DCF5F23B48155930C8905D /* Pods-HYBHelperKit-acknowledgements.markdown */, CC90903A199CF2D32B201A52EB14C14C /* Pods-HYBHelperKit-acknowledgements.plist */, 70FA6792CD93759BDF34C503FC36015A /* Pods-HYBHelperKit-dummy.m */, 2E4DF2D22770A60F9CCEC443AB877D93 /* Pods-HYBHelperKit-frameworks.sh */, 215515CAD9991A91DD3F9770980BC722 /* Pods-HYBHelperKit-resources.sh */, A01C92C418752C9213688B928FC8B390 /* Pods-HYBHelperKit.debug.xcconfig */, A83EA4C93EC8C99D31AA72BA94C08894 /* Pods-HYBHelperKit.release.xcconfig */, ); name = "Pods-HYBHelperKit"; path = "Target Support Files/Pods-HYBHelperKit"; sourceTree = ""; }; C59B00811C92682826C8C23C941CA9F1 /* Products */ = { isa = PBXGroup; children = ( 4FE404CFCFBDEF12F83661822F0E0F0B /* libMasonry.a */, A8FCF496D7716B2CF602747F4F360FD1 /* libPods-HYBHelperKit.a */, 1B39B777C639471DA1577E21933D04EA /* libPods-HYBHelperKitTests.a */, ); name = Products; sourceTree = ""; }; D12EEF303E7F7321F9CE81FE66787320 /* Targets Support Files */ = { isa = PBXGroup; children = ( 82B54EAD4809430E72C9DBB7001AD0A0 /* Pods-HYBHelperKit */, E9BBD8942980AF8A92E58AAA6B912AE9 /* Pods-HYBHelperKitTests */, ); name = "Targets Support Files"; sourceTree = ""; }; E9B49E9D4F6BC02AA78DCF86BCED2145 /* Pods */ = { isa = PBXGroup; children = ( 3B9FAC5BAEA75CAB3E20372C4D27D7EE /* Masonry */, ); name = Pods; sourceTree = ""; }; E9BBD8942980AF8A92E58AAA6B912AE9 /* Pods-HYBHelperKitTests */ = { isa = PBXGroup; children = ( 440C106000E67FB628FF5B14691C1757 /* Pods-HYBHelperKitTests-acknowledgements.markdown */, 4A3B844C12D52EA22748806384A329C6 /* Pods-HYBHelperKitTests-acknowledgements.plist */, EE1C220A5860721F1AAA1830A2A8EA0C /* Pods-HYBHelperKitTests-dummy.m */, 85F3055099D8EFE97A7FF054AA8E3042 /* Pods-HYBHelperKitTests-frameworks.sh */, 480E43D5D83BB182BC97D90FC9AE1262 /* Pods-HYBHelperKitTests-resources.sh */, 7036F598DB6570810910F466DF8CC974 /* Pods-HYBHelperKitTests.debug.xcconfig */, 5BAB376A6866A8C00AD546C8D96CECCF /* Pods-HYBHelperKitTests.release.xcconfig */, ); name = "Pods-HYBHelperKitTests"; path = "Target Support Files/Pods-HYBHelperKitTests"; sourceTree = ""; }; F302CD3B306AF1ED96B9AF31FCDBC26C /* iOS */ = { isa = PBXGroup; children = ( A2A6FF208CEC4C2861F1E9D42D651453 /* Foundation.framework */, E86668F20F252C440D1015B816BE59C5 /* UIKit.framework */, ); name = iOS; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ 657D857047A6A935B5A2E9BD049194F2 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( 99D8C610BC84BE231C5D3D280F3B12AF /* MASCompositeConstraint.h in Headers */, B2B7C90BA9C4DBD9851C75AC801B0E8E /* MASConstraint+Private.h in Headers */, 2905381350CEFFBFFA9BC8B5D027F190 /* MASConstraint.h in Headers */, EC6CCC98505D2067BC98B4E6223C9DF8 /* MASConstraintMaker.h in Headers */, C6EE194D232E9FE87097C0F1DF91B9FA /* MASLayoutConstraint.h in Headers */, 9205037BA8C22574B33FC96C5EA829A3 /* Masonry.h in Headers */, FF682E8B083BAEBBDF38C52D89D45E37 /* MASUtilities.h in Headers */, 3F63C119F95A6735AE627BBB1BEBC4B1 /* MASViewAttribute.h in Headers */, EB02AEF303313F801392DE8D90AFF0F7 /* MASViewConstraint.h in Headers */, FD39EBE3398E1A99965AC003B273450D /* NSArray+MASAdditions.h in Headers */, A7D31BD1F3AD4ED4612467FAD332F388 /* NSArray+MASShorthandAdditions.h in Headers */, 2979E54C4AFD27076576E82ADEED2F00 /* NSLayoutConstraint+MASDebugAdditions.h in Headers */, DD1F717B0527C71229B3339324E35E55 /* View+MASAdditions.h in Headers */, 432BD50F1E699EDF2EA007E850FFCEF7 /* View+MASShorthandAdditions.h in Headers */, 331718BFB4A91CFFE026492905231562 /* ViewController+MASAdditions.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ 373362DD77D24B0978CC424EB01059B6 /* Pods-HYBHelperKitTests */ = { isa = PBXNativeTarget; buildConfigurationList = 089524DD0B4B4754CB76450702B8782F /* Build configuration list for PBXNativeTarget "Pods-HYBHelperKitTests" */; buildPhases = ( 27865FCDF24F988B939B49D4739BF04E /* Sources */, FDFBAEB90756D26D0B783764468B9041 /* Frameworks */, ); buildRules = ( ); dependencies = ( ); name = "Pods-HYBHelperKitTests"; productName = "Pods-HYBHelperKitTests"; productReference = 1B39B777C639471DA1577E21933D04EA /* libPods-HYBHelperKitTests.a */; productType = "com.apple.product-type.library.static"; }; 53480ED0BE09FF49E34B1702D485CAAB /* Masonry */ = { isa = PBXNativeTarget; buildConfigurationList = B6653DB75D219E078020C341A7D83ECE /* Build configuration list for PBXNativeTarget "Masonry" */; buildPhases = ( DC8579C657135E3C32AB580A48C6D524 /* Sources */, FAB9E9D9BBDB93399D3C2B91469EC4B6 /* Frameworks */, 657D857047A6A935B5A2E9BD049194F2 /* Headers */, ); buildRules = ( ); dependencies = ( ); name = Masonry; productName = Masonry; productReference = 4FE404CFCFBDEF12F83661822F0E0F0B /* libMasonry.a */; productType = "com.apple.product-type.library.static"; }; BB18FB8095A8F42A27722DC4771C6CA5 /* Pods-HYBHelperKit */ = { isa = PBXNativeTarget; buildConfigurationList = 23D69CE8173CBAC32390ABFBCABB05F2 /* Build configuration list for PBXNativeTarget "Pods-HYBHelperKit" */; buildPhases = ( 45E0217408674B68E6292CE0AE3E73D7 /* Sources */, 053FE9E0000AE1D98A4C99091D08E612 /* Frameworks */, ); buildRules = ( ); dependencies = ( 48A09AE50CE58C8E7BA64B9A2CF8FE79 /* PBXTargetDependency */, ); name = "Pods-HYBHelperKit"; productName = "Pods-HYBHelperKit"; productReference = A8FCF496D7716B2CF602747F4F360FD1 /* libPods-HYBHelperKit.a */; productType = "com.apple.product-type.library.static"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ D41D8CD98F00B204E9800998ECF8427E /* Project object */ = { isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0730; LastUpgradeCheck = 0700; }; buildConfigurationList = 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, ); mainGroup = 7DB346D0F39D3F0E887471402A8071AB; productRefGroup = C59B00811C92682826C8C23C941CA9F1 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 53480ED0BE09FF49E34B1702D485CAAB /* Masonry */, BB18FB8095A8F42A27722DC4771C6CA5 /* Pods-HYBHelperKit */, 373362DD77D24B0978CC424EB01059B6 /* Pods-HYBHelperKitTests */, ); }; /* End PBXProject section */ /* Begin PBXSourcesBuildPhase section */ 27865FCDF24F988B939B49D4739BF04E /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( CAE1578107F1A837277105016305211C /* Pods-HYBHelperKitTests-dummy.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; 45E0217408674B68E6292CE0AE3E73D7 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 945EB2145BBD46F041D00A85AD7DA1DC /* Pods-HYBHelperKit-dummy.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; DC8579C657135E3C32AB580A48C6D524 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( BCD4B362C6194513150915437754E2D4 /* MASCompositeConstraint.m in Sources */, BE024118D329F8F566BD1811A1DC16CB /* MASConstraint.m in Sources */, 335DCBC17D2469F228020EF6C7B41F7C /* MASConstraintMaker.m in Sources */, BDD210D7537DD15CFE59AE126005E5F8 /* MASLayoutConstraint.m in Sources */, 81599471BAB0420D54E1ADF8507A5113 /* Masonry-dummy.m in Sources */, A44AF130E4C5313CD193D9BF68853026 /* MASViewAttribute.m in Sources */, E6B49FBCE3957DB67F691ACCC4CAF4BE /* MASViewConstraint.m in Sources */, 5457FCC2699281B5A4203BA1559F593F /* NSArray+MASAdditions.m in Sources */, D3D9F12613E23AD64C1FA5F7081A3668 /* NSLayoutConstraint+MASDebugAdditions.m in Sources */, 81403CAF6C4C1D3DC8B199289C3A6F59 /* View+MASAdditions.m in Sources */, AF62B956405F7734F5A9B8F3FD4B1B96 /* ViewController+MASAdditions.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ 48A09AE50CE58C8E7BA64B9A2CF8FE79 /* PBXTargetDependency */ = { isa = PBXTargetDependency; name = Masonry; target = 53480ED0BE09FF49E34B1702D485CAAB /* Masonry */; targetProxy = B27D35E3A05CDD0911272D11A48878BE /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ 19A184A7C43096D49C94C62E71F8DA40 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = A83EA4C93EC8C99D31AA72BA94C08894 /* Pods-HYBHelperKit.release.xcconfig */; buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_NO_COMMON_BLOCKS = YES; IPHONEOS_DEPLOYMENT_TARGET = 7.0; MACH_O_TYPE = staticlib; MTL_ENABLE_DEBUG_INFO = NO; OTHER_LDFLAGS = ""; OTHER_LIBTOOLFLAGS = ""; PODS_ROOT = "$(SRCROOT)"; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SKIP_INSTALL = YES; }; name = Release; }; 2B0EE25CA2DE71D139B21A7BD8FC3A8F /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = A01C92C418752C9213688B928FC8B390 /* Pods-HYBHelperKit.debug.xcconfig */; buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_NO_COMMON_BLOCKS = YES; IPHONEOS_DEPLOYMENT_TARGET = 7.0; MACH_O_TYPE = staticlib; MTL_ENABLE_DEBUG_INFO = YES; OTHER_LDFLAGS = ""; OTHER_LIBTOOLFLAGS = ""; PODS_ROOT = "$(SRCROOT)"; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SKIP_INSTALL = YES; }; name = Debug; }; 2DAE732D13CB652A1ECC83370B3C00E5 /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = 7882AB8492CA4F59F730C76CC3BBF57A /* Masonry.xcconfig */; buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_NO_COMMON_BLOCKS = YES; GCC_PREFIX_HEADER = "Target Support Files/Masonry/Masonry-prefix.pch"; IPHONEOS_DEPLOYMENT_TARGET = 6.0; MTL_ENABLE_DEBUG_INFO = YES; OTHER_LDFLAGS = ""; OTHER_LIBTOOLFLAGS = ""; PRIVATE_HEADERS_FOLDER_PATH = ""; PRODUCT_NAME = "$(TARGET_NAME)"; PUBLIC_HEADERS_FOLDER_PATH = ""; SDKROOT = iphoneos; SKIP_INSTALL = YES; }; name = Debug; }; 3FA2475660FFC880302AD18E29B2E5FC /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "POD_CONFIGURATION_DEBUG=1", "DEBUG=1", "$(inherited)", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 7.0; ONLY_ACTIVE_ARCH = YES; STRIP_INSTALLED_PRODUCT = NO; SYMROOT = "${SRCROOT}/../build"; }; name = Debug; }; 903FBF203C5658B140DF3CBEF5D2090D /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 7882AB8492CA4F59F730C76CC3BBF57A /* Masonry.xcconfig */; buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_NO_COMMON_BLOCKS = YES; GCC_PREFIX_HEADER = "Target Support Files/Masonry/Masonry-prefix.pch"; IPHONEOS_DEPLOYMENT_TARGET = 6.0; MTL_ENABLE_DEBUG_INFO = NO; OTHER_LDFLAGS = ""; OTHER_LIBTOOLFLAGS = ""; PRIVATE_HEADERS_FOLDER_PATH = ""; PRODUCT_NAME = "$(TARGET_NAME)"; PUBLIC_HEADERS_FOLDER_PATH = ""; SDKROOT = iphoneos; SKIP_INSTALL = YES; }; name = Release; }; F031387D8FD94B39747CD9C29A4A5D19 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 5BAB376A6866A8C00AD546C8D96CECCF /* Pods-HYBHelperKitTests.release.xcconfig */; buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_NO_COMMON_BLOCKS = YES; IPHONEOS_DEPLOYMENT_TARGET = 7.0; MACH_O_TYPE = staticlib; MTL_ENABLE_DEBUG_INFO = NO; OTHER_LDFLAGS = ""; OTHER_LIBTOOLFLAGS = ""; PODS_ROOT = "$(SRCROOT)"; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SKIP_INSTALL = YES; }; name = Release; }; F325026B55060D3B22BEC0BAB5FA7344 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = YES; ENABLE_NS_ASSERTIONS = NO; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_PREPROCESSOR_DEFINITIONS = ( "POD_CONFIGURATION_RELEASE=1", "$(inherited)", ); GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 7.0; STRIP_INSTALLED_PRODUCT = NO; SYMROOT = "${SRCROOT}/../build"; VALIDATE_PRODUCT = YES; }; name = Release; }; FB4AFE806C676F61B9DD865CF8F3A50F /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = 7036F598DB6570810910F466DF8CC974 /* Pods-HYBHelperKitTests.debug.xcconfig */; buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_NO_COMMON_BLOCKS = YES; IPHONEOS_DEPLOYMENT_TARGET = 7.0; MACH_O_TYPE = staticlib; MTL_ENABLE_DEBUG_INFO = YES; OTHER_LDFLAGS = ""; OTHER_LIBTOOLFLAGS = ""; PODS_ROOT = "$(SRCROOT)"; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SKIP_INSTALL = YES; }; name = Debug; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 089524DD0B4B4754CB76450702B8782F /* Build configuration list for PBXNativeTarget "Pods-HYBHelperKitTests" */ = { isa = XCConfigurationList; buildConfigurations = ( FB4AFE806C676F61B9DD865CF8F3A50F /* Debug */, F031387D8FD94B39747CD9C29A4A5D19 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 23D69CE8173CBAC32390ABFBCABB05F2 /* Build configuration list for PBXNativeTarget "Pods-HYBHelperKit" */ = { isa = XCConfigurationList; buildConfigurations = ( 2B0EE25CA2DE71D139B21A7BD8FC3A8F /* Debug */, 19A184A7C43096D49C94C62E71F8DA40 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */ = { isa = XCConfigurationList; buildConfigurations = ( 3FA2475660FFC880302AD18E29B2E5FC /* Debug */, F325026B55060D3B22BEC0BAB5FA7344 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; B6653DB75D219E078020C341A7D83ECE /* Build configuration list for PBXNativeTarget "Masonry" */ = { isa = XCConfigurationList; buildConfigurations = ( 2DAE732D13CB652A1ECC83370B3C00E5 /* Debug */, 903FBF203C5658B140DF3CBEF5D2090D /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = D41D8CD98F00B204E9800998ECF8427E /* Project object */; } ================================================ FILE: Pods/Pods.xcodeproj/xcuserdata/huangyibiao.xcuserdatad/xcschemes/Masonry.xcscheme ================================================ ================================================ FILE: Pods/Pods.xcodeproj/xcuserdata/huangyibiao.xcuserdatad/xcschemes/Pods-HYBHelperKit.xcscheme ================================================ ================================================ FILE: Pods/Pods.xcodeproj/xcuserdata/huangyibiao.xcuserdatad/xcschemes/Pods-HYBHelperKitTests.xcscheme ================================================ ================================================ FILE: Pods/Pods.xcodeproj/xcuserdata/huangyibiao.xcuserdatad/xcschemes/xcschememanagement.plist ================================================ SchemeUserState Masonry.xcscheme isShown Pods-HYBHelperKit.xcscheme isShown Pods-HYBHelperKitTests.xcscheme isShown SuppressBuildableAutocreation 373362DD77D24B0978CC424EB01059B6 primary 53480ED0BE09FF49E34B1702D485CAAB primary BB18FB8095A8F42A27722DC4771C6CA5 primary ================================================ FILE: Pods/Target Support Files/Masonry/Masonry-dummy.m ================================================ #import @interface PodsDummy_Masonry : NSObject @end @implementation PodsDummy_Masonry @end ================================================ FILE: Pods/Target Support Files/Masonry/Masonry-prefix.pch ================================================ #ifdef __OBJC__ #import #endif ================================================ FILE: Pods/Target Support Files/Masonry/Masonry.xcconfig ================================================ CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/Masonry GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/Masonry" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Masonry" OTHER_LDFLAGS = -framework "Foundation" -framework "UIKit" PODS_BUILD_DIR = $BUILD_DIR PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) PODS_ROOT = ${SRCROOT} PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} SKIP_INSTALL = YES ================================================ FILE: Pods/Target Support Files/Pods-HYBHelperKit/Pods-HYBHelperKit-acknowledgements.markdown ================================================ # Acknowledgements This application makes use of the following third party libraries: ## Masonry Copyright (c) 2011-2012 Masonry Team - https://github.com/Masonry Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Generated by CocoaPods - https://cocoapods.org ================================================ FILE: Pods/Target Support Files/Pods-HYBHelperKit/Pods-HYBHelperKit-acknowledgements.plist ================================================ PreferenceSpecifiers FooterText This application makes use of the following third party libraries: Title Acknowledgements Type PSGroupSpecifier FooterText Copyright (c) 2011-2012 Masonry Team - https://github.com/Masonry Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Title Masonry Type PSGroupSpecifier FooterText Generated by CocoaPods - https://cocoapods.org Title Type PSGroupSpecifier StringsTable Acknowledgements Title Acknowledgements ================================================ FILE: Pods/Target Support Files/Pods-HYBHelperKit/Pods-HYBHelperKit-dummy.m ================================================ #import @interface PodsDummy_Pods_HYBHelperKit : NSObject @end @implementation PodsDummy_Pods_HYBHelperKit @end ================================================ FILE: Pods/Target Support Files/Pods-HYBHelperKit/Pods-HYBHelperKit-frameworks.sh ================================================ #!/bin/sh set -e echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" install_framework() { if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then local source="${BUILT_PRODUCTS_DIR}/$1" elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" elif [ -r "$1" ]; then local source="$1" fi local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" if [ -L "${source}" ]; then echo "Symlinked..." source="$(readlink "${source}")" fi # use filter instead of exclude so missing patterns dont' throw errors echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" local basename basename="$(basename -s .framework "$1")" binary="${destination}/${basename}.framework/${basename}" if ! [ -r "$binary" ]; then binary="${destination}/${basename}" fi # Strip invalid architectures so "fat" simulator / device frameworks work on device if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then strip_invalid_archs "$binary" fi # Resign the code if required by the build settings to avoid unstable apps code_sign_if_enabled "${destination}/$(basename "$1")" # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then local swift_runtime_libs swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) for lib in $swift_runtime_libs; do echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" code_sign_if_enabled "${destination}/${lib}" done fi } # Signs a framework with the provided identity code_sign_if_enabled() { if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then # Use the current code_sign_identitiy echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements \"$1\"" /usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements "$1" fi } # Strip invalid architectures strip_invalid_archs() { binary="$1" # Get architectures for current file archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)" stripped="" for arch in $archs; do if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then # Strip non-valid architectures in-place lipo -remove "$arch" -output "$binary" "$binary" || exit 1 stripped="$stripped $arch" fi done if [[ "$stripped" ]]; then echo "Stripped $binary of architectures:$stripped" fi } ================================================ FILE: Pods/Target Support Files/Pods-HYBHelperKit/Pods-HYBHelperKit-resources.sh ================================================ #!/bin/sh set -e mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt > "$RESOURCES_TO_COPY" XCASSET_FILES=() case "${TARGETED_DEVICE_FAMILY}" in 1,2) TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" ;; 1) TARGET_DEVICE_ARGS="--target-device iphone" ;; 2) TARGET_DEVICE_ARGS="--target-device ipad" ;; *) TARGET_DEVICE_ARGS="--target-device mac" ;; esac realpath() { DIRECTORY="$(cd "${1%/*}" && pwd)" FILENAME="${1##*/}" echo "$DIRECTORY/$FILENAME" } install_resource() { if [[ "$1" = /* ]] ; then RESOURCE_PATH="$1" else RESOURCE_PATH="${PODS_ROOT}/$1" fi if [[ ! -e "$RESOURCE_PATH" ]] ; then cat << EOM error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script. EOM exit 1 fi case $RESOURCE_PATH in *.storyboard) echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} ;; *.xib) echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT}" ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ;; *.framework) echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" echo "rsync -av $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" rsync -av "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" ;; *.xcdatamodel) echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom" ;; *.xcdatamodeld) echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd" ;; *.xcmappingmodel) echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" ;; *.xcassets) ABSOLUTE_XCASSET_FILE=$(realpath "$RESOURCE_PATH") XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") ;; *) echo "$RESOURCE_PATH" echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY" ;; esac } mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" fi rm -f "$RESOURCES_TO_COPY" if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] then # Find all other xcassets (this unfortunately includes those of path pods and other targets). OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) while read line; do if [[ $line != "`realpath $PODS_ROOT`*" ]]; then XCASSET_FILES+=("$line") fi done <<<"$OTHER_XCASSETS" printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" fi ================================================ FILE: Pods/Target Support Files/Pods-HYBHelperKit/Pods-HYBHelperKit.debug.xcconfig ================================================ GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Masonry" LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/Masonry" OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/Masonry" OTHER_LDFLAGS = $(inherited) -ObjC -l"Masonry" -framework "Foundation" -framework "UIKit" PODS_BUILD_DIR = $BUILD_DIR PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) PODS_ROOT = ${SRCROOT}/Pods ================================================ FILE: Pods/Target Support Files/Pods-HYBHelperKit/Pods-HYBHelperKit.release.xcconfig ================================================ GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Masonry" LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/Masonry" OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/Masonry" OTHER_LDFLAGS = $(inherited) -ObjC -l"Masonry" -framework "Foundation" -framework "UIKit" PODS_BUILD_DIR = $BUILD_DIR PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) PODS_ROOT = ${SRCROOT}/Pods ================================================ FILE: Pods/Target Support Files/Pods-HYBHelperKitTests/Pods-HYBHelperKitTests-acknowledgements.markdown ================================================ # Acknowledgements This application makes use of the following third party libraries: Generated by CocoaPods - https://cocoapods.org ================================================ FILE: Pods/Target Support Files/Pods-HYBHelperKitTests/Pods-HYBHelperKitTests-acknowledgements.plist ================================================ PreferenceSpecifiers FooterText This application makes use of the following third party libraries: Title Acknowledgements Type PSGroupSpecifier FooterText Generated by CocoaPods - https://cocoapods.org Title Type PSGroupSpecifier StringsTable Acknowledgements Title Acknowledgements ================================================ FILE: Pods/Target Support Files/Pods-HYBHelperKitTests/Pods-HYBHelperKitTests-dummy.m ================================================ #import @interface PodsDummy_Pods_HYBHelperKitTests : NSObject @end @implementation PodsDummy_Pods_HYBHelperKitTests @end ================================================ FILE: Pods/Target Support Files/Pods-HYBHelperKitTests/Pods-HYBHelperKitTests-frameworks.sh ================================================ #!/bin/sh set -e echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" install_framework() { if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then local source="${BUILT_PRODUCTS_DIR}/$1" elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" elif [ -r "$1" ]; then local source="$1" fi local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" if [ -L "${source}" ]; then echo "Symlinked..." source="$(readlink "${source}")" fi # use filter instead of exclude so missing patterns dont' throw errors echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" local basename basename="$(basename -s .framework "$1")" binary="${destination}/${basename}.framework/${basename}" if ! [ -r "$binary" ]; then binary="${destination}/${basename}" fi # Strip invalid architectures so "fat" simulator / device frameworks work on device if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then strip_invalid_archs "$binary" fi # Resign the code if required by the build settings to avoid unstable apps code_sign_if_enabled "${destination}/$(basename "$1")" # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then local swift_runtime_libs swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) for lib in $swift_runtime_libs; do echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" code_sign_if_enabled "${destination}/${lib}" done fi } # Signs a framework with the provided identity code_sign_if_enabled() { if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then # Use the current code_sign_identitiy echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements \"$1\"" /usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements "$1" fi } # Strip invalid architectures strip_invalid_archs() { binary="$1" # Get architectures for current file archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)" stripped="" for arch in $archs; do if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then # Strip non-valid architectures in-place lipo -remove "$arch" -output "$binary" "$binary" || exit 1 stripped="$stripped $arch" fi done if [[ "$stripped" ]]; then echo "Stripped $binary of architectures:$stripped" fi } ================================================ FILE: Pods/Target Support Files/Pods-HYBHelperKitTests/Pods-HYBHelperKitTests-resources.sh ================================================ #!/bin/sh set -e mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt > "$RESOURCES_TO_COPY" XCASSET_FILES=() case "${TARGETED_DEVICE_FAMILY}" in 1,2) TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" ;; 1) TARGET_DEVICE_ARGS="--target-device iphone" ;; 2) TARGET_DEVICE_ARGS="--target-device ipad" ;; *) TARGET_DEVICE_ARGS="--target-device mac" ;; esac realpath() { DIRECTORY="$(cd "${1%/*}" && pwd)" FILENAME="${1##*/}" echo "$DIRECTORY/$FILENAME" } install_resource() { if [[ "$1" = /* ]] ; then RESOURCE_PATH="$1" else RESOURCE_PATH="${PODS_ROOT}/$1" fi if [[ ! -e "$RESOURCE_PATH" ]] ; then cat << EOM error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script. EOM exit 1 fi case $RESOURCE_PATH in *.storyboard) echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} ;; *.xib) echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT}" ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ;; *.framework) echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" echo "rsync -av $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" rsync -av "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" ;; *.xcdatamodel) echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom" ;; *.xcdatamodeld) echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd" ;; *.xcmappingmodel) echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" ;; *.xcassets) ABSOLUTE_XCASSET_FILE=$(realpath "$RESOURCE_PATH") XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") ;; *) echo "$RESOURCE_PATH" echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY" ;; esac } mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" fi rm -f "$RESOURCES_TO_COPY" if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] then # Find all other xcassets (this unfortunately includes those of path pods and other targets). OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) while read line; do if [[ $line != "`realpath $PODS_ROOT`*" ]]; then XCASSET_FILES+=("$line") fi done <<<"$OTHER_XCASSETS" printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" fi ================================================ FILE: Pods/Target Support Files/Pods-HYBHelperKitTests/Pods-HYBHelperKitTests.debug.xcconfig ================================================ GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Masonry" OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/Masonry" OTHER_LDFLAGS = $(inherited) -ObjC PODS_BUILD_DIR = $BUILD_DIR PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) PODS_ROOT = ${SRCROOT}/Pods ================================================ FILE: Pods/Target Support Files/Pods-HYBHelperKitTests/Pods-HYBHelperKitTests.release.xcconfig ================================================ GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Masonry" OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/Masonry" OTHER_LDFLAGS = $(inherited) -ObjC PODS_BUILD_DIR = $BUILD_DIR PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) PODS_ROOT = ${SRCROOT}/Pods ================================================ FILE: README.md ================================================ # HYBHelperKit [![Build Status](https://travis-ci.org/CoderJackyHuang/HYBHelperKit.svg?branch=master)](https://travis-ci.org/CoderJackyHuang/HYBHelperKit) [![CocoaPods](https://img.shields.io/cocoapods/v/HYBHelperKit.svg?maxAge=2592000?style=flat-square)](https://cocoapods.org/?q=HYBHelperKit) 日常开发必不可少的神器之一,UIBlockKit、UIMakerKit、UIKit、CommonKit、FoundationKit、Controllers、Constants等集于一身的神器! 目前具备的功能: * 通用的宏定义、blcok定义等,详细请阅读HYBCommonKit.h * 对常用的UI控件再次简化调用,配合Masonry自动布局,及block版本的事件响应回调,一句代码搞定! * 对常用的Foundation库中的类添加分类,以减少崩溃的概率 * 对常用的控制器类的通用功能集成到基类中,如通知监听及释放、导航条配置、测试入口类、base url列表选择入口等 * 对常用的控件封装成block版本 #目录划分 * CommonKit:将常用的宏和短代码简化成宏或者block定义 * UIBlockKit:将常用的UI控件变成block版本,以辅助UIMasonryMaker生成最简单的版本 * FoundationKit:主要扩展日常使用到的基础类,添加分类,追加常用的API * UIMasonryKit:基于Masonry生成控件,以简化代码,增加可读性 * Constants:经常使用到的常量定义 * UIKit:常用的UI控件分类,以简化开发 * Controllers:辅助控制器,比如用于测试期使用的接口baseurl访问和建立测试中心入口,基类控制器等 #单元测试 对于FoundationKit是经过单元测试的!对于UI组件,并没有进行单元测试,不过已在某项目中使用,目前未出现问题。 #使用 ``` pod 'HYBHelperKit' ``` #API风格 * 所有扩展公开API及属性都有hyb_前缀 * 部分类公开API及属性也有hyb_前缀 * 所有API都有详细的注释 #基础使用 ``` // 非系统返回按钮 kWeakObject(self); [self hyb_setNavLeftButtonTitle:@"Back" onCliked:^(UIButton *sender) { [weakObject.navigationController popViewControllerAnimated:YES]; }]; [self.hyb_leftButtonItem setTitleColor:kBlueColor forState:UIControlStateNormal]; // 一行搞定导航条 [self hyb_setNavTitle:@"Test1" rightTitles:@[@"btton1", @"button2"] rightBlock:^(NSUInteger index, UIButton *sender) { NSLog(@"clicked at index: %ld", index); }]; [self.hyb_rightButtonItems enumerateObjectsUsingBlock:^(UIButton * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { [obj setTitleColor:kPurpleColor forState:UIControlStateNormal]; }]; ``` ##创建tableview 提供了多种API,这只是其中一种: ``` self.tableView = [UITableView hyb_tableViewWithSuperview:self.view delegate:self constraints:^(MASConstraintMaker *make) { make.left.right.bottom.mas_equalTo(0); make.top.mas_equalTo(self.customNavView.mas_bottom); }]; ``` ##创建按钮 ``` UIButton *enterButton = [UIButton hyb_buttonWithTitle:@"立即进入" superView:itemView1 constraints:^(MASConstraintMaker *make) { make.right.mas_equalTo(-10); make.height.mas_equalTo(25); make.centerY.mas_equalTo(itemView1); make.width.mas_equalTo(80); } touchUp:^(UIButton *sender) { }]; ``` 更多还是查看源代码吧! #声明 本开源项目会持续维护,如果有bug或者觉得可以抽一个轮子的,请拉一个issue或者pull request过来!如果想到博客中阅读,欢迎访问[http://www.huangyibiao.com/ios-hybhelperkit/](http://www.huangyibiao.com/ios-hybhelperkit/) #History Versions * V0.1.0 - Fix bugs - Add NSDate common APIs in FoundationKit. * V0.1.1 - Fix bugs - Upload pod to support * V0.2.0 - Add UIKit categories, as UIAlertView, UIActionSheet. - Fix hyb_trimLeft crash bug when not enough length string. - Fix hyb_leftMarginOfCursor using _cmd will get nil because of getter and setter _cmd is not the same. #LICENSE MIT ================================================ FILE: codecov.yml ================================================ coverage: ignore: - HYBHelperKitTests/* - Pods/* status: patch: false