├── .gitignore ├── Example ├── Podfile ├── Podfile.lock ├── Tests │ ├── Tests-Info.plist │ ├── Tests-Prefix.pch │ ├── Tests.m │ └── en.lproj │ │ └── InfoPlist.strings ├── XYQuick.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcshareddata │ │ └── xcschemes │ │ └── XYQuick-Example.xcscheme ├── XYQuick.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── XYQuick │ ├── Controller │ ├── AnimationVC2.h │ ├── AnimationVC2.m │ ├── BlackMagicVC.h │ ├── BlackMagicVC.m │ ├── DatabaseVC.h │ ├── DatabaseVC.m │ ├── DemoTableViewController.h │ ├── DemoTableViewController.m │ ├── DemoViewController.h │ ├── DemoViewController.m │ ├── ImageVC.h │ ├── ImageVC.m │ ├── JSONVC.h │ ├── JSONVC.m │ ├── KeyboardVC.h │ ├── KeyboardVC.m │ ├── SignalVC.h │ ├── SignalVC.m │ ├── TestVC.h │ ├── TestVC.m │ ├── TestVC2.h │ ├── TestVC2.m │ ├── UISignalVC.h │ ├── UISignalVC.m │ └── ViewControllerDemo.h │ ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ └── Contents.json │ ├── Laboratory │ ├── IndicatorHelper.h │ ├── IndicatorHelper.m │ ├── LKDBHelperExtension.h │ ├── LKDBHelperExtension.m │ ├── XYAppController.h │ ├── XYAppController.m │ ├── XYAppModuleProtocol.h │ ├── XYApplicationWorkspace.h │ ├── XYApplicationWorkspace.m │ ├── XYBaseDao.h │ ├── XYBaseDao.m │ ├── XYBaseDataSource.h │ ├── XYBaseDataSource.m │ ├── XYBaseModel.h │ ├── XYBaseModel.m │ ├── XYBaseView.h │ ├── XYBaseView.m │ ├── XYChainMethod.h │ ├── XYClassLoader.h │ ├── XYClassLoader.m │ ├── XYEvent.h │ ├── XYEvent.m │ ├── XYMaterial.h │ ├── XYMaterial.m │ ├── XYMenuItem.h │ ├── XYObjectCache.h │ ├── XYObjectCache.m │ ├── XYRepository.h │ ├── XYRepository.m │ ├── XYServiceBase.h │ ├── XYServiceBase.m │ ├── XYUISignal.h │ ├── XYUISignal.m │ └── module │ │ ├── XYInterfaceManager.h │ │ ├── XYInterfaceManager.m │ │ ├── XYModuleLifecycle.h │ │ ├── XYModuleLifecycle.m │ │ ├── XYModuleManager.h │ │ ├── XYModuleManager.m │ │ ├── XYWidget.h │ │ └── XYWidget.m │ ├── Main.storyboard │ ├── Model │ ├── AopTestM.h │ ├── AopTestM.m │ ├── Associated.h │ ├── Associated.m │ ├── AutoCodingEntity.h │ ├── AutoCodingEntity.m │ ├── CarEntity.h │ ├── CarEntity.m │ ├── ConfigManager.h │ ├── ConfigManager.m │ ├── EntityBaseModel.h │ ├── EntityBaseModel.m │ ├── GirlEntity.h │ ├── GirlEntity.m │ ├── JsonTestEntity.h │ ├── JsonTestEntity.m │ ├── LKTestModels.h │ ├── LKTestModels.m │ ├── RubyChinaNodeEntity.h │ ├── RubyChinaNodeEntity.m │ ├── Test1Model.h │ ├── Test1Model.m │ ├── Test2Model.h │ └── Test2Model.m │ ├── Modules │ ├── ModuleA.h │ └── ModuleA.m │ ├── Resource │ ├── bg.jpg │ ├── bg_trends.png │ ├── default_TestDic.plist │ ├── headportrait.jpg │ ├── icon_facebook.png │ ├── icon_google.png │ ├── icon_tencent.png │ ├── icon_twitter.png │ ├── image.png │ ├── json0.json │ ├── json1.json │ ├── json2.json │ ├── json2_2.json │ ├── json3.json │ ├── json4.json │ ├── json5.json │ ├── json6.json │ ├── json7.json │ └── user_currentstandings.png │ ├── Test │ ├── Test_NSNull.m │ ├── Test_XYCache.m │ ├── Test_XYJSON.m │ ├── Test_XYSandbox.m │ ├── Test_XYSystem.m │ └── Test_XYThead.m │ ├── View │ ├── PaintCodeView.h │ ├── PaintCodeView.m │ ├── Test2View.h │ ├── Test2View.m │ ├── TestView.h │ └── TestView.m │ ├── XYAppDelegate.h │ ├── XYAppDelegate.m │ ├── XYQuick-Info.plist │ ├── XYQuick-Prefix.pch │ ├── XYViewController.h │ ├── XYViewController.m │ ├── en.lproj │ └── InfoPlist.strings │ └── main.m ├── LICENSE ├── Pod ├── Assets │ └── .gitkeep └── Classes │ ├── .gitkeep │ ├── XYQuick.h │ ├── XYQuick.m │ ├── core │ ├── XYQuick_Core.h │ ├── extension │ │ ├── NSArray+XY.h │ │ ├── NSArray+XY.m │ │ ├── NSData+XY.h │ │ ├── NSData+XY.m │ │ ├── NSDate+XY.h │ │ ├── NSDate+XY.m │ │ ├── NSDictionary+XY.h │ │ ├── NSDictionary+XY.m │ │ ├── NSNull+XY.h │ │ ├── NSNull+XY.m │ │ ├── NSNumber+XY.h │ │ ├── NSNumber+XY.m │ │ ├── NSObject+XY.h │ │ ├── NSObject+XY.m │ │ ├── NSSet+XY.h │ │ ├── NSSet+XY.m │ │ ├── NSString+XY.h │ │ └── NSString+XY.m │ └── modules │ │ ├── XYAOP.h │ │ ├── XYAOP.m │ │ ├── XYBaseBuilder.h │ │ ├── XYBaseBuilder.m │ │ ├── XYBlackMagic.h │ │ ├── XYBlackMagic.m │ │ ├── XYCommon.h │ │ ├── XYCommon.m │ │ ├── XYCommonDefine.h │ │ ├── XYJSON.h │ │ ├── XYJSON.m │ │ ├── XYReachability.h │ │ ├── XYReachability.m │ │ ├── XYRuntime.h │ │ ├── XYRuntime.m │ │ ├── XYSandbox.h │ │ ├── XYSandbox.m │ │ ├── XYSystemInfo.h │ │ ├── XYSystemInfo.m │ │ ├── XYThread.h │ │ ├── XYThread.m │ │ ├── XYTimer.h │ │ ├── XYTimer.m │ │ ├── cache │ │ ├── XYAutoCoding.h │ │ ├── XYAutoCoding.m │ │ ├── XYCacheProtocol.h │ │ ├── XYFileCache.h │ │ ├── XYFileCache.m │ │ ├── XYMemoryCache.h │ │ ├── XYMemoryCache.m │ │ ├── XYQuick_Cache.h │ │ ├── XYUserDefaults.h │ │ └── XYUserDefaults.m │ │ └── debug │ │ ├── XYDebugToy.h │ │ ├── XYDebugToy.m │ │ ├── XYPerformance.h │ │ ├── XYPerformance.m │ │ ├── XYQuick_Debug.h │ │ ├── XYUnitTest.h │ │ └── XYUnitTest.m │ ├── event │ ├── XYQuick_Event.h │ └── modules │ │ ├── XYFlyweightTransmit.h │ │ ├── XYFlyweightTransmit.m │ │ ├── XYKVO.h │ │ ├── XYKVO.m │ │ ├── XYMulticastDelegate.h │ │ ├── XYMulticastDelegate.m │ │ ├── XYNotification.h │ │ ├── XYNotification.m │ │ ├── XYSignal.h │ │ └── XYSignal.m │ ├── predefine │ ├── XYMetamacros.h │ ├── XYQuick_Predefine.h │ └── XYQuick_Predefine.m │ └── ui │ ├── XYQuick_UI.h │ ├── extension │ ├── UIActionSheet+XY.h │ ├── UIActionSheet+XY.m │ ├── UIAlertView+XY.h │ ├── UIAlertView+XY.m │ ├── UIButton+XY.h │ ├── UIButton+XY.m │ ├── UIColor+XY.h │ ├── UIColor+XY.m │ ├── UIControl+XY.h │ ├── UIControl+XY.m │ ├── UIImage+XY.h │ ├── UIImage+XY.m │ ├── UILabel+XY.h │ ├── UILabel+XY.m │ ├── UINavigationBar+XY.h │ ├── UINavigationBar+XY.m │ ├── UITable+XY.h │ ├── UITable+XY.m │ ├── UIView+XY.h │ ├── UIView+XY.m │ ├── UIViewController+XY.h │ ├── UIViewController+XY.m │ ├── UIWebView+XY.h │ ├── UIWebView+XY.m │ ├── UIWindow+XY.h │ └── UIWindow+XY.m │ └── modules │ ├── XYAnimate.h │ ├── XYAnimate.m │ ├── XYBaseViewController.h │ ├── XYBaseViewController.m │ ├── XYHUDProtocol.h │ ├── XYKeyboardHelper.h │ ├── XYKeyboardHelper.m │ ├── XYTabBar.h │ ├── XYTabBar.m │ ├── XYTabBarController.h │ ├── XYTabBarController.m │ ├── XYUIDefine.h │ ├── XYViewControllerManager.h │ ├── XYViewControllerManager.m │ ├── XYViewLayout.h │ └── XYViewLayout.m ├── README.md ├── XYQuick.podspec └── _Pods.xcodeproj /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | build/ 4 | .DS_Store 5 | *.pbxuser 6 | !default.pbxuser 7 | *.mode1v3 8 | !default.mode1v3 9 | *.mode2v3 10 | !default.mode2v3 11 | *.perspectivev3 12 | !default.perspectivev3 13 | xcuserdata 14 | *.xccheckout 15 | *.moved-aside 16 | DerivedData 17 | *.hmap 18 | *.ipa 19 | *.xcuserstate 20 | 21 | # CocoaPods 22 | # 23 | # We recommend against adding the Pods directory to your .gitignore. However 24 | # you should judge for yourself, the pros and cons are mentioned at: 25 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 26 | # 27 | Pods 28 | -------------------------------------------------------------------------------- /Example/Podfile: -------------------------------------------------------------------------------- 1 | def shared_pods 2 | # 状态指示器 3 | pod 'MBProgressHUD', '~> 0.9.1' 4 | 5 | # udid 6 | pod 'OpenUDID', '~> 1.0.0' 7 | 8 | # 网络请求库 9 | # pod 'MKNetworkKit', '~> 0.87' 10 | 11 | # 数据库ORM 12 | pod 'LKDBHelper', '~> 2.2' 13 | 14 | # 数据库 15 | pod 'FMDB', '~> 2.6.2' 16 | 17 | # 下拉刷新 上拉加载 18 | pod 'SVPullToRefresh', '~> 0.4.1' 19 | end 20 | 21 | 22 | use_frameworks! 23 | 24 | target 'XYQuick_Example' do 25 | shared_pods 26 | pod 'XYQuick', :path => '../' 27 | end 28 | 29 | target 'XYQuick_Tests' do 30 | # shared_pods 31 | pod 'XYQuick', :path => '../' 32 | end 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /Example/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - FMDB (2.6.2): 3 | - FMDB/standard (= 2.6.2) 4 | - FMDB/standard (2.6.2) 5 | - LKDBHelper (2.4.1): 6 | - FMDB 7 | - MBProgressHUD (0.9.2) 8 | - OpenUDID (1.0.0) 9 | - SVPullToRefresh (0.4.1) 10 | - XYQuick (0.9.10): 11 | - XYQuick/core (= 0.9.10) 12 | - XYQuick/event (= 0.9.10) 13 | - XYQuick/predefine (= 0.9.10) 14 | - XYQuick/ui (= 0.9.10) 15 | - XYQuick/core (0.9.10): 16 | - XYQuick/predefine 17 | - XYQuick/event (0.9.10): 18 | - XYQuick/core 19 | - XYQuick/predefine 20 | - XYQuick/ui 21 | - XYQuick/predefine (0.9.10) 22 | - XYQuick/ui (0.9.10): 23 | - XYQuick/core 24 | - XYQuick/predefine 25 | 26 | DEPENDENCIES: 27 | - FMDB (~> 2.6.2) 28 | - LKDBHelper (~> 2.2) 29 | - MBProgressHUD (~> 0.9.1) 30 | - OpenUDID (~> 1.0.0) 31 | - SVPullToRefresh (~> 0.4.1) 32 | - XYQuick (from `../`) 33 | 34 | SPEC REPOS: 35 | https://github.com/cocoapods/specs.git: 36 | - FMDB 37 | - LKDBHelper 38 | - MBProgressHUD 39 | - OpenUDID 40 | - SVPullToRefresh 41 | 42 | EXTERNAL SOURCES: 43 | XYQuick: 44 | :path: "../" 45 | 46 | SPEC CHECKSUMS: 47 | FMDB: 854a0341b4726e53276f2a8996f06f1b80f9259a 48 | LKDBHelper: 531581fa6a7d0f14236cc028ce0d277bca73436a 49 | MBProgressHUD: 1569cf7ace17a8bac47aabfbb8580a49690386d1 50 | OpenUDID: e7cb6984c7304906ad20f3a36bf087b025896b6b 51 | SVPullToRefresh: ba2e718695a43253d8bea6852d2960097dc15d8c 52 | XYQuick: e9fd4e6817751152c70f6d583570bad581d0b599 53 | 54 | PODFILE CHECKSUM: 5518f4a8dd6c0abfaba903c40904f213872cef14 55 | 56 | COCOAPODS: 1.5.3 57 | -------------------------------------------------------------------------------- /Example/Tests/Tests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Example/Tests/Tests-Prefix.pch: -------------------------------------------------------------------------------- 1 | // The contents of this file are implicitly included at the beginning of every test case source file. 2 | 3 | #ifdef __OBJC__ 4 | 5 | @import FBSnapshotTestCase; 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /Example/Tests/Tests.m: -------------------------------------------------------------------------------- 1 | // 2 | // XYQuickTests.m 3 | // XYQuickTests 4 | // 5 | // Created by uxyheaven on 04/22/2016. 6 | // Copyright (c) 2016 uxyheaven. All rights reserved. 7 | // 8 | 9 | @import XCTest; 10 | 11 | @interface Tests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation Tests 16 | 17 | - (void)setUp 18 | { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown 24 | { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample 30 | { 31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 32 | } 33 | 34 | @end 35 | 36 | -------------------------------------------------------------------------------- /Example/Tests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Example/XYQuick.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/XYQuick.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Example/XYQuick.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Example/XYQuick/Controller/AnimationVC2.h: -------------------------------------------------------------------------------- 1 | // 2 | // AnimationVC2.h 3 | // JoinShow 4 | // 5 | // Created by Heaven on 13-11-19. 6 | // Copyright (c) 2013年 Heaven. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "ViewControllerDemo.h" 11 | 12 | @interface AnimationVC2 : UIViewController 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /Example/XYQuick/Controller/BlackMagicVC.h: -------------------------------------------------------------------------------- 1 | // 2 | // BlackMagicVC.h 3 | // JoinShow 4 | // 5 | // Created by Heaven on 14/11/14. 6 | // Copyright (c) 2014年 Heaven. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "ViewControllerDemo.h" 11 | 12 | @interface BlackMagicVC : UITableViewController 13 | 14 | @property (nonatomic, strong) NSArray *items; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Example/XYQuick/Controller/BlackMagicVC.m: -------------------------------------------------------------------------------- 1 | // 2 | // BlackMagicVC.m 3 | // JoinShow 4 | // 5 | // Created by Heaven on 14/11/14. 6 | // Copyright (c) 2014年 Heaven. All rights reserved. 7 | // 8 | 9 | #import "BlackMagicVC.h" 10 | #import "XYQuick.h" 11 | 12 | @interface BlackMagicVC () 13 | 14 | @end 15 | 16 | @implementation BlackMagicVC 17 | 18 | ViewControllerDemoTitle(BlackMagic) 19 | 20 | - (void)viewDidLoad { 21 | [super viewDidLoad]; 22 | 23 | // Uncomment the following line to preserve selection between presentations. 24 | // self.clearsSelectionOnViewWillAppear = NO; 25 | 26 | // Uncomment the following line to display an Edit button in the navigation bar for this view controller. 27 | // self.navigationItem.rightBarButtonItem = self.editButtonItem; 28 | 29 | self.items = @[ 30 | @{@"title":@"onFuncExit", @"sel" : @"clickOnFuncExit"} 31 | ]; 32 | 33 | [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"test_cell"]; 34 | } 35 | 36 | - (void)didReceiveMemoryWarning { 37 | [super didReceiveMemoryWarning]; 38 | // Dispose of any resources that can be recreated. 39 | } 40 | 41 | #pragma mark - Table view data source 42 | 43 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 44 | { 45 | // Return the number of sections. 46 | return 1; 47 | } 48 | 49 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 50 | { 51 | // Return the number of rows in the section. 52 | return self.items.count; 53 | } 54 | 55 | 56 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 57 | { 58 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"test_cell" forIndexPath:indexPath]; 59 | 60 | // Configure the cell... 61 | NSDictionary *dic = self.items[indexPath.row]; 62 | cell.textLabel.text = dic[@"title"]; 63 | 64 | return cell; 65 | } 66 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ 67 | NSDictionary *dic = self.items[indexPath.row]; 68 | NSString *str = dic[@"sel"]; 69 | SEL sel = NSSelectorFromString(str); 70 | if ([self respondsToSelector:sel]) 71 | { 72 | #pragma clang diagnostic push 73 | #pragma clang diagnostic ignored "-Warc-performSelector-leaks" 74 | [self performSelector:sel]; 75 | #pragma clang diagnostic pop 76 | } 77 | } 78 | 79 | #pragma mark -方法的实现 80 | 81 | -(void)clickOnFuncExit 82 | { 83 | uxy_onFuncExit { 84 | NSLog(@"2"); 85 | NSLog(@"这里的代码会在当前域结束的时候调用, 所以先看到1,然后才是2"); 86 | }; 87 | 88 | NSLog(@"1"); 89 | } 90 | 91 | @end 92 | 93 | 94 | 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /Example/XYQuick/Controller/DatabaseVC.h: -------------------------------------------------------------------------------- 1 | // 2 | // DatabaseVC.h 3 | // JoinShow 4 | // 5 | // Created by Heaven on 13-9-16. 6 | // Copyright (c) 2013年 Heaven. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "ViewControllerDemo.h" 11 | 12 | @interface DatabaseVC : UIViewController 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /Example/XYQuick/Controller/DemoTableViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DomeTableViewController.h 3 | // JoinShow 4 | // 5 | // Created by Heaven on 13-8-23. 6 | // Copyright (c) 2013年 Heaven. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DemoTableViewController : UITableViewController 12 | 13 | @property (nonatomic, strong) NSArray *list; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Example/XYQuick/Controller/DemoViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DemoViewController.h 3 | // JoinShow 4 | // 5 | // Created by Heaven on 14-4-2. 6 | // Copyright (c) 2014年 Heaven. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #define DemoViewController_sel_methodBlock @selector(funny:) 12 | #define DemoViewController_sel_methodBlock2 @selector(funny2:) 13 | 14 | typedef void(^DemoViewControllerExecuteBlock)(UIViewController *vc); 15 | typedef void(^DemoViewControllerFunBlock)(UIViewController *vc, id sender); 16 | 17 | @interface DemoViewController : UIViewController 18 | 19 | @property (nonatomic, copy) NSString *name; 20 | 21 | @property (nonatomic, strong) DemoViewControllerExecuteBlock loadViewBlock; 22 | @property (nonatomic, strong) DemoViewControllerExecuteBlock viewDidLoadBlock; 23 | 24 | @property (nonatomic, strong) DemoViewControllerFunBlock methodBlock; 25 | @property (nonatomic, strong) DemoViewControllerFunBlock methodBlock2; 26 | 27 | //- (void)memoryWarning; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /Example/XYQuick/Controller/DemoViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // DemoViewController.m 3 | // JoinShow 4 | // 5 | // Created by Heaven on 14-4-2. 6 | // Copyright (c) 2014年 Heaven. All rights reserved. 7 | // 8 | 9 | #import "DemoViewController.h" 10 | 11 | #import "XYQuick.h" 12 | 13 | 14 | 15 | @interface DemoViewController () 16 | 17 | @end 18 | 19 | @implementation DemoViewController 20 | 21 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 22 | { 23 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 24 | if (self) { 25 | // Custom initialization 26 | } 27 | return self; 28 | } 29 | 30 | - (void)viewDidLoad 31 | { 32 | [super viewDidLoad]; 33 | // Do any additional setup after loading the view. 34 | self.view.backgroundColor = [UIColor whiteColor]; 35 | 36 | if (_viewDidLoadBlock) { 37 | _viewDidLoadBlock(self); 38 | self.viewDidLoadBlock = nil; 39 | } 40 | } 41 | 42 | - (void)didReceiveMemoryWarning 43 | { 44 | [super didReceiveMemoryWarning]; 45 | // Dispose of any resources that can be recreated. 46 | } 47 | 48 | - (void)loadView{ 49 | [super loadView]; 50 | 51 | if (_loadViewBlock) { 52 | _loadViewBlock(self); 53 | self.loadViewBlock = nil; 54 | } 55 | } 56 | /* 57 | #pragma mark - Navigation 58 | 59 | // In a storyboard-based application, you will often want to do a little preparation before navigation 60 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender 61 | { 62 | // Get the new view controller using [segue destinationViewController]. 63 | // Pass the selected object to the new view controller. 64 | } 65 | */ 66 | - (void)dealloc 67 | { 68 | NSLogDD; 69 | self.viewDidLoadBlock = nil; 70 | self.loadViewBlock = nil; 71 | self.methodBlock = nil; 72 | self.methodBlock2 = nil; 73 | 74 | } 75 | 76 | - (void)funny:(id)sender{ 77 | if (_methodBlock) { 78 | _methodBlock(self, sender); 79 | } 80 | } 81 | - (void)funny2:(id)sender{ 82 | if (_methodBlock2) { 83 | _methodBlock2(self, sender); 84 | } 85 | } 86 | 87 | - (void)memoryWarning 88 | { 89 | NSLogD(@"%@", self.name); 90 | } 91 | @end 92 | -------------------------------------------------------------------------------- /Example/XYQuick/Controller/ImageVC.h: -------------------------------------------------------------------------------- 1 | // 2 | // ImageVC.h 3 | // JoinShow 4 | // 5 | // Created by Heaven on 13-10-25. 6 | // Copyright (c) 2013年 Heaven. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "ViewControllerDemo.h" 11 | 12 | @interface ImageVC : UITableViewController 13 | 14 | @property (nonatomic, strong) UIImage *originImg; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Example/XYQuick/Controller/JSONVC.h: -------------------------------------------------------------------------------- 1 | // 2 | // JSONVC.h 3 | // JoinShow 4 | // 5 | // Created by Heaven on 14-9-9. 6 | // Copyright (c) 2014年 Heaven. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "ViewControllerDemo.h" 11 | 12 | @interface JSONVC : UITableViewController 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /Example/XYQuick/Controller/KeyboardVC.h: -------------------------------------------------------------------------------- 1 | // 2 | // KeyboardVC.h 3 | // JoinShow 4 | // 5 | // Created by Heaven on 13-10-29. 6 | // Copyright (c) 2013年 Heaven. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "ViewControllerDemo.h" 11 | 12 | @interface KeyboardVC : UIViewController { 13 | NSInteger selectedTextFieldTag; 14 | } 15 | - (IBAction)clickEnable:(id)sender; 16 | - (IBAction)clickDisable:(id)sender; 17 | - (IBAction)clickPop:(id)sender; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /Example/XYQuick/Controller/SignalVC.h: -------------------------------------------------------------------------------- 1 | // 2 | // UISignalVC.h 3 | // JoinShow 4 | // 5 | // Created by Heaven on 14-5-20. 6 | // Copyright (c) 2014年 Heaven. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "XYQuick.h" 11 | #import "XYSignal.h" 12 | #import "ViewControllerDemo.h" 13 | 14 | uxy_as_def_signal( signal_name1 ) // 信号1 15 | 16 | @interface Signal1 : UIView 17 | @end 18 | 19 | @interface Signal2 : UIView 20 | @property (nonatomic, strong) UIButton *btn; 21 | @end 22 | 23 | @interface Signal2_child : Signal2 24 | @end 25 | 26 | @interface SignalVC : UIViewController 27 | @end 28 | -------------------------------------------------------------------------------- /Example/XYQuick/Controller/TestVC.h: -------------------------------------------------------------------------------- 1 | // 2 | // TestVC.h 3 | // JoinShow 4 | // 5 | // Created by Heaven on 13-9-1. 6 | // Copyright (c) 2013年 Heaven. All rights reserved. 7 | // 8 | 9 | // 此页面 测试用 10 | #import "ViewControllerDemo.h" 11 | 12 | @class XYObserve; 13 | @class TestView; 14 | @class GirlEntity; 15 | 16 | @interface TestVC : UIViewController { 17 | int offset; 18 | } 19 | @property (nonatomic, strong) NSMutableArray *array; 20 | 21 | @property (nonatomic, assign) int testKVO; 22 | @property (nonatomic, assign) BOOL testKVO_BOOL; 23 | @property (nonatomic, assign) int testKVO2; 24 | @property (nonatomic, strong) NSMutableArray *testArrayKVO; 25 | 26 | @property (nonatomic, strong) GirlEntity *myGirl; 27 | 28 | @property (nonatomic, strong) TestView *testView; 29 | 30 | @property (nonatomic, strong) NSString *text; 31 | 32 | - (IBAction)clickBtn1:(id)sender; 33 | - (IBAction)clickBtn2:(id)sender; 34 | - (IBAction)clickAVSpeech:(id)sender; 35 | - (IBAction)clickOnce:(id)sender; 36 | - (IBAction)clickOnce2:(id)sender; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /Example/XYQuick/Controller/TestVC2.h: -------------------------------------------------------------------------------- 1 | // 2 | // TestVC2.h 3 | // JoinShow 4 | // 5 | // Created by Heaven on 14-4-1. 6 | // Copyright (c) 2014年 Heaven. All rights reserved. 7 | // 8 | 9 | #pragma -mark todo 10 | #import 11 | #import "ViewControllerDemo.h" 12 | 13 | @interface TestVC2 : UITableViewController 14 | 15 | @property (nonatomic, strong) NSArray *items; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Example/XYQuick/Controller/UISignalVC.h: -------------------------------------------------------------------------------- 1 | // 2 | // UISignalVC.h 3 | // JoinShow 4 | // 5 | // Created by Heaven on 14-5-20. 6 | // Copyright (c) 2014年 Heaven. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "ViewControllerDemo.h" 11 | #import "XYUISignal.h" 12 | 13 | @interface UISignal1 : UIView 14 | 15 | AS_SIGNAL( click1 ) 16 | 17 | @end 18 | 19 | 20 | @interface UISignal2 : UIView 21 | 22 | AS_SIGNAL( click2 ) 23 | 24 | @property (nonatomic, strong) UIButton *btn; 25 | 26 | @end 27 | 28 | @interface UISignal2_child : UISignal2 29 | 30 | @end 31 | 32 | @interface UISignalVC : UIViewController 33 | 34 | AS_SIGNAL( click3 ) 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /Example/XYQuick/Controller/ViewControllerDemo.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewControllerDemo.h 3 | // JoinShow 4 | // 5 | // Created by heaven on 15/7/7. 6 | // Copyright (c) 2015年 Heaven. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "XYQuick_Predefine.h" 11 | 12 | @protocol ViewControllerDemo 13 | + (NSString *)title; 14 | @end 15 | 16 | 17 | #define ViewControllerDemoTitle( __title ) \ 18 | + (NSString *)title { return uxy_macro_string( __title ); } 19 | -------------------------------------------------------------------------------- /Example/XYQuick/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | } 88 | ], 89 | "info" : { 90 | "version" : 1, 91 | "author" : "xcode" 92 | } 93 | } -------------------------------------------------------------------------------- /Example/XYQuick/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "orientation" : "portrait", 20 | "idiom" : "ipad", 21 | "extent" : "full-screen", 22 | "minimum-system-version" : "7.0", 23 | "scale" : "1x" 24 | }, 25 | { 26 | "orientation" : "landscape", 27 | "idiom" : "ipad", 28 | "extent" : "full-screen", 29 | "minimum-system-version" : "7.0", 30 | "scale" : "1x" 31 | }, 32 | { 33 | "orientation" : "portrait", 34 | "idiom" : "ipad", 35 | "extent" : "full-screen", 36 | "minimum-system-version" : "7.0", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "orientation" : "landscape", 41 | "idiom" : "ipad", 42 | "extent" : "full-screen", 43 | "minimum-system-version" : "7.0", 44 | "scale" : "2x" 45 | } 46 | ], 47 | "info" : { 48 | "version" : 1, 49 | "author" : "xcode" 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Example/XYQuick/Laboratory/IndicatorHelper.h: -------------------------------------------------------------------------------- 1 | // 2 | // IndicatorHelper.h 3 | // JoinShow 4 | // 5 | // Created by Heaven on 14-6-11. 6 | // Copyright (c) 2014年 Heaven. All rights reserved. 7 | // 8 | // 指示器帮助类 9 | 10 | #import "XYQuick_Predefine.h" 11 | // MBProgressHUD指示器 12 | #import "MBProgressHUD.h" 13 | 14 | @interface IndicatorHelper : NSObject uxy_as_singleton 15 | 16 | // 返回一个indicatorView 17 | + (id)indicatorView; 18 | 19 | // apple原生的UIActivityIndicatorView 20 | + (id)originalIndicator; 21 | + (id)MBProgressHUD; 22 | 23 | // 24 | - (id)message:(NSString *)message; 25 | - (id)inView:(UIView *)view; 26 | 27 | - (id)show; 28 | 29 | 30 | 31 | - (NSTimeInterval)displayDurationForString:(NSString *)str; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /Example/XYQuick/Laboratory/IndicatorHelper.m: -------------------------------------------------------------------------------- 1 | // 2 | // IndicatorHelper.m 3 | // JoinShow 4 | // 5 | // Created by Heaven on 14-6-11. 6 | // Copyright (c) 2014年 Heaven. All rights reserved. 7 | // 8 | 9 | #import "IndicatorHelper.h" 10 | #import "MBProgressHUD.h" 11 | 12 | @implementation IndicatorHelper uxy_def_singleton(IndicatorHelper) 13 | 14 | + (id)originalIndicator 15 | { 16 | UIActivityIndicatorView *view = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; 17 | view.hidesWhenStopped = YES; 18 | 19 | return view; 20 | } 21 | 22 | + (id)MBProgressHUD 23 | { 24 | static dispatch_once_t once; 25 | static MBProgressHUD *MB_HUD; 26 | dispatch_once(&once, ^ { 27 | MB_HUD = [[self alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 28 | }); 29 | 30 | return MB_HUD; 31 | } 32 | 33 | + (id)indicatorView 34 | { 35 | return [IndicatorHelper MBProgressHUD]; 36 | } 37 | 38 | 39 | // 40 | - (id)message:(NSString *)message 41 | { 42 | MBProgressHUD *hud = [IndicatorHelper indicatorView]; 43 | hud.userInteractionEnabled = NO; 44 | hud.mode = MBProgressHUDModeText; 45 | hud.labelText = message; 46 | 47 | [self bringViewToFront:hud]; 48 | 49 | return hud; 50 | } 51 | 52 | - (id)inView:(UIView *)view 53 | { 54 | MBProgressHUD *hud = [IndicatorHelper indicatorView]; 55 | [view addSubview:hud]; 56 | 57 | return hud; 58 | } 59 | - (id)show 60 | { 61 | MBProgressHUD *hud = [IndicatorHelper indicatorView]; 62 | 63 | [hud show:YES]; 64 | [hud hide:YES afterDelay:[self displayDurationForString:hud.labelText]]; 65 | 66 | return hud; 67 | } 68 | 69 | - (NSTimeInterval)displayDurationForString:(NSString *)str 70 | { 71 | return MIN((float)str.length * 0.06 + 0.3, .5); 72 | } 73 | 74 | - (void)bringViewToFront:(UIView *)view 75 | { 76 | //Getting rootViewController 77 | UIViewController *topController = [UIApplication sharedApplication].keyWindow.rootViewController; 78 | 79 | //Getting topMost ViewController 80 | while (topController.presentedViewController) 81 | topController = topController.presentedViewController; 82 | 83 | [topController.view addSubview:view]; 84 | } 85 | 86 | @end 87 | -------------------------------------------------------------------------------- /Example/XYQuick/Laboratory/LKDBHelperExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // LKDBHelperExtension.h 3 | // JoinShow 4 | // 5 | // Created by Heaven on 13-10-31. 6 | // Copyright (c) 2013年 Heaven. All rights reserved. 7 | // 8 | 9 | #define XY_LKDBHelper_loadCount 20 10 | 11 | #import "LKDBHelper.h" 12 | 13 | @interface NSObject(XY_LKDBHelper) 14 | 15 | - (void)loadFromDB; 16 | 17 | + (NSString *)primaryKeyAndDESC; 18 | 19 | @end 20 | 21 | @interface NSArray(XY_LKDBHelper) 22 | 23 | - (void)saveAllToDB; 24 | + (id)loadFromDBWithClass:(Class)modelClass; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Example/XYQuick/Laboratory/LKDBHelperExtension.m: -------------------------------------------------------------------------------- 1 | // 2 | // LKDBHelperExtension.m 3 | // JoinShow 4 | // 5 | // Created by Heaven on 13-10-31. 6 | // Copyright (c) 2013年 Heaven. All rights reserved. 7 | // 8 | 9 | #import "LKDBHelperExtension.h" 10 | 11 | #import "NSObject+LKModel.h" 12 | #import "NSObject+XY.h" 13 | 14 | @implementation NSObject(XY_LKDBHelper) 15 | 16 | - (void)loadFromDB 17 | { 18 | id value = [self valueForKey:[self.class getPrimaryKey]]; 19 | NSString *strValue = nil; 20 | NSString *str = nil; 21 | if (value == nil) 22 | return ; 23 | 24 | if ([value isKindOfClass:[NSString class]]) 25 | { 26 | strValue = value; 27 | str = [NSString stringWithFormat:@"%@ = '%@'", [self.class getPrimaryKey], strValue]; 28 | } 29 | else if ([value isKindOfClass:[NSNumber class]]) 30 | { 31 | strValue = [value stringValue]; 32 | str = [NSString stringWithFormat:@"%@ = %@", [self.class getPrimaryKey], strValue]; 33 | } 34 | else if (1) 35 | { 36 | #pragma mark- todo 多主键种类判断 37 | strValue = @""; 38 | } 39 | 40 | NSMutableArray *arraySync = [self.class searchWithWhere:str orderBy:nil offset:0 count:1]; 41 | if (arraySync.count > 0) 42 | { 43 | NSObject *temp = [arraySync objectAtIndex:0]; 44 | for (NSString *attribute in self.uxy_attributeList) 45 | { 46 | [self setValue:[temp valueForKey:attribute] forKey:attribute]; 47 | } 48 | } 49 | else 50 | { 51 | return; 52 | } 53 | } 54 | + (NSString *)primaryKeyAndDESC 55 | { 56 | return [[self getPrimaryKey] stringByAppendingString:@" DESC"]; 57 | } 58 | 59 | @end 60 | 61 | 62 | @implementation NSArray(XY_LKDBHelper) 63 | 64 | - (void)saveAllToDB 65 | { 66 | // [self.class insertToDB:self]; 67 | if (self.count > 0) 68 | { 69 | // NSObject *anObject = [self objectAtIndex:0]; 70 | LKDBHelper *globalHelper = [LKDBHelper getUsingLKDBHelper]; 71 | 72 | // 创建表 73 | // [globalHelper createTableWithModelClass:[anObject class]]; 74 | 75 | // 异步 插入 76 | [globalHelper executeDB:^(FMDatabase *db) { 77 | [db beginTransaction]; 78 | for (NSObject *anObject2 in self) 79 | { 80 | [globalHelper insertToDB:anObject2]; 81 | } 82 | #pragma mark - todo 83 | BOOL insertSucceed = YES; 84 | //insert fail 85 | if (insertSucceed == NO) 86 | [db rollback]; 87 | else 88 | [db commit]; 89 | }]; 90 | } 91 | } 92 | 93 | +(id) loadFromDBWithClass:(Class)modelClass 94 | { 95 | NSString *str = [modelClass primaryKeyAndDESC]; 96 | NSMutableArray *arraySync = [modelClass searchWithWhere:nil orderBy:str offset:0 count:100]; 97 | 98 | return arraySync; 99 | } 100 | 101 | @end -------------------------------------------------------------------------------- /Example/XYQuick/Laboratory/XYAppController.h: -------------------------------------------------------------------------------- 1 | // 2 | // XYAppController.h 3 | // JoinShow 4 | // 5 | // Created by heaven on 15/4/22. 6 | // Copyright (c) 2015年 Heaven. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "XYQuick_Predefine.h" 11 | 12 | // AppDelegate流程控制类 13 | @interface XYAppController : NSObject uxy_as_singleton 14 | 15 | // 待补全 16 | // 单例有问题 17 | #pragma mark- rewrite下列方法实现控制流程的一些重载 18 | - (void)before_application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions; 19 | - (void)after_application_didFinishLaunchingWithOptions; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Example/XYQuick/Laboratory/XYAppModuleProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // XYAppModuleProtocol.h 3 | // JoinShow 4 | // 5 | // Created by heaven on 14/12/19. 6 | // Copyright (c) 2014年 Heaven. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol XYAppModuleProtocol 12 | 13 | @property (nonatomic, copy, readonly) NSString *name; // 名字 14 | @property (nonatomic, copy, readonly) NSString *icon; // 图标 15 | @property (nonatomic, copy, readonly) NSString *rootViewControllerKey; // 模块的根viewcontroller的key 16 | 17 | // 设置模块的viewController 18 | - (void)setupViewControllers; 19 | 20 | // 设置模块之间的数据交换 21 | - (void)setupCooperatives; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /Example/XYQuick/Laboratory/XYApplicationWorkspace.h: -------------------------------------------------------------------------------- 1 | // 2 | // XYApplicationWorkspace.h 3 | // JoinShow 4 | // 5 | // Created by Heaven on 15/8/5. 6 | // Copyright (c) 2015年 Heaven. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface XYApplicationWorkspace : NSObject 12 | 13 | - (NSArray *)allApplications; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Example/XYQuick/Laboratory/XYApplicationWorkspace.m: -------------------------------------------------------------------------------- 1 | // 2 | // XYApplicationWorkspace.m 3 | // JoinShow 4 | // 5 | // Created by Heaven on 15/8/5. 6 | // Copyright (c) 2015年 Heaven. All rights reserved. 7 | // 8 | 9 | #import "XYApplicationWorkspace.h" 10 | #import 11 | #import "XYQuick.h" 12 | 13 | @implementation XYApplicationWorkspace 14 | 15 | - (NSArray *)allApplications 16 | { 17 | Class LSApplicationWorkspace_class = objc_getClass("LSApplicationWorkspace"); 18 | NSObject *workspace = [LSApplicationWorkspace_class performSelector:@selector(defaultWorkspace)]; 19 | NSArray *array = [workspace performSelector:@selector(allApplications)]; 20 | return array; 21 | } 22 | @end 23 | 24 | #if (1 == __XY_DEBUG_UNITTESTING__) 25 | 26 | UXY_TEST_CASE( Core, XYApplicationWorkspace ) 27 | { 28 | // TODO( "test case" ) 29 | } 30 | 31 | UXY_DESCRIBE( test1 ) 32 | { 33 | NSArray *array = [[XYApplicationWorkspace alloc] allApplications]; 34 | //NSLog(@"apps: %@", array); 35 | UXY_EXPECTED(array.count > 0); 36 | } 37 | 38 | UXY_TEST_CASE_END 39 | #endif 40 | 41 | 42 | -------------------------------------------------------------------------------- /Example/XYQuick/Laboratory/XYBaseDao.h: -------------------------------------------------------------------------------- 1 | // 2 | // XYBaseDao.h 3 | // JoinShow 4 | // 5 | // Created by Heaven on 14-9-10. 6 | // Copyright (c) 2014年 Heaven. All rights reserved. 7 | // 8 | 9 | #import 10 | #define XYBaseDao_error_code 123123 11 | #define XYBaseDao_load_maxCount 1000 12 | 13 | @protocol XYBaseDaoEntityProtocol 14 | 15 | @required 16 | // 返回表名 17 | + (NSString *)getTableName; 18 | 19 | @optional 20 | // 返回主键 21 | + (NSString *)getPrimaryKey; 22 | // 返回联合主键 23 | + (NSArray *)getPrimaryKeyUnionArray; 24 | 25 | @end 26 | 27 | 28 | // 范化的本地dao类 29 | @interface XYBaseDao : NSObject 30 | 31 | @property (nonatomic, weak, readonly) Class entityClass; 32 | 33 | + (instancetype)daoWithEntityClass:(Class)aClass; 34 | + (instancetype)daoWithEntityClassName:(NSString *)name; 35 | 36 | - (NSError *)saveEntity:(id)entity; 37 | - (NSError *)saveEntityWithArray:(NSArray *)array; 38 | 39 | - (id)loadEntityWithKey:(NSString *)key; 40 | - (NSArray *)loadEntityWithWhere:(NSString *)where order:(NSString *)order; 41 | - (NSArray *)loadEntityWithWhere:(NSString *)where order:(NSString *)order offset:(NSInteger)offset count:(NSInteger)count; 42 | 43 | 44 | - (NSInteger)countWithWhere:(NSString *)where; 45 | 46 | - (NSError *)deleteEntity:(id)entity; 47 | - (NSError *)deleteEntityWithKey:(NSString *)key; 48 | - (NSError *)deleteEntityWithWhere:(NSString *)where; 49 | 50 | - (void)deleteAllEntity; 51 | 52 | - (BOOL)isExistEntity:(id)entity; 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /Example/XYQuick/Laboratory/XYBaseDataSource.h: -------------------------------------------------------------------------------- 1 | // 2 | // XYBaseDataSource.h 3 | // JoinShow 4 | // 5 | // Created by Heaven on 14/11/4. 6 | // Copyright (c) 2014年 Heaven. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | #define ON_DATA_SUCCEED_1_( __DataSource, __data ) \ 13 | - (void)dataSource:(id)__DataSource didGetData:(id)__data; 14 | #define ON_DATA_FAILED_1_( __DataSource, __error ) \ 15 | - (void)dataSource:(id)__DataSourcet error:(NSError *)__error; 16 | 17 | #define ON_DATA_SUCCEED_2_( __filter, __DataSource, __data ) \ 18 | - (void)## __filter##_DataSource:(id)__DataSource didGetData:(id)__data; 19 | #define ON_DATA_FAILED_2_( __filter, __DataSource, __error ) \ 20 | - (void)##__filter##_DataSource:(id)__DataSourcet error:(NSError *)__error; 21 | 22 | 23 | 24 | @protocol XYDataSource 25 | 26 | // 获取数据成功 27 | - (void)dataSource:(id)dataSource didUpdateData:(id)data; 28 | // 获取数据失败 29 | - (void)dataSource:(id)dataSource error:(NSError *)error; 30 | 31 | @optional 32 | 33 | // 状态切换 34 | //- (void)dataSource:(id)dataSource state:(NSInteger)state text:(NSString *)text; 35 | 36 | @end 37 | 38 | @interface XYBaseDataSource : NSObject 39 | 40 | @property (nonatomic, assign, readonly) int state; 41 | @property (nonatomic, weak) id delegate; 42 | @property (nonatomic, copy) NSString *filter; // 过滤 43 | 44 | // 开始获取数据 45 | - (void)startGetData; 46 | 47 | @end 48 | 49 | #pragma mark - XYFileDataSource 50 | @interface XYFileDataSource : XYBaseDataSource 51 | 52 | @property (nonatomic, copy) NSString *fileKey; // 必须设置key 53 | 54 | @property (nonatomic, weak) Class dataClass; // 如果设置dataClass, 就用这个类去解析 55 | 56 | + (id)fileDataSourceWithDelegate:(id)delegate fileKey:(NSString *)key; 57 | 58 | @end 59 | 60 | #pragma mark - XYDBDataSource 61 | @interface XYDBDataSource : XYBaseDataSource 62 | 63 | @property (nonatomic, weak) Class dataClass; // 数据类型, 必须设置 64 | 65 | @property (nonatomic, copy) NSString *where; // 查询条件 66 | @property (nonatomic, copy) NSString *order; // 排序 67 | @property (nonatomic, assign) NSInteger offset; // 偏移, 默认0 68 | @property (nonatomic, assign) NSInteger count; // 数量, 默认 20 69 | 70 | + (id)dbDataSourceWithDelegate:(id)delegate dataClass:(Class)dataClass; 71 | 72 | @end 73 | 74 | #pragma mark - XYNetDataSource 75 | @interface XYNetDataSource : XYBaseDataSource 76 | 77 | @property (nonatomic, copy) NSString *path; // 路径 78 | @property (nonatomic, copy) NSString *host; // host 79 | @property (nonatomic, strong) NSDictionary *params; // 参数 80 | @property (nonatomic, copy) NSString *httpMethod; // 默认get 81 | 82 | @property (nonatomic, assign) BOOL usedCache; // 使用缓存 83 | 84 | @end 85 | 86 | 87 | -------------------------------------------------------------------------------- /Example/XYQuick/Laboratory/XYBaseModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // XYBaseModel.h 3 | // JoinShow 4 | // 5 | // Created by Heaven on 14-4-25. 6 | // Copyright (c) 2014年 Heaven. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "XYBaseDataSource.h" 11 | 12 | @interface XYBaseModel : NSObject 13 | 14 | 15 | // 读取数据 16 | - (void)loadDataWith:(XYBaseDataSource *)dataGet; 17 | 18 | 19 | #pragma mark - m 对 c 20 | // 1 Notification 21 | // 2 KVO 22 | 23 | #pragma mark - c直接调用m 24 | // api 25 | 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /Example/XYQuick/Laboratory/XYBaseModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // XYBaseModel.m 3 | // JoinShow 4 | // 5 | // Created by Heaven on 14-4-25. 6 | // Copyright (c) 2014年 Heaven. All rights reserved. 7 | // 8 | 9 | #import "XYBaseModel.h" 10 | #import "XYFileCache.h" 11 | 12 | 13 | @interface XYBaseModel () 14 | 15 | @property (nonatomic, strong) dispatch_queue_t dataGetSerialQueue; // 串行队列 16 | @property (nonatomic, strong) dispatch_queue_t dataGetConcurrentQueue; // 并行队列 17 | 18 | @property (nonatomic, strong) XYFileCache *fileCache; 19 | 20 | @end 21 | 22 | @implementation XYBaseModel 23 | 24 | 25 | - (instancetype)init 26 | { 27 | self = [super init]; 28 | if (self) { 29 | 30 | _fileCache = [XYFileCache sharedInstance]; 31 | } 32 | 33 | return self; 34 | } 35 | 36 | - (void)loadDataWith:(XYBaseDataSource *)dataGet 37 | { 38 | if ([dataGet isKindOfClass:[XYBaseDataSource class]]) 39 | { 40 | // 文件缓存 41 | dispatch_async(_dataGetSerialQueue, ^{ 42 | id data = [_fileCache objectForKey:@"1"]; 43 | dispatch_async(dispatch_get_main_queue(), ^{ 44 | if (data) 45 | { 46 | [self dateGet:dataGet data:data]; 47 | } 48 | else 49 | { 50 | [self dateGet:dataGet getError:nil]; 51 | } 52 | 53 | }); 54 | }); 55 | } 56 | } 57 | 58 | #pragma mark - Protocol 59 | // 获取数据成功 60 | - (void)dateGet:(id)dateGet data:(id)data 61 | { 62 | 63 | } 64 | // 获取数据失败 65 | - (void)dateGet:(id)dateGet getError:(NSError *)error 66 | { 67 | 68 | } 69 | 70 | #pragma mark - XYDataSource 71 | // 获取数据成功 72 | - (void)dataSource:(id)dataSource didUpdateData:(id)data 73 | { 74 | 75 | } 76 | // 获取数据失败 77 | - (void)dataSource:(id)dataSource error:(NSError *)error 78 | { 79 | 80 | } 81 | @end 82 | -------------------------------------------------------------------------------- /Example/XYQuick/Laboratory/XYBaseView.h: -------------------------------------------------------------------------------- 1 | // 2 | // XYBaseView.h 3 | // JoinShow 4 | // 5 | // Created by Heaven on 14-4-25. 6 | // Copyright (c) 2014年 Heaven. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface XYBaseView : UIView 12 | #pragma mark- as 13 | 14 | #pragma mark- model 15 | 16 | #pragma mark- view 17 | 18 | #pragma mark- api 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /Example/XYQuick/Laboratory/XYBaseView.m: -------------------------------------------------------------------------------- 1 | // 2 | // XYBaseView.m 3 | // JoinShow 4 | // 5 | // Created by Heaven on 14-4-25. 6 | // Copyright (c) 2014年 Heaven. All rights reserved. 7 | // 8 | 9 | #import "XYBaseView.h" 10 | 11 | #pragma mark - def 12 | 13 | #pragma mark - override 14 | 15 | #pragma mark - api 16 | 17 | #pragma mark - private 18 | 19 | #pragma mark - model event 20 | #pragma mark 1 notification 21 | #pragma mark 2 KVO 22 | 23 | #pragma mark - view event 24 | #pragma mark 1 target-action 25 | #pragma mark 2 delegate dataSource protocol 26 | 27 | #pragma mark - 28 | 29 | @implementation XYBaseView 30 | 31 | -(id) initWithFrame:(CGRect)frame 32 | { 33 | self = [super initWithFrame:frame]; 34 | if (self) 35 | { 36 | // Initialization code 37 | } 38 | return self; 39 | } 40 | 41 | /* 42 | // Only override drawRect: if you perform custom drawing. 43 | // An empty implementation adversely affects performance during animation. 44 | - (void)drawRect:(CGRect)rect 45 | { 46 | // Drawing code 47 | } 48 | */ 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /Example/XYQuick/Laboratory/XYChainMethod.h: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | 31 | #ifndef JoinShow_XYChainMethod_h_h 32 | #define JoinShow_XYChainMethod_h_h 33 | 34 | #import "XYQuick_Predefine.h" 35 | 36 | // ---------------------------------- 37 | // public 38 | // ---------------------------------- 39 | 40 | #define uxy_as_chainMethod(__blockType, __methodName) \ 41 | - (__blockType)__methodName; 42 | 43 | #define uxy_def_chainMethod(__blockType, __methodName, ...) \ 44 | metamacro_if_eq(1, metamacro_argcount(__VA_ARGS__)) \ 45 | (__uxy_chainMethod_1(__blockType, __methodName, __VA_ARGS__)) \ 46 | (__uxy_chainMethod_2(__blockType, __methodName, __VA_ARGS__)) 47 | 48 | 49 | // ---------------------------------- 50 | // private 51 | // ---------------------------------- 52 | #define __uxy_chainMethod_1(__blockType, __methodName, __propertyName) \ 53 | - (__blockType)__methodName \ 54 | { \ 55 | __blockType block = ^ id (id __propertyName){ \ 56 | self.__propertyName = __propertyName; \ 57 | return self; \ 58 | }; \ 59 | return block; \ 60 | } 61 | 62 | #define __uxy_chainMethod_2(__blockType, __methodName, __propertyName, __defaultValue) \ 63 | - (__blockType)__methodName \ 64 | { \ 65 | __blockType block = ^ id (void){ \ 66 | self.__propertyName = __defaultValue; \ 67 | return self; \ 68 | }; \ 69 | return block; \ 70 | } 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /Example/XYQuick/Laboratory/XYClassLoader.h: -------------------------------------------------------------------------------- 1 | // 2 | // XYClassLoader.h 3 | // JoinShow 4 | // 5 | // Created by heaven on 15/4/22. 6 | // Copyright (c) 2015年 Heaven. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSObject(XYClassLoader) 12 | + (void)uxy_classAutoLoad; 13 | @end 14 | 15 | #pragma mark - 16 | 17 | @interface XYClassLoader : NSObject 18 | 19 | + (instancetype)classLoader; 20 | 21 | - (void)loadClasses:(NSArray *)classNames; 22 | 23 | @end -------------------------------------------------------------------------------- /Example/XYQuick/Laboratory/XYClassLoader.m: -------------------------------------------------------------------------------- 1 | // 2 | // XYClassLoader.m 3 | // JoinShow 4 | // 5 | // Created by heaven on 15/4/22. 6 | // Copyright (c) 2015年 Heaven. All rights reserved. 7 | // 8 | 9 | #import "XYClassLoader.h" 10 | 11 | @implementation NSObject(XYClassLoader) 12 | 13 | + (void)uxy_classAutoLoad 14 | { 15 | } 16 | 17 | @end 18 | 19 | @implementation XYClassLoader 20 | 21 | + (instancetype)classLoader 22 | { 23 | return [[self alloc] init]; 24 | } 25 | 26 | - (void)loadClasses:(NSArray *)classNames 27 | { 28 | @autoreleasepool { 29 | for ( NSString * className in classNames ) 30 | { 31 | Class classType = NSClassFromString( className ); 32 | if ( classType ) 33 | { 34 | fprintf( stderr, " Loading class '%s'\n", [[classType description] UTF8String] ); 35 | 36 | NSMethodSignature * signature = [classType methodSignatureForSelector:@selector(uxy_classAutoLoad)]; 37 | NSInvocation * invocation = [NSInvocation invocationWithMethodSignature:signature]; 38 | 39 | [invocation setTarget:classType]; 40 | [invocation setSelector:@selector(uxy_classAutoLoad)]; 41 | [invocation invoke]; 42 | } 43 | } 44 | 45 | fprintf( stderr, "\n" ); 46 | } 47 | } 48 | 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /Example/XYQuick/Laboratory/XYEvent.h: -------------------------------------------------------------------------------- 1 | // 2 | // XYEvent.h 3 | // JoinShow 4 | // 5 | // Created by XingYao on 15/7/1. 6 | // Copyright (c) 2015年 Heaven. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface XYEventCenter : NSObject 12 | 13 | + (instancetype)defaultCenter; 14 | 15 | - (void)addTarget:(id)target action:(SEL)action forEvent:(NSString *)event; 16 | - (void)removeTarget:(id)target action:(SEL)action forEvent:(NSString *)event; 17 | - (void)removeAllEventsAtTarget:(id)target; 18 | 19 | - (void)sendAction:(SEL)action to:(id)target forEvent:(NSString *)event; 20 | - (void)sendActionsForEvent:(NSString *)event; 21 | 22 | @end 23 | 24 | /* 25 | @protocol XYEvent 26 | @property (nonatomic, weak) id uxy_nextTarget; 27 | @property (nonatomic, weak, readonly) id uxy_defaultNextTarget; 28 | @end 29 | */ 30 | -------------------------------------------------------------------------------- /Example/XYQuick/Laboratory/XYMaterial.h: -------------------------------------------------------------------------------- 1 | // 2 | // XYMaterial.h 3 | // JoinShow 4 | // 5 | // Created by Heaven on 14-1-17. 6 | // Copyright (c) 2014年 Heaven. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface XYMaterial : NSObject 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/XYQuick/Laboratory/XYMaterial.m: -------------------------------------------------------------------------------- 1 | // 2 | // XYMaterial.m 3 | // JoinShow 4 | // 5 | // Created by Heaven on 14-1-17. 6 | // Copyright (c) 2014年 Heaven. All rights reserved. 7 | // 8 | 9 | #import "XYMaterial.h" 10 | 11 | @implementation XYMaterial 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/XYQuick/Laboratory/XYMenuItem.h: -------------------------------------------------------------------------------- 1 | // 2 | // XYMenuItem.h 3 | // JoinShow 4 | // 5 | // Created by heaven on 14/12/11. 6 | // Copyright (c) 2014年 Heaven. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol XYMenuItem 12 | 13 | 14 | @optional 15 | 16 | @property (nonatomic, copy) NSString *title; 17 | @property (nonatomic, copy) NSString *icon; 18 | @property (nonatomic, copy) NSString *backgroundImage; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /Example/XYQuick/Laboratory/XYObjectCache.h: -------------------------------------------------------------------------------- 1 | // 2 | // XYObjectCache.h 3 | // JoinShow 4 | // 5 | // Created by Heaven on 14-1-21. 6 | // Copyright (c) 2014年 Heaven. All rights reserved. 7 | // 8 | // Copy from bee Framework 9 | 10 | #import "XYQuick_Predefine.h" 11 | 12 | @class XYMemoryCache; 13 | @class XYFileCache; 14 | 15 | @interface XYObjectCache : NSObject uxy_as_singleton 16 | 17 | @property (nonatomic, weak, readonly) Class objectClass; // 缓存对象的类 18 | @property (atomic, strong) XYMemoryCache *memoryCache;// 内存缓存 19 | @property (atomic, strong) XYFileCache *fileCache;// 文件缓存 20 | 21 | - (void)registerObjectClass:(Class)aClass; 22 | 23 | - (id)objectForKey:(NSString *)key; 24 | - (void)saveObject:(id)anObject forKey:(NSString *)key; 25 | - (void)deleteObjectForKey:(NSString *)key; 26 | - (void)deleteAllObjects; 27 | 28 | ////////////////////////////////////////////////////////////// 29 | - (BOOL)hasCachedForKey:(NSString *)key; 30 | - (BOOL)hasFileCachedForKey:(NSString *)key; 31 | - (BOOL)hasMemoryCachedForKey:(NSString *)key; 32 | 33 | - (id)fileObjectForKey:(NSString *)key; 34 | - (id)memoryObjectForKey:(NSString *)key; 35 | 36 | - (void)saveObject:(id)anObject forKey:(NSString *)key async:(BOOL)async; 37 | - (void)saveToMemory:(id)anObject forKey:(NSString *)key; 38 | - (void)saveToData:(NSData *)data forKey:(NSString *)key; 39 | 40 | 41 | @end 42 | 43 | 44 | @protocol XYObjectCacheDelegate 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Example/XYQuick/Laboratory/XYRepository.h: -------------------------------------------------------------------------------- 1 | // 2 | // XYRepository.h 3 | // 4 | // Created by heaven on 15/4/29. 5 | // Copyright (c) 2015年 heaven. All rights reserved. 6 | // 7 | 8 | #import "XYQuick_Predefine.h" 9 | #import 10 | 11 | @class XYRepositoryInterface; 12 | @class XYRepositoryEvent; 13 | 14 | @protocol XYRepositoryProtocol 15 | - (void)XYRepositoryWithDataIdentifier:(NSString *)identifier event:(XYRepositoryEvent *)event; 16 | @end 17 | 18 | 19 | typedef void (^XYRepositoryCompletedBlock)(XYRepositoryEvent *event); 20 | 21 | // 模块合作接口 22 | @interface XYRepositoryInterface : NSObject 23 | @property (nonatomic, weak) id receiver; 24 | @property (nonatomic, assign) Class receiverClass; 25 | @property (nonatomic, copy) NSString *identifier; 26 | @end 27 | 28 | // 模块合作事件 29 | @interface XYRepositoryEvent : NSObject 30 | 31 | // Request 32 | @property (nonatomic, strong) XYRepositoryInterface *interface; 33 | @property (nonatomic, copy) XYRepositoryCompletedBlock completedBlock; // 完成后的回调 34 | 35 | // Response 36 | @property (nonatomic, assign) BOOL isAsync; // 是否异步 37 | @property (nonatomic, strong) id data; // 数据 38 | @property (nonatomic, strong) NSError *error; // 错误信息 39 | 40 | @end 41 | 42 | #pragma mark - 聚合 43 | @interface XYAggregate : NSObject 44 | @property (nonatomic, copy, readonly) NSString *key; 45 | @property (nonatomic, weak) id root; // 如果你不是这个对象的持有者,最好不要改变他本身 46 | @end 47 | 48 | 49 | #pragma mark - 50 | // 资源库 51 | @interface XYRepository : NSObject 52 | 53 | @property (nonatomic, copy, readonly) NSString *domain; 54 | 55 | 56 | #pragma mark - 注册相关 57 | // 注册一个数据标识 58 | - (void)registerDataAtIdentifier:(NSString *)identifier receiver:(id )receiver; 59 | - (void)registerDataAtIdentifier:(NSString *)identifier receiverClassName:(NSString *)className; 60 | 61 | #pragma mark - 获取相关 62 | // 获取数据 63 | - (XYRepositoryEvent *)invocationDataIndentifier:(NSString *)identifier 64 | completedBlock:(XYRepositoryCompletedBlock)block; 65 | 66 | 67 | + (instancetype)repositoryWithDomain:(NSString *)domain; 68 | 69 | - (XYAggregate *)aggregateForKey:(NSString *)key; 70 | - (void)setAnAggregateRoot:(id)root forKey:(NSString *)key; 71 | - (void)removeAggregateForKey:(NSString *)key; 72 | 73 | @end 74 | -------------------------------------------------------------------------------- /Example/XYQuick/Laboratory/XYServiceBase.h: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | 31 | #import 32 | 33 | #pragma mark - 34 | 35 | // 自动启动协议 36 | @protocol XYServiceAutoPowerOn 37 | @end 38 | 39 | #pragma mark - 40 | 41 | // 项目业务服务基类 42 | @interface XYServiceBase : NSObject 43 | 44 | @property (nonatomic, copy) NSString *name; 45 | @property (nonatomic, strong) NSBundle *bundle; 46 | @property (nonatomic, assign) BOOL running; 47 | 48 | // 继承的服务默认用这个生成对象 49 | + (instancetype)instance; 50 | 51 | - (void)install; 52 | - (void)uninstall; 53 | 54 | - (void)powerOn; 55 | - (void)powerOff; 56 | 57 | 58 | // 多播委托, 建议重新在子类方法,加上你的协议修饰: -(id )multicastDelggate; 59 | - (id)multicastDelggate; 60 | 61 | - (void)addDelegate:(id)delegate; 62 | - (void)removeDelegate:(id)delegate; 63 | 64 | - (void)removeAllDelegates; 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /Example/XYQuick/Laboratory/XYServiceBase.m: -------------------------------------------------------------------------------- 1 | // 2 | // TDServiceBase.m 3 | // iThunder 4 | // 5 | // Created by heaven on 15/4/15. 6 | // Copyright (c) 2015年 xunlei.com. All rights reserved. 7 | // 8 | 9 | #import "XYServiceBase.h" 10 | 11 | // 先用xmpp里的多路委托这类将就用下 12 | #import "XYMulticastDelegate.h" 13 | 14 | @interface XYServiceBase () 15 | 16 | @property (nonatomic, strong) XYMulticastDelegate *multicastDelggate; 17 | 18 | @end 19 | 20 | @implementation XYServiceBase 21 | 22 | + (instancetype)instance 23 | { 24 | return nil; 25 | } 26 | 27 | - (id)init 28 | { 29 | self = [super init]; 30 | if (self) 31 | { 32 | self.name = NSStringFromClass([self class]); 33 | self.bundle = [NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:[[self class] description] ofType:@"bundle"] ]; 34 | self.multicastDelggate = [[XYMulticastDelegate alloc] init]; 35 | } 36 | return self; 37 | } 38 | 39 | - (void)dealloc 40 | { 41 | if (_running) 42 | { 43 | [self powerOff]; 44 | } 45 | 46 | self.bundle = nil; 47 | self.name = nil; 48 | self.multicastDelggate = nil; 49 | } 50 | 51 | - (void)install 52 | { 53 | } 54 | 55 | - (void)uninstall 56 | { 57 | } 58 | 59 | - (void)powerOn 60 | { 61 | } 62 | 63 | - (void)powerOff 64 | { 65 | } 66 | 67 | - (void)addDelegate:(id)delegate 68 | { 69 | [_multicastDelggate addDelegate:delegate delegateQueue:dispatch_get_main_queue()]; 70 | } 71 | 72 | - (void)removeDelegate:(id)delegate 73 | { 74 | [_multicastDelggate removeDelegate:delegate]; 75 | } 76 | 77 | - (void)removeAllDelegates 78 | { 79 | [_multicastDelggate removeAllDelegates]; 80 | } 81 | 82 | @end 83 | -------------------------------------------------------------------------------- /Example/XYQuick/Laboratory/module/XYInterfaceManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // XYInterfaceManager.h 3 | // XYQuick 4 | // 5 | // Created by heaven on 2016/12/22. 6 | // Copyright © 2016年 uxyheaven. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface XYInterfaceManager : NSObject 13 | 14 | /* 15 | * sel : create 16 | * sel : retrieve 17 | * sel : update 18 | * sel : delete 19 | * completion : {ret : 1, error : error, data : data } 20 | * resourceDoActionWithJSON("达人", retrieve, {达人id = 1}); 21 | * resourceDoActionWithJSON("达人列表", retrieve, {count = 10}); 22 | */ 23 | 24 | + (void)resource:(NSString *)resource 25 | doAction:(SEL)sel 26 | withJSON:(id)json 27 | success:(void (^)(id data))success 28 | failure:(void (^)(NSError *error))failure; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /Example/XYQuick/Laboratory/module/XYInterfaceManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // XYInterfaceManager.m 3 | // XYQuick 4 | // 5 | // Created by heaven on 2016/12/22. 6 | // Copyright © 2016年 uxyheaven. All rights reserved. 7 | // 8 | 9 | #import "XYInterfaceManager.h" 10 | 11 | @interface XYInterfaceManager () 12 | 13 | + (instancetype)sharedInstance; 14 | 15 | @end 16 | 17 | @implementation XYInterfaceManager 18 | 19 | static id __singleton__objc__token; 20 | static dispatch_once_t __singleton__token__token; 21 | + (instancetype)sharedInstance 22 | { 23 | dispatch_once(&__singleton__token__token, ^{ __singleton__objc__token = [[self alloc] init]; }); 24 | return __singleton__objc__token; 25 | } 26 | 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /Example/XYQuick/Laboratory/module/XYModuleLifecycle.h: -------------------------------------------------------------------------------- 1 | // 2 | // XYModuleLifecycle.h 3 | // XYQuick 4 | // 5 | // Created by heaven on 2016/12/20. 6 | // Copyright © 2016年 uxyheaven. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface XYModuleLifecycle : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Example/XYQuick/Laboratory/module/XYModuleLifecycle.m: -------------------------------------------------------------------------------- 1 | // 2 | // XYModuleLifecycle.m 3 | // XYQuick 4 | // 5 | // Created by heaven on 2016/12/20. 6 | // Copyright © 2016年 uxyheaven. All rights reserved. 7 | // 8 | 9 | #import "XYModuleLifecycle.h" 10 | 11 | @implementation XYModuleLifecycle 12 | 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 14 | { 15 | // Override point for customization after application launch. 16 | return YES; 17 | } 18 | 19 | - (void)applicationWillResignActive:(UIApplication *)application 20 | { 21 | // 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. 22 | // 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. 23 | } 24 | 25 | - (void)applicationDidEnterBackground:(UIApplication *)application 26 | { 27 | // 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. 28 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 29 | } 30 | 31 | - (void)applicationWillEnterForeground:(UIApplication *)application 32 | { 33 | // 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. 34 | } 35 | 36 | - (void)applicationDidBecomeActive:(UIApplication *)application 37 | { 38 | // 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. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application 42 | { 43 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Example/XYQuick/Laboratory/module/XYModuleManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // XYModuleManager.h 3 | // XYQuick 4 | // 5 | // Created by heaven on 2016/12/20. 6 | // Copyright © 2016年 uxyheaven. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface XYModuleManager : NSObject 12 | 13 | + (instancetype)sharedInstance; 14 | 15 | - (void)hookAppDelegate:(id )appDelegate; 16 | 17 | - (void)addAModule:(id)module; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /Example/XYQuick/Laboratory/module/XYModuleManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // XYModuleManager.m 3 | // XYQuick 4 | // 5 | // Created by heaven on 2016/12/20. 6 | // Copyright © 2016年 uxyheaven. All rights reserved. 7 | // 8 | 9 | #import "XYModuleManager.h" 10 | #import 11 | #import "XYQuick.h" 12 | #import "XYModuleLifecycle.h" 13 | 14 | 15 | @interface XYModuleManager () 16 | 17 | @property (nonatomic, strong) NSMutableArray *modules; 18 | 19 | @end 20 | 21 | @implementation XYModuleManager 22 | 23 | - (void)hookAppDelegate:(id )appDelegate 24 | { 25 | unsigned int numberOfMethods = 0; 26 | struct objc_method_description *methodDescriptions = protocol_copyMethodDescriptionList(@protocol(UIApplicationDelegate), NO, YES, &numberOfMethods); 27 | 28 | for (unsigned int i = 0; i < numberOfMethods; ++i) 29 | { 30 | struct objc_method_description methodDescription = methodDescriptions[i]; 31 | SEL selector = methodDescription.name; 32 | 33 | if (![self respondsToSelector:selector]) 34 | { 35 | [XYAOP interceptClass:[appDelegate class] afterExecutingSelector:selector usingBlock:^(NSInvocation *invocation) { 36 | for (XYModuleLifecycle *life in self.modules) 37 | { 38 | if ([life respondsToSelector:selector]) 39 | { 40 | NSInvocation *invo = [NSInvocation invocationWithMethodSignature:[[life class] instanceMethodSignatureForSelector:selector]]; 41 | invo.target = life; 42 | invo.selector = selector; 43 | for (int i = 2; i < invocation.methodSignature.numberOfArguments; i++) 44 | { 45 | void *arg; 46 | [invocation getArgument:&arg atIndex:i]; 47 | [invo setArgument:&arg atIndex:i]; 48 | } 49 | 50 | [invo invoke]; 51 | } 52 | } 53 | }]; 54 | } 55 | } 56 | } 57 | 58 | 59 | - (void)addAModule:(id)module 60 | { 61 | [_modules addObject:module]; 62 | } 63 | 64 | 65 | #pragma mark - 66 | 67 | #pragma mark - 68 | 69 | static id __singleton__objc__token; 70 | static dispatch_once_t __singleton__token__token; 71 | + (instancetype)sharedInstance 72 | { 73 | dispatch_once(&__singleton__token__token, ^{ __singleton__objc__token = [[self alloc] init]; }); 74 | return __singleton__objc__token; 75 | } 76 | 77 | - (instancetype)init 78 | { 79 | self = [super init]; 80 | if (self) { 81 | _modules = @[].mutableCopy; 82 | } 83 | return self; 84 | } 85 | 86 | + (void)load 87 | { 88 | @autoreleasepool { 89 | 90 | } 91 | } 92 | 93 | 94 | @end 95 | -------------------------------------------------------------------------------- /Example/XYQuick/Laboratory/module/XYWidget.h: -------------------------------------------------------------------------------- 1 | // 2 | // XYWidget.h 3 | // XYQuick 4 | // 5 | // Created by heaven on 2016/12/22. 6 | // Copyright © 2016年 uxyheaven. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface XYWidget : NSObject 12 | 13 | @property (nonatomic, strong, readonly) NSDictionary *data; 14 | @property (nonatomic, strong, readonly) UIView *view; 15 | 16 | #pragma mark - API 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Example/XYQuick/Laboratory/module/XYWidget.m: -------------------------------------------------------------------------------- 1 | // 2 | // XYWidget.m 3 | // XYQuick 4 | // 5 | // Created by heaven on 2016/12/22. 6 | // Copyright © 2016年 uxyheaven. All rights reserved. 7 | // 8 | 9 | #import "XYWidget.h" 10 | 11 | @interface XYWidget () 12 | 13 | @property (nonatomic, strong) UIViewController *vc; 14 | @property (nonatomic, strong) NSDictionary *data; 15 | @property (nonatomic, strong) UIView *view; 16 | 17 | @end 18 | 19 | @implementation XYWidget 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Example/XYQuick/Model/AopTestM.h: -------------------------------------------------------------------------------- 1 | // 2 | // AopTestM.h 3 | // JoinShow 4 | // 5 | // Created by Heaven on 14/10/28. 6 | // Copyright (c) 2014年 Heaven. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AopTestM : NSObject 12 | 13 | - (NSString *)sumA:(int)a andB:(int)b; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Example/XYQuick/Model/AopTestM.m: -------------------------------------------------------------------------------- 1 | // 2 | // AopTestM.m 3 | // JoinShow 4 | // 5 | // Created by Heaven on 14/10/28. 6 | // Copyright (c) 2014年 Heaven. All rights reserved. 7 | // 8 | 9 | #import "AopTestM.h" 10 | 11 | @implementation AopTestM 12 | 13 | - (NSString *)sumA:(int)a andB:(int)b 14 | { 15 | int value = a + b; 16 | NSString *str = [NSString stringWithFormat:@"fun running. sum : %d", value]; 17 | NSLog(@"%@", str); 18 | 19 | return str; 20 | } 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /Example/XYQuick/Model/Associated.h: -------------------------------------------------------------------------------- 1 | // 2 | // Associated.h 3 | // JoinShow 4 | // 5 | // Created by Heaven on 15/8/28. 6 | // Copyright (c) 2015年 Heaven. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "XYQuick.h" 11 | 12 | @interface Associated : NSObject 13 | 14 | @end 15 | 16 | @interface Associated (test) 17 | 18 | @uxy_property_basicDataType(int, age); 19 | @uxy_property_basicDataType(NSTimeInterval, time); 20 | @uxy_property_copy(NSString *, name); 21 | @uxy_property_weak(NSDate *, date); 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /Example/XYQuick/Model/Associated.m: -------------------------------------------------------------------------------- 1 | // 2 | // Associated.m 3 | // JoinShow 4 | // 5 | // Created by Heaven on 15/8/28. 6 | // Copyright (c) 2015年 Heaven. All rights reserved. 7 | // 8 | 9 | #import "Associated.h" 10 | 11 | @implementation Associated 12 | 13 | @end 14 | 15 | @implementation Associated (test) 16 | 17 | uxy_def_property_basicDataType(int, age) 18 | uxy_def_property_basicDataType(NSTimeInterval, time) 19 | uxy_def_property_copy(NSString *, name) 20 | uxy_def_property_weak(NSDate *, date) 21 | @end 22 | 23 | 24 | #pragma mark - 25 | // ---------------------------------- 26 | // Unit test 27 | // ---------------------------------- 28 | #if (1 == __XY_DEBUG_UNITTESTING__) 29 | #import "XYUnitTest.h" 30 | 31 | UXY_TEST_CASE( Test, Associated ) 32 | { 33 | // TODO( "test case" ) 34 | NSDate *_date; 35 | } 36 | 37 | UXY_DESCRIBE( before ) 38 | { 39 | _date = [NSDate date]; 40 | } 41 | 42 | UXY_DESCRIBE( test1 ) 43 | { 44 | Associated *associated = [[Associated alloc] init]; 45 | associated.age = 10; 46 | associated.time = 100.5f; 47 | associated.name = @"aaa"; 48 | associated.date = _date; 49 | 50 | UXY_EXPECTED( associated.age == 10 ); 51 | UXY_EXPECTED( associated.time == 100.5f ); 52 | UXY_EXPECTED( [associated.name isEqualToString:@"aaa"] ); 53 | UXY_EXPECTED( [associated.date isEqualToDate:_date] ); 54 | } 55 | 56 | UXY_TEST_CASE_END 57 | 58 | #endif -------------------------------------------------------------------------------- /Example/XYQuick/Model/AutoCodingEntity.h: -------------------------------------------------------------------------------- 1 | // 2 | // AutoCodingEntity.h 3 | // JoinShow 4 | // 5 | // Created by Heaven on 14/10/31. 6 | // Copyright (c) 2014年 Heaven. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class AutoCodingEntityOther; 12 | 13 | @interface AutoCodingEntityList : NSObject 14 | 15 | @property (nonatomic, strong) NSMutableArray *array; 16 | 17 | @end 18 | 19 | 20 | @interface AutoCodingEntityBase : NSObject 21 | 22 | @property (nonatomic, copy) NSString *str; 23 | @property (nonatomic, assign) float f; 24 | 25 | @end 26 | 27 | 28 | @interface AutoCodingEntity : AutoCodingEntityBase 29 | 30 | @property (nonatomic, strong) NSNumber *num; 31 | @property (nonatomic, assign) int i; 32 | @property (nonatomic, assign) BOOL b; 33 | 34 | @property (nonatomic, strong) AutoCodingEntityOther *objc; 35 | 36 | @end 37 | 38 | 39 | @interface AutoCodingEntityOther : NSObject 40 | 41 | @property (nonatomic, assign) int i; 42 | 43 | @end 44 | 45 | -------------------------------------------------------------------------------- /Example/XYQuick/Model/AutoCodingEntity.m: -------------------------------------------------------------------------------- 1 | // 2 | // AutoCodingEntity.m 3 | // JoinShow 4 | // 5 | // Created by Heaven on 14/10/31. 6 | // Copyright (c) 2014年 Heaven. All rights reserved. 7 | // 8 | 9 | #import "AutoCodingEntity.h" 10 | 11 | @implementation AutoCodingEntity 12 | 13 | @end 14 | 15 | @implementation AutoCodingEntityOther 16 | 17 | @end 18 | 19 | @implementation AutoCodingEntityBase 20 | 21 | @end 22 | 23 | @implementation AutoCodingEntityList 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /Example/XYQuick/Model/CarEntity.h: -------------------------------------------------------------------------------- 1 | // 2 | // CarEntity.h 3 | // JoinShow 4 | // 5 | // Created by Heaven on 14-9-12. 6 | // Copyright (c) 2014年 Heaven. All rights reserved. 7 | // 8 | 9 | // 测试XYBaseDao用 10 | #import 11 | #import "XYBaseDao.h" 12 | 13 | @interface CarEntity : NSObject 14 | 15 | @property (nonatomic, copy) NSString *name; 16 | @property (nonatomic, copy) NSString *brand; 17 | @property (nonatomic, assign) NSInteger time; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /Example/XYQuick/Model/CarEntity.m: -------------------------------------------------------------------------------- 1 | // 2 | // CarEntity.m 3 | // JoinShow 4 | // 5 | // Created by Heaven on 14-9-12. 6 | // Copyright (c) 2014年 Heaven. All rights reserved. 7 | // 8 | 9 | #import "CarEntity.h" 10 | 11 | @implementation CarEntity 12 | 13 | #pragma mark - XYBaseDaoEntityProtocol 14 | // 返回表名 15 | + (NSString *)getTableName{ 16 | return @"car"; 17 | } 18 | 19 | // 返回主键 20 | + (NSString *)getPrimaryKey{ 21 | return @"name"; 22 | } 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /Example/XYQuick/Model/ConfigManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // ConfigManager.h 3 | // JoinShow 4 | // 5 | // Created by Heaven on 13-9-10. 6 | // Copyright (c) 2013年 Heaven. All rights reserved. 7 | // 8 | 9 | #import "XYQuick.h" 10 | 11 | @interface ConfigManager : NSObject uxy_as_singleton 12 | 13 | @property (nonatomic, strong) NSString *StrTest; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Example/XYQuick/Model/ConfigManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // ConfigManager.m 3 | // JoinShow 4 | // 5 | // Created by Heaven on 13-9-10. 6 | // Copyright (c) 2013年 Heaven. All rights reserved. 7 | // 8 | 9 | #import "ConfigManager.h" 10 | 11 | @implementation ConfigManager uxy_def_singleton(ConfigManager) 12 | 13 | - (NSString *)Strtest2 14 | { 15 | return [[NSUserDefaults standardUserDefaults] objectForKey:@"a"]; 16 | } 17 | @end 18 | -------------------------------------------------------------------------------- /Example/XYQuick/Model/EntityBaseModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // EntityModel.h 3 | // JoinShow 4 | // 5 | // Created by Heaven on 13-12-10. 6 | // Copyright (c) 2013年 Heaven. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "XYQuick.h" 11 | 12 | @class RequestHelper; 13 | @class LKDBHelper; 14 | 15 | @protocol EntityModelDelegate; 16 | @interface EntityBaseModel : NSObject{ 17 | //@public id _delegate; 18 | } 19 | 20 | //AS_SINGLETON(EntityModel) 21 | 22 | @property (nonatomic, strong) id data; // 数据 23 | @property (nonatomic, assign) Class dataClass; // 数据类型 24 | @property (nonatomic, strong) id result; // 临时数据 25 | @property (nonatomic, strong, readonly) NSMutableArray *array; // array 26 | @property (nonatomic, strong, readonly) NSMutableDictionary *dic; // dic 27 | 28 | @property (nonatomic, assign) int tag; // 标签 29 | 30 | @property (nonatomic, strong) RequestHelper *requestHelper; // 网络请求,需要自己初始化 31 | @property (nonatomic, strong) LKDBHelper *dbHelper; // 数据库帮助类 32 | 33 | 34 | #pragma mark - 35 | 36 | +(id) modelWithClass:(Class)aClass; 37 | 38 | #pragma mark - net 39 | //- (void)loadFromServer/ 40 | 41 | #pragma mark - database 42 | //- (void)loadFromDatabase 43 | 44 | - (void)addObject:(id)anObject; 45 | - (void)insertObject:(id)anObject atIndex:(NSUInteger)index; 46 | - (void)removeLastObject; 47 | - (void)removeObjectAtIndex:(NSUInteger)index; 48 | 49 | @end 50 | 51 | -------------------------------------------------------------------------------- /Example/XYQuick/Model/EntityBaseModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // EntityModel.m 3 | // JoinShow 4 | // 5 | // Created by Heaven on 13-12-10. 6 | // Copyright (c) 2013年 Heaven. All rights reserved. 7 | // 8 | 9 | #import "EntityBaseModel.h" 10 | #import "XYQuick.h" 11 | #import "LKDBHelperExtension.h" 12 | 13 | @interface EntityBaseModel () 14 | 15 | @property (nonatomic, strong) NSMutableArray *array; // array 16 | @property (nonatomic, strong) NSMutableDictionary *dic; // dic 17 | 18 | @end 19 | 20 | @implementation EntityBaseModel 21 | 22 | //DEF_SINGLETON(EntityModel) 23 | 24 | - (id)init 25 | { 26 | self = [super init]; 27 | if (self) 28 | { 29 | self.dbHelper = [[self class] getUsingLKDBHelper]; 30 | 31 | self.array = [NSMutableArray array]; 32 | self.dic = [NSMutableDictionary dictionary]; 33 | } 34 | return self; 35 | } 36 | 37 | + (id)modelWithClass:(Class)aClass 38 | { 39 | EntityBaseModel *aModel = [[[self class] alloc] init]; 40 | 41 | aModel.dataClass = aClass; 42 | aModel.dbHelper = [[aClass class] getUsingLKDBHelper]; 43 | 44 | return aModel; 45 | } 46 | 47 | - (void)dealloc 48 | { 49 | NSLogDD 50 | // [self.requestHelper cancelAllOperations]; 51 | } 52 | 53 | #pragma mark - 子类重载下面的方法 54 | 55 | - (void)addObject:(id)anObject 56 | { 57 | [anObject saveToDB]; 58 | 59 | [self willChangeValueForKey:@"array" ]; 60 | [self.array addObject:anObject]; 61 | [self didChangeValueForKey:@"array"]; 62 | } 63 | 64 | - (void)insertObject:(id)anObject atIndex:(NSUInteger)index 65 | { 66 | [anObject saveToDB]; 67 | 68 | [self willChangeValueForKey:@"array"]; 69 | [self.array insertObject:anObject atIndex:index]; 70 | [self didChangeValueForKey:@"array"]; 71 | } 72 | 73 | - (void)removeLastObject 74 | { 75 | id anObject = [self.array lastObject]; 76 | [anObject deleteToDB]; 77 | 78 | [self willChangeValueForKey:@"array"]; 79 | [self.array removeLastObject]; 80 | [self didChangeValueForKey:@"array"]; 81 | } 82 | 83 | - (void)removeObjectAtIndex:(NSUInteger)index 84 | { 85 | id anObject = [self.array objectAtIndex:index]; 86 | [anObject deleteToDB]; 87 | 88 | [self willChangeValueForKey:@"array"]; 89 | [self.array removeObjectAtIndex:index]; 90 | [self didChangeValueForKey:@"array"]; 91 | } 92 | 93 | @end 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | -------------------------------------------------------------------------------- /Example/XYQuick/Model/GirlEntity.h: -------------------------------------------------------------------------------- 1 | // 2 | // GirlEntity.h 3 | // JoinShow 4 | // 5 | // Created by Heaven on 14-1-13. 6 | // Copyright (c) 2014年 Heaven. All rights reserved. 7 | // 8 | 9 | // 测试runtime 时候用的 10 | #import 11 | 12 | @interface GirlEntity : NSObject 13 | 14 | @property (nonatomic, copy) NSString *name; 15 | 16 | - (void)talk; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Example/XYQuick/Model/GirlEntity.m: -------------------------------------------------------------------------------- 1 | // 2 | // GirlEntity.m 3 | // JoinShow 4 | // 5 | // Created by Heaven on 14-1-13. 6 | // Copyright (c) 2014年 Heaven. All rights reserved. 7 | // 8 | 9 | #import "GirlEntity.h" 10 | 11 | @implementation GirlEntity 12 | 13 | - (void)talk{ 14 | NSLog(@"%s", __func__); 15 | } 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Example/XYQuick/Model/JsonTestEntity.h: -------------------------------------------------------------------------------- 1 | // 2 | // JsonTestEntity.h 3 | // JoinShow 4 | // 5 | // Created by Heaven on 14-4-24. 6 | // Copyright (c) 2014年 Heaven. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface JsonTestEntity : NSObject 12 | @property (nonatomic, strong) NSArray *array; 13 | @property (nonatomic, strong) NSDictionary *dic; 14 | @end 15 | -------------------------------------------------------------------------------- /Example/XYQuick/Model/JsonTestEntity.m: -------------------------------------------------------------------------------- 1 | // 2 | // JsonTestEntity.m 3 | // JoinShow 4 | // 5 | // Created by Heaven on 14-4-24. 6 | // Copyright (c) 2014年 Heaven. All rights reserved. 7 | // 8 | 9 | #import "JsonTestEntity.h" 10 | 11 | @implementation JsonTestEntity 12 | 13 | - (void)dealloc 14 | { 15 | self.array = nil; 16 | self.dic = nil; 17 | } 18 | @end 19 | -------------------------------------------------------------------------------- /Example/XYQuick/Model/LKTestModels.h: -------------------------------------------------------------------------------- 1 | // 2 | // LKTestModels.h 3 | // LKDBHelper 4 | // 5 | // Created by upin on 13-7-12. 6 | // Copyright (c) 2013年 ljh. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "LKDBHelper.h" 11 | 12 | @interface LKTestForeignSuper : NSObject 13 | @property(copy,nonatomic)NSString* address; 14 | @property int postcode; 15 | @end 16 | 17 | @interface LKTestForeign : LKTestForeignSuper 18 | @property int addid; 19 | @end 20 | 21 | 22 | 23 | @interface LKTest : NSObject 24 | @property(copy,nonatomic)NSString* name; 25 | @property NSUInteger age; 26 | @property BOOL isGirl; 27 | 28 | @property(strong,nonatomic)LKTestForeign* address; 29 | @property(strong,nonatomic)NSArray* blah; 30 | @property(strong,nonatomic)NSDictionary* hoho; 31 | 32 | @property char like; 33 | 34 | #ifdef __IPHONE_OS_VERSION_MIN_REQUIRED 35 | @property(strong,nonatomic) UIImage* img; 36 | @property(strong,nonatomic)UIColor* color; 37 | @property CGRect frame1; 38 | #else 39 | @property(strong,nonatomic) NSImage* img; 40 | @property(strong,nonatomic) NSColor* color; 41 | @property NSRect frame1; 42 | #endif 43 | 44 | @property(strong,nonatomic) NSDate* date; 45 | 46 | @property(copy,nonatomic)NSString* error; 47 | 48 | //new add 49 | @property double score; 50 | 51 | @property(strong,nonatomic)NSData* data; 52 | 53 | @property CGRect frame; 54 | 55 | @property CGRect size; 56 | @property CGPoint point; 57 | @property NSRange range; 58 | @end 59 | 60 | 61 | @interface NSObject(PrintSQL) 62 | +(NSString*)getCreateTableSQL; 63 | @end -------------------------------------------------------------------------------- /Example/XYQuick/Model/RubyChinaNodeEntity.h: -------------------------------------------------------------------------------- 1 | // 2 | // RubyChinaNodeEntity.h 3 | // JoinShow 4 | // 5 | // Created by Heaven on 13-10-31. 6 | // Copyright (c) 2013年 Heaven. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "XYQuick.h" 11 | 12 | @protocol RubyChinaNodeEntity 13 | @end 14 | 15 | @interface RubyChinaNodeEntity : NSObject 16 | 17 | @property (nonatomic, assign) int nodeID; 18 | @property (nonatomic, strong) NSString *name; 19 | @property (nonatomic, assign) int topics_count; 20 | @property (nonatomic, strong) NSString *summary; 21 | @property (nonatomic, assign) int section_id; 22 | @property (nonatomic, assign) int sort; 23 | @property (nonatomic, strong) NSString *section_name; 24 | 25 | @property (nonatomic, strong) RubyChinaNodeEntity *nextNode; 26 | @property (nonatomic, strong) NSArray *array; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /Example/XYQuick/Model/RubyChinaNodeEntity.m: -------------------------------------------------------------------------------- 1 | // 2 | // RubyChinaNodeEntity.m 3 | // JoinShow 4 | // 5 | // Created by Heaven on 13-10-31. 6 | // Copyright (c) 2013年 Heaven. All rights reserved. 7 | // 8 | 9 | #import "RubyChinaNodeEntity.h" 10 | #import "XYJSON.h" 11 | 12 | @implementation RubyChinaNodeEntity 13 | - (void)dealloc 14 | { 15 | self.name = nil; 16 | self.summary = nil; 17 | self.section_name = nil; 18 | } 19 | 20 | + (void)initialize 21 | { 22 | if (self == [RubyChinaNodeEntity class]){ 23 | [self uxy_addNickname:@"id" forProperty:@"nodeID"]; 24 | } 25 | } 26 | 27 | // DB 28 | //主键 29 | +(NSString *)getPrimaryKey 30 | { 31 | return @"nodeID"; 32 | } 33 | //表名 34 | +(NSString *)getTableName 35 | { 36 | return @"RubyChinaNode"; 37 | } 38 | //表版本 39 | +(int)getTableVersion 40 | { 41 | return 1; 42 | } 43 | @end 44 | -------------------------------------------------------------------------------- /Example/XYQuick/Model/Test1Model.h: -------------------------------------------------------------------------------- 1 | // 2 | // Test1Model.h 3 | // JoinShow 4 | // 5 | // Created by Heaven on 13-12-12. 6 | // Copyright (c) 2013年 Heaven. All rights reserved. 7 | // 8 | 9 | #import "EntityBaseModel.h" 10 | 11 | @interface Test1Model : EntityBaseModel 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/XYQuick/Model/Test1Model.m: -------------------------------------------------------------------------------- 1 | // 2 | // Test1Model.m 3 | // JoinShow 4 | // 5 | // Created by Heaven on 13-12-12. 6 | // Copyright (c) 2013年 Heaven. All rights reserved. 7 | // 8 | 9 | #import "Test1Model.h" 10 | 11 | @implementation Test1Model uxy_def_singleton(Test1Model) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/XYQuick/Model/Test2Model.h: -------------------------------------------------------------------------------- 1 | // 2 | // Test2Model.h 3 | // JoinShow 4 | // 5 | // Created by Heaven on 13-12-12. 6 | // Copyright (c) 2013年 Heaven. All rights reserved. 7 | // 8 | 9 | #import "EntityBaseModel.h" 10 | 11 | @interface Test2Model : EntityBaseModel 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/XYQuick/Model/Test2Model.m: -------------------------------------------------------------------------------- 1 | // 2 | // Test2Model.m 3 | // JoinShow 4 | // 5 | // Created by Heaven on 13-12-12. 6 | // Copyright (c) 2013年 Heaven. All rights reserved. 7 | // 8 | 9 | #import "Test2Model.h" 10 | 11 | @implementation Test2Model uxy_def_singleton(Test2Model) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/XYQuick/Modules/ModuleA.h: -------------------------------------------------------------------------------- 1 | // 2 | // ModuleA.h 3 | // XYQuick 4 | // 5 | // Created by heaven on 2016/12/21. 6 | // Copyright © 2016年 uxyheaven. All rights reserved. 7 | // 8 | 9 | #import "XYModuleLifecycle.h" 10 | 11 | @interface ModuleA : XYModuleLifecycle 12 | 13 | + (instancetype)sharedInstance; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Example/XYQuick/Modules/ModuleA.m: -------------------------------------------------------------------------------- 1 | // 2 | // ModuleA.m 3 | // XYQuick 4 | // 5 | // Created by heaven on 2016/12/21. 6 | // Copyright © 2016年 uxyheaven. All rights reserved. 7 | // 8 | 9 | #import "ModuleA.h" 10 | #import "XYModuleManager.h" 11 | 12 | @implementation ModuleA 13 | 14 | static id __singleton__objc__token; 15 | static dispatch_once_t __singleton__token__token; 16 | + (instancetype)sharedInstance 17 | { 18 | dispatch_once(&__singleton__token__token, ^{ __singleton__objc__token = [[self alloc] init]; }); 19 | return __singleton__objc__token; 20 | } 21 | 22 | + (void)load 23 | { 24 | [[XYModuleManager sharedInstance] addAModule:[ModuleA sharedInstance]]; 25 | } 26 | 27 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 28 | { 29 | // Override point for customization after application launch. 30 | return YES; 31 | } 32 | 33 | - (void)applicationWillResignActive:(UIApplication *)application 34 | { 35 | // 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. 36 | // 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. 37 | } 38 | 39 | - (void)applicationDidEnterBackground:(UIApplication *)application 40 | { 41 | // 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. 42 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 43 | } 44 | 45 | - (void)applicationWillEnterForeground:(UIApplication *)application 46 | { 47 | // 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. 48 | } 49 | 50 | - (void)applicationDidBecomeActive:(UIApplication *)application 51 | { 52 | // 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. 53 | } 54 | 55 | - (void)applicationWillTerminate:(UIApplication *)application 56 | { 57 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 58 | } 59 | 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /Example/XYQuick/Resource/bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uxyheaven/XYQuick/aa8d546892a2ad7eb654813c38d0bcbdd60fa432/Example/XYQuick/Resource/bg.jpg -------------------------------------------------------------------------------- /Example/XYQuick/Resource/bg_trends.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uxyheaven/XYQuick/aa8d546892a2ad7eb654813c38d0bcbdd60fa432/Example/XYQuick/Resource/bg_trends.png -------------------------------------------------------------------------------- /Example/XYQuick/Resource/default_TestDic.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Author 6 | 7 | sourcecolumn 8 | Author 9 | text 10 | 11 | 12 | title 13 | Author 14 | 15 | FictionType 16 | 17 | sourcecolumn 18 | FictionType 19 | text 20 | 21 | 22 | title 23 | FictionType 24 | 25 | ISBN_Digital 26 | 27 | sourcecolumn 28 | ISBN_Digital 29 | text 30 | 31 | 32 | title 33 | ISBN Digital 34 | 35 | IllustratedBy 36 | 37 | sourcecolumn 38 | IllustratedBy 39 | text 40 | 41 | 42 | title 43 | Illustrated By 44 | 45 | WordCount 46 | 47 | sourcecolumn 48 | WordCount 49 | text 50 | 51 | 52 | title 53 | Word Count 54 | 55 | description 56 | 57 | sourcecolumn 58 | description 59 | text 60 | 61 | 62 | title 63 | Description 64 | 65 | keywords 66 | 67 | sourcecolumn 68 | keywords 69 | text 70 | 71 | 72 | title 73 | Keywords 74 | 75 | publisher 76 | 77 | sourcecolumn 78 | publisher 79 | text 80 | 81 | 82 | title 83 | Publisher 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /Example/XYQuick/Resource/headportrait.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uxyheaven/XYQuick/aa8d546892a2ad7eb654813c38d0bcbdd60fa432/Example/XYQuick/Resource/headportrait.jpg -------------------------------------------------------------------------------- /Example/XYQuick/Resource/icon_facebook.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uxyheaven/XYQuick/aa8d546892a2ad7eb654813c38d0bcbdd60fa432/Example/XYQuick/Resource/icon_facebook.png -------------------------------------------------------------------------------- /Example/XYQuick/Resource/icon_google.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uxyheaven/XYQuick/aa8d546892a2ad7eb654813c38d0bcbdd60fa432/Example/XYQuick/Resource/icon_google.png -------------------------------------------------------------------------------- /Example/XYQuick/Resource/icon_tencent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uxyheaven/XYQuick/aa8d546892a2ad7eb654813c38d0bcbdd60fa432/Example/XYQuick/Resource/icon_tencent.png -------------------------------------------------------------------------------- /Example/XYQuick/Resource/icon_twitter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uxyheaven/XYQuick/aa8d546892a2ad7eb654813c38d0bcbdd60fa432/Example/XYQuick/Resource/icon_twitter.png -------------------------------------------------------------------------------- /Example/XYQuick/Resource/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uxyheaven/XYQuick/aa8d546892a2ad7eb654813c38d0bcbdd60fa432/Example/XYQuick/Resource/image.png -------------------------------------------------------------------------------- /Example/XYQuick/Resource/json0.json: -------------------------------------------------------------------------------- 1 | { 2 | "code": 1, 3 | "country": { 4 | "name": "天朝", 5 | "name_id": "CN" 6 | }, 7 | "area": "华东" 8 | } -------------------------------------------------------------------------------- /Example/XYQuick/Resource/json1.json: -------------------------------------------------------------------------------- 1 | { 2 | "flag": "0", 3 | "msg": "尚未登录,需重新登录!", 4 | "data": null 5 | } -------------------------------------------------------------------------------- /Example/XYQuick/Resource/json2.json: -------------------------------------------------------------------------------- 1 | { 2 | "data": 3 | { 4 | "code": 1, 5 | "country": { 6 | "name": "天朝", 7 | "name_id": "CN" 8 | }, 9 | "area": "华东" 10 | } 11 | } -------------------------------------------------------------------------------- /Example/XYQuick/Resource/json2_2.json: -------------------------------------------------------------------------------- 1 | { 2 | "aa" : "aa", 3 | "bb" : "bb", 4 | "count": 5 | { 6 | "code": 1, 7 | "country": { 8 | "name": "天朝", 9 | "name_id": "CN" 10 | }, 11 | "area": "华东" 12 | } 13 | } -------------------------------------------------------------------------------- /Example/XYQuick/Resource/json3.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "线路", 3 | "list": 4 | [ 5 | { 6 | "code": 1, 7 | "country": { 8 | "name": "天朝", 9 | "name_id": "CN" 10 | }, 11 | "area": "华东" 12 | }, 13 | { 14 | "code": 2, 15 | "country": { 16 | "name": "米国", 17 | "name_id": "USA" 18 | }, 19 | "area": "美洲" 20 | } 21 | ] 22 | } -------------------------------------------------------------------------------- /Example/XYQuick/Resource/json4.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "code": 1, 4 | "country": { 5 | "name": "天朝", 6 | "name_id": "CN" 7 | }, 8 | "area": "华东" 9 | }, 10 | { 11 | "code": 2, 12 | "country": { 13 | "name": "米国", 14 | "name_id": "USA" 15 | }, 16 | "area": "美洲" 17 | } 18 | ] -------------------------------------------------------------------------------- /Example/XYQuick/Resource/json5.json: -------------------------------------------------------------------------------- 1 | { 2 | "data1" : 3 | [ 4 | { 5 | "code": 1, 6 | "country": { 7 | "name": "天朝", 8 | "name_id": "CN" 9 | }, 10 | "area": "华东" 11 | }, 12 | { 13 | "code": 2, 14 | "country": { 15 | "name": "米国", 16 | "name_id": "USA" 17 | }, 18 | "area": "美洲" 19 | } 20 | ], 21 | 22 | "data2" : { 23 | "name": "米国", 24 | "name_id": "USA" 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /Example/XYQuick/Resource/json6.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "线路", 3 | "list":null 4 | } -------------------------------------------------------------------------------- /Example/XYQuick/Resource/json7.json: -------------------------------------------------------------------------------- 1 | { 2 | "name2": "线路", 3 | "list2": 4 | [ 5 | { 6 | "code": 1, 7 | "country": { 8 | "name": "天朝", 9 | "name_id": "CN" 10 | }, 11 | "area": "华东" 12 | }, 13 | { 14 | "code": 2, 15 | "country": { 16 | "name": "米国", 17 | "name_id": "USA" 18 | }, 19 | "area": "美洲" 20 | } 21 | ] 22 | } -------------------------------------------------------------------------------- /Example/XYQuick/Resource/user_currentstandings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uxyheaven/XYQuick/aa8d546892a2ad7eb654813c38d0bcbdd60fa432/Example/XYQuick/Resource/user_currentstandings.png -------------------------------------------------------------------------------- /Example/XYQuick/Test/Test_NSNull.m: -------------------------------------------------------------------------------- 1 | // 2 | // Test_XYJSON.m 3 | // JoinShow 4 | // 5 | // Created by Heaven on 15/11/24. 6 | // Copyright © 2015年 Heaven. All rights reserved. 7 | // 8 | 9 | #import "XYQuick.h" 10 | 11 | #pragma mark - 12 | // ---------------------------------- 13 | // Unit test 14 | // ---------------------------------- 15 | #if (1 == __XY_DEBUG_UNITTESTING__) 16 | 17 | UXY_TEST_CASE( Core, NSNull ) 18 | { 19 | } 20 | 21 | UXY_DESCRIBE( test_array ) 22 | { 23 | UXY_EXPECTED( ((NSArray *)[NSNull null])[1] == nil ); 24 | UXY_EXPECTED( ((NSArray *)[NSNull null]).count == 0 ); 25 | } 26 | 27 | UXY_DESCRIBE( test_dictionary ) 28 | { 29 | UXY_EXPECTED( ((NSDictionary *)[NSNull null])[nil] == nil ); 30 | UXY_EXPECTED( ((NSDictionary *)[NSNull null])[@"aaa"] == nil ); 31 | } 32 | 33 | UXY_DESCRIBE( test_string ) 34 | { 35 | UXY_EXPECTED( [((NSString *)[NSNull null]) substringToIndex:2] == nil ); 36 | } 37 | 38 | UXY_TEST_CASE_END 39 | 40 | #endif -------------------------------------------------------------------------------- /Example/XYQuick/Test/Test_XYCache.m: -------------------------------------------------------------------------------- 1 | // 2 | // Test_Cache.m 3 | // JoinShow 4 | // 5 | // Created by Heaven on 15/12/11. 6 | // Copyright © 2015年 Heaven. All rights reserved. 7 | // 8 | 9 | #import "XYQuick.h" 10 | 11 | #pragma mark - 12 | #if (1 == __XY_DEBUG_UNITTESTING__) 13 | // ---------------------------------- 14 | // Unit test 15 | // ---------------------------------- 16 | 17 | UXY_TEST_CASE( Core, XYCache ) 18 | { 19 | // TODO( "test case" ) 20 | } 21 | 22 | UXY_DESCRIBE( test1 ) 23 | { 24 | [[XYFileCache sharedInstance] setObject:@"aaaaaa" forKey:@"aa"]; 25 | NSData *data = [[XYFileCache sharedInstance] objectForKey:@"aa"]; 26 | NSString *str = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; 27 | UXY_EXPECTED( [str isEqualToString:@"aaaaaa"] ); 28 | } 29 | 30 | 31 | UXY_TEST_CASE_END 32 | #endif -------------------------------------------------------------------------------- /Example/XYQuick/Test/Test_XYSandbox.m: -------------------------------------------------------------------------------- 1 | // 2 | // Test_XYJSON.m 3 | // JoinShow 4 | // 5 | // Created by Heaven on 15/11/24. 6 | // Copyright © 2015年 Heaven. All rights reserved. 7 | // 8 | 9 | #import "XYQuick.h" 10 | 11 | #pragma mark - 12 | // ---------------------------------- 13 | // Unit test 14 | // ---------------------------------- 15 | #if (1 == __XY_DEBUG_UNITTESTING__) 16 | 17 | UXY_TEST_CASE( Core, XYSandbox ) 18 | { 19 | } 20 | 21 | UXY_DESCRIBE( test_touchFile ) 22 | { 23 | NSString *path = [[XYSandbox docPath] stringByAppendingString:@"/aaa/bbb.json"]; 24 | [[NSFileManager defaultManager] removeItemAtPath:path error:nil]; 25 | [XYSandbox touchFile:path]; 26 | UXY_EXPECTED([[NSFileManager defaultManager] fileExistsAtPath:path] == YES ); 27 | } 28 | 29 | 30 | UXY_TEST_CASE_END 31 | 32 | #endif -------------------------------------------------------------------------------- /Example/XYQuick/Test/Test_XYSystem.m: -------------------------------------------------------------------------------- 1 | // 2 | // Test_XYJSON.m 3 | // JoinShow 4 | // 5 | // Created by Heaven on 15/11/24. 6 | // Copyright © 2015年 Heaven. All rights reserved. 7 | // 8 | 9 | #import "XYQuick.h" 10 | 11 | #pragma mark - 12 | #if (1 == __XY_DEBUG_UNITTESTING__) 13 | // ---------------------------------- 14 | // Unit test 15 | // ---------------------------------- 16 | 17 | UXY_TEST_CASE(Core, XYSystem) 18 | { 19 | // TODO( "test case" ) 20 | } 21 | 22 | UXY_DESCRIBE(test1) 23 | { 24 | UXY_EXPECTED([[XYSystemInfo sharedInstance] deviceIPAdress].length > 0); 25 | } 26 | 27 | UXY_DESCRIBE(test2) 28 | { 29 | } 30 | 31 | 32 | UXY_TEST_CASE_END 33 | #endif -------------------------------------------------------------------------------- /Example/XYQuick/Test/Test_XYThead.m: -------------------------------------------------------------------------------- 1 | // 2 | // Test_XYJSON.m 3 | // JoinShow 4 | // 5 | // Created by Heaven on 15/11/24. 6 | // Copyright © 2015年 Heaven. All rights reserved. 7 | // 8 | 9 | #import "XYQuick.h" 10 | 11 | #pragma mark - 12 | #if (1 == __XY_DEBUG_UNITTESTING__) 13 | // ---------------------------------- 14 | // Unit test 15 | // ---------------------------------- 16 | 17 | UXY_TEST_CASE( Core, XYThead ) 18 | { 19 | // TODO( "test case" ) 20 | } 21 | 22 | UXY_DESCRIBE( test1 ) 23 | { 24 | __block int step = 1; 25 | dispatch_after( [XYGCD seconds:1], [XYGCD sharedInstance].backConcurrentQueue, ^{ 26 | { 27 | step = 3; 28 | } 29 | }); 30 | step = 2; 31 | } 32 | 33 | UXY_DESCRIBE( test2 ) 34 | { 35 | __block int step = 1; 36 | dispatch_async( [XYGCD sharedInstance].backConcurrentQueue, ^{ 37 | { 38 | step = 3; 39 | dispatch_async( dispatch_get_main_queue(), ^{ 40 | { 41 | step = 4; 42 | } 43 | }); 44 | } 45 | }); 46 | step = 2; 47 | } 48 | 49 | 50 | UXY_TEST_CASE_END 51 | #endif -------------------------------------------------------------------------------- /Example/XYQuick/View/PaintCodeView.h: -------------------------------------------------------------------------------- 1 | // 2 | // PaintCodeView.h 3 | // JoinShow 4 | // 5 | // Created by Heaven on 14-2-24. 6 | // Copyright (c) 2014年 Heaven. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PaintCodeView : UIView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/XYQuick/View/Test2View.h: -------------------------------------------------------------------------------- 1 | // 2 | // Test2View.h 3 | // JoinShow 4 | // 5 | // Created by Heaven on 13-7-31. 6 | // Copyright (c) 2013年 Heaven. All rights reserved. 7 | // 8 | 9 | #import "TestView.h" 10 | 11 | @interface Test2View : TestView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/XYQuick/View/Test2View.m: -------------------------------------------------------------------------------- 1 | // 2 | // Test2View.m 3 | // JoinShow 4 | // 5 | // Created by Heaven on 13-7-31. 6 | // Copyright (c) 2013年 Heaven. All rights reserved. 7 | // 8 | 9 | #import "Test2View.h" 10 | #import "XYQuick.h" 11 | 12 | 13 | @implementation Test2View 14 | 15 | - (id)initWithFrame:(CGRect)frame 16 | { 17 | self = [super initWithFrame:frame]; 18 | if (self) { 19 | // Initialization code 20 | [self test]; 21 | } 22 | return self; 23 | } 24 | 25 | /* 26 | // Only override drawRect: if you perform custom drawing. 27 | // An empty implementation adversely affects performance during animation. 28 | - (void)drawRect:(CGRect)rect 29 | { 30 | // Drawing code 31 | } 32 | */ 33 | -(void)dealloc{ 34 | NSLogD(@"%s, %@", __FUNCTION__, [super class]); 35 | } 36 | @end 37 | -------------------------------------------------------------------------------- /Example/XYQuick/View/TestView.h: -------------------------------------------------------------------------------- 1 | // 2 | // TestView.h 3 | // JoinShow 4 | // 5 | // Created by Heaven on 13-7-31. 6 | // Copyright (c) 2013年 Heaven. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TestView : UIView 12 | 13 | @property (nonatomic, strong) UILabel *label1; 14 | @property (nonatomic, strong) UIImageView *img1; 15 | 16 | - (void)test; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Example/XYQuick/View/TestView.m: -------------------------------------------------------------------------------- 1 | // 2 | // TestView.m 3 | // JoinShow 4 | // 5 | // Created by Heaven on 13-7-31. 6 | // Copyright (c) 2013年 Heaven. All rights reserved. 7 | // 8 | 9 | #import "TestView.h" 10 | #import "XYQuick.h" 11 | 12 | @implementation TestView 13 | 14 | - (id)initWithFrame:(CGRect)frame 15 | { 16 | self = [super initWithFrame:frame]; 17 | if (self) { 18 | // Initialization code 19 | UILabel *tempLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 50, 30)]; 20 | tempLabel.backgroundColor = [UIColor redColor]; 21 | tempLabel.textColor = [UIColor whiteColor]; 22 | tempLabel.text = @"-1"; 23 | _label1 = tempLabel; 24 | [self addSubview:tempLabel]; 25 | 26 | UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(50, 0, 50, 50)]; 27 | _img1 = imgView; 28 | [self addSubview:imgView]; 29 | } 30 | return self; 31 | } 32 | 33 | /* 34 | // Only override drawRect: if you perform custom drawing. 35 | // An empty implementation adversely affects performance during animation. 36 | - (void)drawRect:(CGRect)rect 37 | { 38 | // Drawing code 39 | } 40 | */ 41 | 42 | -(void)dealloc 43 | { 44 | } 45 | 46 | - (void)test{ 47 | NSLog(@"%@", [self class]); 48 | } 49 | @end 50 | -------------------------------------------------------------------------------- /Example/XYQuick/XYAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // XYAppDelegate.h 3 | // XYQuick 4 | // 5 | // Created by uxyheaven on 04/22/2016. 6 | // Copyright (c) 2016 uxyheaven. All rights reserved. 7 | // 8 | 9 | @import UIKit; 10 | 11 | @interface XYAppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Example/XYQuick/XYAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // XYAppDelegate.m 3 | // XYQuick 4 | // 5 | // Created by uxyheaven on 04/22/2016. 6 | // Copyright (c) 2016 uxyheaven. All rights reserved. 7 | // 8 | 9 | #import "XYAppDelegate.h" 10 | #import "XYModuleManager.h" 11 | 12 | @implementation XYAppDelegate 13 | 14 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 15 | { 16 | // Override point for customization after application launch. 17 | [[XYModuleManager sharedInstance] hookAppDelegate:self]; 18 | return YES; 19 | } 20 | 21 | - (void)applicationWillResignActive:(UIApplication *)application 22 | { 23 | // 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. 24 | // 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. 25 | } 26 | 27 | - (void)applicationDidEnterBackground:(UIApplication *)application 28 | { 29 | // 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. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application 34 | { 35 | // 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. 36 | } 37 | 38 | - (void)applicationDidBecomeActive:(UIApplication *)application 39 | { 40 | // 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. 41 | } 42 | 43 | - (void)applicationWillTerminate:(UIApplication *)application 44 | { 45 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /Example/XYQuick/XYQuick-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /Example/XYQuick/XYQuick-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_5_0 10 | #warning "This project uses features only available in iOS SDK 5.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | @import UIKit; 15 | @import Foundation; 16 | #endif 17 | -------------------------------------------------------------------------------- /Example/XYQuick/XYViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // XYViewController.h 3 | // XYQuick 4 | // 5 | // Created by uxyheaven on 04/22/2016. 6 | // Copyright (c) 2016 uxyheaven. All rights reserved. 7 | // 8 | 9 | @import UIKit; 10 | 11 | @interface XYViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/XYQuick/XYViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // XYViewController.m 3 | // XYQuick 4 | // 5 | // Created by uxyheaven on 04/22/2016. 6 | // Copyright (c) 2016 uxyheaven. All rights reserved. 7 | // 8 | 9 | #import "XYViewController.h" 10 | 11 | @interface XYViewController () 12 | 13 | @end 14 | 15 | @implementation XYViewController 16 | 17 | - (void)viewDidLoad 18 | { 19 | [super viewDidLoad]; 20 | // Do any additional setup after loading the view, typically from a nib. 21 | } 22 | 23 | - (void)didReceiveMemoryWarning 24 | { 25 | [super didReceiveMemoryWarning]; 26 | // Dispose of any resources that can be recreated. 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /Example/XYQuick/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Example/XYQuick/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // XYQuick 4 | // 5 | // Created by uxyheaven on 04/22/2016. 6 | // Copyright (c) 2016 uxyheaven. All rights reserved. 7 | // 8 | 9 | @import UIKit; 10 | #import "XYAppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) 13 | { 14 | @autoreleasepool { 15 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([XYAppDelegate class])); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 uxyheaven 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /Pod/Assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uxyheaven/XYQuick/aa8d546892a2ad7eb654813c38d0bcbdd60fa432/Pod/Assets/.gitkeep -------------------------------------------------------------------------------- /Pod/Classes/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uxyheaven/XYQuick/aa8d546892a2ad7eb654813c38d0bcbdd60fa432/Pod/Classes/.gitkeep -------------------------------------------------------------------------------- /Pod/Classes/XYQuick.h: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | #import "XYQuick_Predefine.h" // 预编译 31 | 32 | #import "XYQuick_Core.h" // 基础类 33 | #import "XYQuick_UI.h" // 界面 34 | #import "XYQuick_Event.h" // 事件 35 | 36 | #import 37 | @interface XYQuick : NSObject 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /Pod/Classes/XYQuick.m: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | #import "XYQuick.h" 31 | 32 | @implementation XYQuick 33 | 34 | + (void)load 35 | { 36 | fprintf(stderr, " // __ __ ____ _ _\n"); 37 | fprintf(stderr, " // \\ \\/ / /\\_/\\ /___ \\ _ _ (_) ___ | | __\n"); 38 | fprintf(stderr, " // \\ / \\_ _/ // / / | | | | | | / __| | |/ /\n"); 39 | fprintf(stderr, " // / \\ / \\ / \\_/ / | |_| | | | | (__ | <\n"); 40 | fprintf(stderr, " // /_/\\_\\ \\_/ \\___,_\\ \\__,_| |_| \\___| |_|\\_\\\n"); 41 | fprintf(stderr, " //\n"); 42 | fprintf(stderr, " // Verson: %s. Copyright (C) Heaven.\n", __XYQUICK_VERSION__); 43 | fprintf(stderr, " // https://github.com/uxyheaven/XYQuick\n"); 44 | fprintf(stderr, " \n"); 45 | fprintf(stderr, " =============================================================\n"); 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /Pod/Classes/core/XYQuick_Core.h: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | 31 | #import 32 | 33 | // Modules 34 | #import "XYThread.h" // GCD 35 | #import "XYTimer.h" // 定时器 36 | #import "XYSystemInfo.h" // 系统信息 37 | #import "XYSandbox.h" // 沙箱 38 | #import "XYJSON.h" // json to object , object to json 39 | #import "XYAOP.h" // aop 40 | #import "XYRuntime.h" // runtime 41 | #import "XYBlackMagic.h" // 黑魔法 42 | #import "XYReachability.h" // 网络可达性检测 43 | #import "XYBaseBuilder.h" // 通用建造者 44 | 45 | #import "XYCommonDefine.h" 46 | #import "XYCommon.h" // 待分解 47 | 48 | #import "XYQuick_Cache.h" // 缓存模块 49 | #import "XYQuick_Debug.h" // 调试模块 50 | 51 | // Extensions 52 | #import "NSObject+XY.h" 53 | #import "NSArray+XY.h" 54 | #import "NSDictionary+XY.h" 55 | #import "NSString+XY.h" 56 | #import "NSData+XY.h" 57 | #import "NSDate+XY.h" 58 | #import "NSNumber+XY.h" 59 | #import "NSSet+XY.h" 60 | #import "NSNull+XY.h" 61 | 62 | -------------------------------------------------------------------------------- /Pod/Classes/core/extension/NSArray+XY.h: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | 31 | #import "XYQuick_Predefine.h" 32 | #import 33 | #pragma mark - 34 | 35 | typedef NSMutableArray * (^NSArrayAppendBlock)( id obj ); 36 | typedef NSMutableArray * (^NSMutableArrayAppendBlock)( id obj ); 37 | 38 | #pragma mark - 39 | 40 | @interface NSArray(XYExtension) 41 | 42 | - (NSArray *)uxy_head:(NSUInteger)count; 43 | - (NSArray *)uxy_tail:(NSUInteger)count; 44 | 45 | - (id)uxy_safeObjectAtIndex:(NSInteger)index; 46 | - (NSArray *)uxy_safeSubarrayWithRange:(NSRange)range; 47 | - (NSArray *)uxy_safeSubarrayFromIndex:(NSUInteger)index; 48 | - (NSArray *)uxy_safeSubarrayWithCount:(NSUInteger)count; 49 | 50 | - (NSInteger)uxy_indexOfString:(NSString *)string; 51 | 52 | @end 53 | 54 | #pragma mark - 55 | 56 | @interface NSMutableArray(XYExtension) 57 | 58 | - (void)uxy_safeAddObject:(id)anObject; 59 | 60 | + (NSMutableArray *)uxy_nonRetainingArray; 61 | 62 | - (NSMutableArray *)uxy_pushHead:(NSObject *)obj; 63 | - (NSMutableArray *)uxy_pushHeadN:(NSArray *)all; 64 | - (NSMutableArray *)uxy_popTail; 65 | - (NSMutableArray *)uxy_popTailN:(NSUInteger)n; 66 | 67 | - (NSMutableArray *)uxy_pushTail:(NSObject *)obj; 68 | - (NSMutableArray *)uxy_pushTailN:(NSArray *)all; 69 | - (NSMutableArray *)uxy_popHead; 70 | - (NSMutableArray *)uxy_popHeadN:(NSUInteger)n; 71 | 72 | - (NSMutableArray *)uxy_keepHead:(NSUInteger)n; 73 | - (NSMutableArray *)uxy_keepTail:(NSUInteger)n; 74 | 75 | @end 76 | -------------------------------------------------------------------------------- /Pod/Classes/core/extension/NSData+XY.h: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | 31 | #import "XYQuick_Predefine.h" 32 | #import 33 | #pragma mark - 34 | 35 | @interface NSData (XYExtension) 36 | 37 | @property (nonatomic, readonly, strong) NSData *uxy_MD5Data; 38 | @property (nonatomic, readonly, copy) NSString *uxy_MD5String; 39 | 40 | @property (nonatomic, readonly, strong) NSData *uxy_SHA1Data; 41 | @property (nonatomic, readonly, copy) NSString *uxy_SHA1String; 42 | 43 | /// base64加码 44 | @property (nonatomic, readonly, copy) NSString *uxy_BASE64Encrypted; 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Pod/Classes/core/extension/NSDictionary+XY.h: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | 31 | #import "XYQuick_Predefine.h" 32 | #import 33 | #pragma mark - 34 | 35 | @interface NSDictionary (XYExtension) 36 | 37 | + (NSMutableDictionary *)uxy_nonRetainDictionary; 38 | 39 | - (id)uxy_safeObjectForKey:(id)aKey; 40 | 41 | @end 42 | 43 | @interface NSMutableDictionary (XYExtension) 44 | 45 | - (void)uxy_safeSetObject:(id)anObject forKey:(id )aKey; 46 | - (void)uxy_safeSetObject:(id)obj forKeyedSubscript:(id )key; 47 | - (void)uxy_safeRemoveObjectForKey:(id)aKey; 48 | 49 | @end 50 | 51 | 52 | -------------------------------------------------------------------------------- /Pod/Classes/core/extension/NSDictionary+XY.m: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | 31 | #import "NSDictionary+XY.h" 32 | 33 | static const void *__XYRetainNoOp(CFAllocatorRef allocator, const void *value) { return value; } 34 | static void __XYReleaseNoOp(CFAllocatorRef allocator, const void *value) { } 35 | 36 | @implementation NSDictionary (XYExtension) 37 | 38 | + (NSMutableDictionary *)uxy_nonRetainDictionary 39 | { 40 | CFDictionaryKeyCallBacks keyCallbacks = kCFTypeDictionaryKeyCallBacks; 41 | CFDictionaryValueCallBacks callbacks = kCFTypeDictionaryValueCallBacks; 42 | callbacks.retain = __XYRetainNoOp; 43 | callbacks.release = __XYReleaseNoOp; 44 | 45 | return (__bridge_transfer NSMutableDictionary*)CFDictionaryCreateMutable(nil, 0, &keyCallbacks, &callbacks); 46 | } 47 | 48 | - (id)uxy_safeObjectForKey:(id)aKey 49 | { 50 | return aKey ? self[aKey] :nil; 51 | } 52 | 53 | @end 54 | 55 | @implementation NSMutableDictionary (XYExtension) 56 | 57 | - (void)uxy_safeSetObject:(id)anObject forKey:(id )aKey 58 | { 59 | aKey ? (self[aKey] = anObject) : nil; 60 | } 61 | 62 | - (void)uxy_safeSetObject:(id)obj forKeyedSubscript:(id )key 63 | { 64 | key ? ([self setObject:obj forKeyedSubscript:key]) : nil; 65 | } 66 | 67 | - (void)uxy_safeRemoveObjectForKey:(id)aKey 68 | { 69 | aKey ? [self removeObjectForKey:aKey]: nil; 70 | } 71 | 72 | @end 73 | 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /Pod/Classes/core/extension/NSNull+XY.h: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | 31 | #import "XYQuick_Predefine.h" 32 | #import 33 | #pragma mark - 34 | 35 | #define XYNullObjects @[@"",@0,@{},@[]] 36 | 37 | @interface NSNull (XYExtension) 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /Pod/Classes/core/extension/NSNumber+XY.h: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | 31 | #import "XYQuick_Predefine.h" 32 | #import 33 | #pragma mark - 34 | 35 | @interface NSNumber (XYExtension) 36 | 37 | @property (nonatomic, readonly, strong) NSDate *uxy_dateValue; 38 | 39 | - (NSString *)uxy_stringWithDateFormat:(NSString *)format; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /Pod/Classes/core/extension/NSNumber+XY.m: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | 31 | #import "NSNumber+XY.h" 32 | #import "NSDate+XY.h" 33 | 34 | @implementation NSNumber (XYExtension) 35 | 36 | @dynamic uxy_dateValue; 37 | 38 | - (NSDate *)uxy_dateValue 39 | { 40 | return [NSDate dateWithTimeIntervalSince1970:self.doubleValue]; 41 | } 42 | 43 | - (NSString *)uxy_stringWithDateFormat:(NSString *)format 44 | { 45 | // thanks @lancy, changed: "NSDate depend on NSNumber" to "NSNumber depend on NSDate" 46 | return [[NSDate dateWithTimeIntervalSince1970:[self doubleValue]] uxy_stringWithDateFormat:format]; 47 | } 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /Pod/Classes/core/extension/NSSet+XY.h: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | 31 | #import "XYQuick_Predefine.h" 32 | #import 33 | #pragma mark - 34 | 35 | @interface NSSet (XYExtension) 36 | 37 | + (NSMutableDictionary *)uxy_nonRetainSet; 38 | 39 | @end 40 | 41 | @interface NSMutableSet (XYExtension) 42 | 43 | - (void)uxy_safeAddObject:(id)object; 44 | - (void)uxy_safeRemoveObject:(id)object; 45 | 46 | @end 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Pod/Classes/core/extension/NSSet+XY.m: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | 31 | #import "NSSet+XY.h" 32 | 33 | static const void *__XYRetainNoOp(CFAllocatorRef allocator, const void *value) { return value; } 34 | static void __XYReleaseNoOp(CFAllocatorRef allocator, const void *value) { } 35 | 36 | @implementation NSSet (XYExtension) 37 | 38 | + (NSMutableSet *)uxy_nonRetainSet 39 | { 40 | CFSetCallBacks callbacks = kCFTypeSetCallBacks; 41 | callbacks.retain = __XYRetainNoOp; 42 | callbacks.release = __XYReleaseNoOp; 43 | 44 | return (__bridge_transfer NSMutableSet*)CFSetCreateMutable(nil, 0, &callbacks); 45 | } 46 | 47 | 48 | @end 49 | 50 | @implementation NSMutableSet (XYExtension) 51 | 52 | - (void)uxy_safeAddObject:(id)object 53 | { 54 | if (object) 55 | { 56 | [self addObject:object]; 57 | } 58 | } 59 | 60 | - (void)uxy_safeRemoveObject:(id)object 61 | { 62 | if (object) 63 | { 64 | [self removeObject:object]; 65 | } 66 | } 67 | 68 | @end 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /Pod/Classes/core/modules/XYAOP.h: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | // This file Copy fromAOP-for-Objective-C. 31 | 32 | #import "XYQuick_Predefine.h" 33 | #import 34 | #pragma mark - 35 | 36 | typedef void(^XYAOP_block)(NSInvocation *invocation); 37 | 38 | @interface XYAOP : NSObject 39 | 40 | + (NSString *)interceptClass:(Class)aClass beforeExecutingSelector:(SEL)selector usingBlock:(XYAOP_block)block; 41 | + (NSString *)interceptClass:(Class)aClass afterExecutingSelector:(SEL)selector usingBlock:(XYAOP_block)block; 42 | + (NSString *)interceptClass:(Class)aClass insteadExecutingSelector:(SEL)selector usingBlock:(XYAOP_block)block; 43 | 44 | + (void)removeInterceptorWithIdentifier:(NSString *)identifier; 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Pod/Classes/core/modules/XYBaseBuilder.h: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | 31 | #import "XYQuick_Predefine.h" 32 | #import 33 | #pragma mark - 34 | 35 | /* 36 | @protocol XYBaseBuilder 37 | // 返回对象是否成功构建,在这里做条件判断 38 | - (BOOL)isBuildRight; 39 | @end 40 | */ 41 | 42 | // 建造者基类, 抽象的建造者 43 | @interface XYBaseBuilder : NSObject 44 | 45 | /** 46 | * @brief 生成产品 47 | * @param clazz 产品的类 48 | * @param block builder构造的block 49 | * @return 返回产品 50 | */ 51 | + (id)productWithClass:(Class)clazz builder:(void(^)(id builder))block; 52 | 53 | /** 54 | * @brief 生成产品 55 | * @param block builder构造的block, 需要在这里返回产品的实例 56 | * @return 返回产品 57 | */ 58 | + (id)productWithBuilder:(id(^)(id builder))block; 59 | 60 | 61 | /// 生成产品, 请override这个方法做验证 62 | - (id)build; 63 | 64 | @end 65 | 66 | 67 | /* 待解决id问题再实现 68 | @interface NSObject (UXYBuilder) 69 | + (id)objectWithUXYBuilder:(void(^)(id builder))block; 70 | @end 71 | */ -------------------------------------------------------------------------------- /Pod/Classes/core/modules/XYBlackMagic.h: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | 31 | #import "XYQuick_Predefine.h" 32 | #import 33 | #pragma mark - 34 | 35 | #pragma mark - others 36 | #ifndef XYBlackMagic__Macro 37 | #define XYBlackMagic__Macro 38 | static void __uxy_blockCleanUp(__strong void(^*block)(void)) { 39 | (*block)(); 40 | } 41 | #endif 42 | 43 | // 当当前作用域结束时自动执行{}里面的方法 44 | #define uxy_onFuncExit \ 45 | __strong void(^block)(void) __attribute__((cleanup(__uxy_blockCleanUp), unused)) = ^ 46 | 47 | /* 48 | #define keypath2(OBJ, PATH) \ 49 | (((NO && (OBJ.PATH, NO)), PATH)) 50 | */ 51 | #pragma mark - XYBlackMagic 52 | @interface XYBlackMagic : NSObject 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /Pod/Classes/core/modules/XYBlackMagic.m: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | 31 | #import "XYBlackMagic.h" 32 | 33 | @implementation XYBlackMagic 34 | 35 | + (void)load 36 | { 37 | uxy_onFuncExit{ 38 | ; 39 | }; 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /Pod/Classes/core/modules/XYThread.m: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | // This file Copy from Samurai. 31 | 32 | #import "XYThread.h" 33 | 34 | #pragma mark - 35 | 36 | @interface XYGCD() 37 | 38 | @property (nonatomic, strong) dispatch_queue_t foreQueue; 39 | @property (nonatomic, strong) dispatch_queue_t backSerialQueue; 40 | @property (nonatomic, strong) dispatch_queue_t backConcurrentQueue; 41 | @property (nonatomic, strong) dispatch_queue_t writeFileQueue; 42 | 43 | @end 44 | 45 | @implementation XYGCD 46 | 47 | static id __singleton__objc__token; 48 | static dispatch_once_t __singleton__token__token; 49 | + (instancetype)sharedInstance 50 | { 51 | dispatch_once(&__singleton__token__token, ^{ __singleton__objc__token = [[self alloc] init]; }); 52 | return __singleton__objc__token; 53 | } 54 | 55 | + (void)purgeSharedInstance 56 | { 57 | __singleton__objc__token = nil; 58 | __singleton__token__token = 0; 59 | } 60 | 61 | - (id)init 62 | { 63 | self = [super init]; 64 | if ( self ) 65 | { 66 | _foreQueue = dispatch_get_main_queue(); 67 | _backSerialQueue = dispatch_queue_create( "com.XY.backSerialQueue", DISPATCH_QUEUE_SERIAL ); 68 | _backConcurrentQueue = dispatch_queue_create( "com.XY.backConcurrentQueue", DISPATCH_QUEUE_CONCURRENT ); 69 | _writeFileQueue = dispatch_queue_create( "com.XY.writeFileQueue", DISPATCH_QUEUE_SERIAL ); 70 | } 71 | 72 | return self; 73 | } 74 | 75 | + (dispatch_time_t)seconds:(CGFloat)f 76 | { 77 | return dispatch_time( DISPATCH_TIME_NOW, f * 1ull * NSEC_PER_SEC ); 78 | } 79 | @end 80 | 81 | 82 | -------------------------------------------------------------------------------- /Pod/Classes/core/modules/cache/XYAutoCoding.h: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | // This file Copy from AutoCoding. 31 | 32 | #import "XYQuick_Predefine.h" 33 | #import 34 | #pragma mark - 35 | 36 | @interface XYAutoCoding : NSObject 37 | 38 | @end 39 | 40 | #pragma mark- category AutoCoding 41 | // copy frome https://github.com/nicklockwood/AutoCoding 42 | // 序列化 2.2 43 | @interface NSObject (AutoCoding) 44 | 45 | //coding 46 | 47 | + (NSDictionary *)uxy_codableProperties; 48 | - (void)uxy_setWithCoder:(NSCoder *)aDecoder; 49 | 50 | //property access 51 | 52 | - (NSDictionary *)uxy_codableProperties; 53 | - (NSDictionary *)uxy_dictionaryRepresentation; 54 | 55 | //loading / saving 56 | + (instancetype)uxy_objectWithContentsOfFile:(NSString *)path; 57 | - (BOOL)writeToFile:(NSString *)filePath atomically:(BOOL)useAuxiliaryFile; 58 | 59 | @end -------------------------------------------------------------------------------- /Pod/Classes/core/modules/cache/XYCacheProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | 31 | @protocol XYCacheProtocol 32 | 33 | - (BOOL)hasObjectForKey:(id)key; 34 | 35 | - (id)objectForKey:(id)key; 36 | - (void)setObject:(id)object forKey:(id)key; 37 | 38 | - (void)removeObjectForKey:(id)key; 39 | - (void)removeAllObjects; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /Pod/Classes/core/modules/cache/XYFileCache.h: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | 31 | #import "XYQuick_Predefine.h" 32 | #import 33 | #import "XYCacheProtocol.h" 34 | #pragma mark - 35 | 36 | #define XYFileCache_fileExpires (7 * 24 * 60 * 60) 37 | 38 | @interface XYFileCache : NSObject 39 | 40 | /// 路径 41 | @property (nonatomic, copy, readonly) NSString *diskCachePath; 42 | 43 | /// The maximum size of the cache, in bytes 44 | @property (assign, nonatomic) NSUInteger maxCacheSize; 45 | /// 有效期, 默认1周 46 | @property (nonatomic, assign) NSTimeInterval maxCacheAge; 47 | 48 | + (instancetype)sharedInstance; 49 | 50 | /// 用新路径建立一个cache 51 | - (id)initWithNamespace:(NSString *)ns; 52 | 53 | /// 返回key对应的文件名 54 | - (NSString *)fileNameForKey:(NSString *)key; 55 | /// 返回类文件 56 | - (id)objectForKey:(NSString *)key objectClass:(Class)aClass; 57 | 58 | /// 清除当前 diskCachePath 所有的文件 59 | - (void)clearDisk; 60 | 61 | /// 清除当前 diskCachePath 所有的文件 62 | - (void)clearDiskOnCompletion:(void(^)(void))completion; 63 | 64 | /// 清除当前 diskCachePath 所有过期的文件 65 | - (void)cleanDisk; 66 | 67 | /// 清除当前 diskCachePath 所有过期的文件 68 | - (void)cleanDiskWithCompletionBlock:(void(^)(void))completionBlock; 69 | 70 | /// 返回cache 大小 71 | - (NSUInteger)getSize; 72 | 73 | /// 返回cache 数量 74 | - (NSUInteger)getDiskCount; 75 | 76 | #pragma mark - XYCacheProtocol 协议里的方法 77 | - (BOOL)hasObjectForKey:(NSString *)key; 78 | - (id)objectForKey:(NSString *)key; 79 | - (void)setObject:(id)object forKey:(NSString *)key; 80 | - (void)removeObjectForKey:(NSString *)key; 81 | - (void)removeAllObjects; 82 | 83 | @end 84 | -------------------------------------------------------------------------------- /Pod/Classes/core/modules/cache/XYMemoryCache.h: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | 31 | #import "XYQuick_Predefine.h" 32 | #import 33 | #import "XYCacheProtocol.h" 34 | #pragma mark - 35 | 36 | @interface XYMemoryCache : NSObject 37 | 38 | + (instancetype)sharedInstance; 39 | 40 | @property (nonatomic, assign) BOOL clearWhenMemoryLow; // default is YES 41 | @property (nonatomic, assign) NSUInteger maxCacheCount; // default is 48 42 | 43 | @property (nonatomic, assign, readonly) NSUInteger cachedCount; 44 | @property (atomic, strong, readonly) NSMutableArray *cacheKeys; 45 | @property (atomic, strong, readonly) NSMutableDictionary *cacheObjs; 46 | 47 | 48 | // XYCacheProtocol 协议方法 49 | - (BOOL)hasObjectForKey:(id)key; 50 | 51 | - (id)objectForKey:(id)key; 52 | - (void)setObject:(id)object forKey:(id)key; 53 | 54 | - (void)removeObjectForKey:(id)key; 55 | - (void)removeAllObjects; 56 | 57 | // 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /Pod/Classes/core/modules/cache/XYQuick_Cache.h: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | 31 | #import "XYCacheProtocol.h" // cache协议 32 | 33 | #import "XYMemoryCache.h" // 内存缓存 34 | #import "XYFileCache.h" // 文件缓存 35 | 36 | #import "XYUserDefaults.h" // UserDefaults 37 | #import "XYAutoCoding.h" // 归档 -------------------------------------------------------------------------------- /Pod/Classes/core/modules/cache/XYUserDefaults.h: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | 31 | #import "XYQuick_Predefine.h" 32 | #import 33 | #import "XYCacheProtocol.h" 34 | #pragma mark - 35 | 36 | @interface XYUserDefaults : NSObject 37 | 38 | + (instancetype)sharedInstance; 39 | + (void)purgeSharedInstance; 40 | 41 | @end 42 | 43 | @interface NSObject(XYUserDefaults) 44 | 45 | // for key value 46 | 47 | + (id)userDefaultsRead:(NSString *)key; 48 | - (id)userDefaultsRead:(NSString *)key; 49 | 50 | + (void)userDefaultsWrite:(id)value forKey:(NSString *)key; 51 | - (void)userDefaultsWrite:(id)value forKey:(NSString *)key; 52 | 53 | + (void)userDefaultsRemove:(NSString *)key; 54 | - (void)userDefaultsRemove:(NSString *)key; 55 | 56 | // for object 57 | 58 | + (id)readObject; 59 | + (id)readObjectForKey:(NSString *)key; 60 | 61 | + (void)saveObject:(id)obj; 62 | + (void)saveObject:(id)obj forKey:(NSString *)key; 63 | 64 | + (void)removeObject; 65 | + (void)removeObjectForKey:(NSString *)key; 66 | 67 | @end 68 | 69 | -------------------------------------------------------------------------------- /Pod/Classes/core/modules/debug/XYPerformance.h: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | // This file Copy from bee Framework. 31 | 32 | #import "XYQuick_Predefine.h" 33 | #import 34 | #pragma mark - 35 | 36 | #if (1 == __XY_PERFORMANCE__) 37 | 38 | #define PERF_TIME( block ) { _PERF_ENTER(__PRETTY_FUNCTION__, __LINE__); block; _PERF_LEAVE(__PRETTY_FUNCTION__, __LINE__); } 39 | #define PERF_ENTER_( __tag) [[XYPerformance sharedInstance] enter:__tag]; 40 | #define PERF_LEAVE_( __tag) [[XYPerformance sharedInstance] leave:__tag]; 41 | 42 | #else 43 | 44 | #define PERF_TIME( block ) { block } 45 | #define PERF_ENTER_( __tag) 46 | #define PERF_LEAVE_( __tag) 47 | 48 | #endif 49 | 50 | #pragma mark - 51 | 52 | #if (1 == __XY_PERFORMANCE__) 53 | 54 | @interface XYPerformance : NSObject 55 | 56 | + (instancetype)sharedInstance; 57 | + (void)purgeSharedInstance; 58 | 59 | - (void)enter:(NSString *)tag; 60 | - (void)leave:(NSString *)tag; 61 | 62 | @end 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /Pod/Classes/core/modules/debug/XYQuick_Debug.h: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | // This file Copy from bee Framework. 31 | 32 | #pragma mark - 33 | /* 34 | * 说明 仅在debug下才显示nslog 35 | */ 36 | #if (1 == __XY_DEBUG__) 37 | #undef NSLogD 38 | #undef NSLogDD 39 | #define NSLogD(fmt, ...) {NSLog((@"%s [Line %d] DEBUG: \n" fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);} 40 | #define NSLogDD NSLogD(@"%@", @""); 41 | #define NSLogDSelf NSLogD(@"Class: %@", NSStringFromClass([self class])); 42 | #else 43 | #define NSLogD(format, ...) 44 | #define NSLogDD 45 | #define NSLogDSelf 46 | #define NSLog(...) {} 47 | #endif 48 | 49 | #pragma mark - 50 | // Modules 51 | #import "XYPerformance.h" // 性能分析 52 | #import "XYDebugToy.h" // 一些debug用的小工具 53 | #import "XYUnitTest.h" // 单元测试模块 54 | 55 | // Extensions 56 | 57 | #pragma mark - 58 | -------------------------------------------------------------------------------- /Pod/Classes/event/XYQuick_Event.h: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | 31 | #import 32 | 33 | // todo 统一event 34 | 35 | // Modules 36 | #import "XYSignal.h" // 责任链信号 37 | #import "XYMulticastDelegate.h" // 多路委托 38 | #import "XYNotification.h" // Notification的封装 39 | #import "XYKVO.h" // KVO的封装 40 | #import "XYFlyweightTransmit.h" // 轻量级的数据事件传递 41 | // Extensions 42 | 43 | -------------------------------------------------------------------------------- /Pod/Classes/event/modules/XYFlyweightTransmit.h: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | 31 | #import "XYQuick_Predefine.h" 32 | #pragma mark - 33 | 34 | // 解决a知道b,b不知道a, b传数据给a的情况 35 | 36 | @interface NSObject (XYFlyweightTransmit) 37 | @property (nonatomic, strong) id uxy_flyweightData; 38 | - (void)uxy_receiveObject:(void(^)(id object))aBlock withIdentifier:(NSString *)identifier; 39 | - (void)uxy_sendObject:(id)anObject withIdentifier:(NSString *)identifier; 40 | - (void)uxy_handlerEventWithBlock:(id)aBlock withIdentifier:(NSString *)identifier; 41 | - (id)uxy_blockForEventWithIdentifier:(NSString *)identifier; 42 | @end 43 | 44 | #pragma mark- 45 | @protocol XYFlyweightTransmit 46 | 47 | @property (nonatomic, strong) id uxy_flyweightData; 48 | 49 | // 传递一个数据 50 | - (void)uxy_receiveObject:(void(^)(id object))aBlock withIdentifier:(NSString *)identifier; 51 | - (void)uxy_sendObject:(id)anObject withIdentifier:(NSString *)identifier; 52 | 53 | // 设置一个block作为回调 54 | - (void)uxy_handlerEventWithBlock:(id)aBlock withIdentifier:(NSString *)identifier; 55 | - (id)uxy_blockForEventWithIdentifier:(NSString *)identifier; 56 | 57 | @end 58 | 59 | 60 | -------------------------------------------------------------------------------- /Pod/Classes/event/modules/XYNotification.h: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | 31 | #import "XYQuick_Predefine.h" 32 | #pragma mark - 33 | 34 | #pragma mark - #define 35 | 36 | // 声明一个notification name 37 | #define uxy_def_notification_name( __name ) uxy_staticConstString( __name ) 38 | 39 | // 响应一个 notification 40 | #define uxy_handleNotification( __name, __notification ) \ 41 | - (void)__uxy_handleNotification_##__name:(NSNotification *)__notification 42 | 43 | typedef void(^XYNotification_block)(NSNotification *notification); 44 | 45 | #pragma mark - XYNotification 46 | @interface XYNotification : NSObject 47 | 48 | @end 49 | 50 | #pragma mark - NSObject (XYNotification) 51 | // 注意这里 self 自己可能是被观察者; 也可能 self 持有了观察者, 在self 销毁的时候, 取消所有的观察 52 | @interface NSObject (XYNotification) 53 | 54 | @property (nonatomic, readonly, strong) NSMutableDictionary *uxy_notifications; 55 | 56 | - (void)uxy_registerNotification:(const char *)name; 57 | - (void)uxy_registerNotification:(const char *)name block:(XYNotification_block)block; 58 | 59 | - (void)uxy_unregisterNotification:(const char *)name; 60 | - (void)uxy_unregisterAllNotification; 61 | 62 | - (void)uxy_postNotification:(const char *)name userInfo:(id)userInfo; 63 | 64 | @end -------------------------------------------------------------------------------- /Pod/Classes/predefine/XYQuick_Predefine.m: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | 31 | #import "XYQuick_Predefine.h" 32 | 33 | #pragma mark - 34 | @implementation XYQuick_Predefine 35 | @end -------------------------------------------------------------------------------- /Pod/Classes/ui/extension/UIActionSheet+XY.h: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | 31 | #import "XYQuick_Predefine.h" 32 | #import 33 | #pragma mark - 34 | 35 | typedef void(^XYActionSheet_block_self_index)(UIActionSheet *actionSheet, NSInteger btnIndex); 36 | typedef void(^XYActionSheet_block_self)(UIActionSheet *actionSheet); 37 | 38 | @interface UIActionSheet (XYExtension) 39 | 40 | - (void)uxy_handlerClickedButton:(XYActionSheet_block_self_index)aBlock; 41 | - (void)uxy_handlerCancel:(XYActionSheet_block_self)aBlock; 42 | - (void)uxy_handlerWillPresent:(XYActionSheet_block_self)aBlock; 43 | - (void)uxy_handlerDidPresent:(XYActionSheet_block_self)aBlock; 44 | - (void)uxy_handlerWillDismiss:(XYActionSheet_block_self)aBlock; 45 | - (void)uxy_handlerDidDismiss:(XYActionSheet_block_self_index)aBlock; 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /Pod/Classes/ui/extension/UIAlertView+XY.h: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | 31 | #import "XYQuick_Predefine.h" 32 | #import 33 | #pragma mark - 34 | 35 | typedef void(^XYAlertView_block_self_index)(UIAlertView *alertView, NSInteger btnIndex); 36 | typedef void(^XYAlertView_block_self)(UIAlertView *alertView); 37 | typedef BOOL(^XYAlertView_block_shouldEnableFirstOtherButton)(UIAlertView *alertView); 38 | 39 | @interface UIAlertView (XYExtension) 40 | 41 | - (void)uxy_handlerClickedButton:(XYAlertView_block_self_index)aBlock; 42 | - (void)uxy_handlerCancel:(XYAlertView_block_self)aBlock; 43 | - (void)uxy_handlerWillPresent:(XYAlertView_block_self)aBlock; 44 | - (void)uxy_handlerDidPresent:(XYAlertView_block_self)aBlock; 45 | - (void)uxy_handlerWillDismiss:(XYAlertView_block_self_index)aBlock; 46 | - (void)uxy_handlerDidDismiss:(XYAlertView_block_self_index)aBlock; 47 | - (void)uxy_handlerShouldEnableFirstOtherButton:(XYAlertView_block_shouldEnableFirstOtherButton)aBlock; 48 | 49 | // 延时消失 50 | - (void)uxy_showWithDuration:(NSTimeInterval)duration; 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /Pod/Classes/ui/extension/UIButton+XY.h: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | 31 | #import "XYQuick_Predefine.h" 32 | #import 33 | #pragma mark - 34 | 35 | @interface UIButton (XYExtension) 36 | 37 | /// 再次接受Event的间隔. 可以用这个给UIButton的重复点击加间隔. 38 | //@property (nonatomic, assign) NSTimeInterval uxy_acceptEventInterval; 39 | 40 | - (NSIndexPath *)uxy_getTableViewCellIndexPath; 41 | - (NSIndexPath *)uxy_getTableViewCellIndexPathAtTableView:(UITableView *)tableView; 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /Pod/Classes/ui/extension/UIColor+XY.h: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | 31 | #import "XYQuick_Predefine.h" 32 | #import 33 | #pragma mark - 34 | 35 | /**************************************************************/ 36 | // RGB颜色 37 | #define XYColorFromRGBA(r, g, b, a) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:a] 38 | #define XYColorFromHEXWithAlpha(__hex, __alpha) [UIColor uxy_colorFromHex:__hex alpha:__alpha] 39 | 40 | @interface UIColor (XYExtension) 41 | 42 | // 根据自己的颜色,返回黑色或者白色 43 | - (instancetype)uxy_blackOrWhiteContrastingColor; 44 | 45 | // 返回一个十六进制表示的颜色(红色): @"FF0000" or @"#FF0000" 46 | + (instancetype)uxy_colorFromHexString:(NSString *)hexString; 47 | 48 | // 返回一个十六进制表示的颜色(红色): 0xFF0000 49 | + (instancetype)uxy_colorFromHex:(NSUInteger)hex alpha:(CGFloat)alpha; 50 | 51 | // 返回颜色的十六进制string 52 | - (NSString *)uxy_hexString; 53 | 54 | @end 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /Pod/Classes/ui/extension/UIColor+XY.m: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | 31 | #import "UIColor+XY.h" 32 | 33 | @implementation UIColor (XYExtension) 34 | 35 | + (instancetype)uxy_colorFromHexString:(NSString *)hexString 36 | { 37 | NSString *str = [hexString stringByReplacingOccurrencesOfString:@"#" withString:@""]; 38 | NSUInteger size = strtoul([str UTF8String], nil, 16); 39 | return [UIColor uxy_colorFromHex:size alpha:1.0]; 40 | } 41 | 42 | + (instancetype)uxy_colorFromHex:(NSUInteger)hex alpha:(CGFloat)alpha 43 | { 44 | return [UIColor colorWithRed:(((hex & 0xFF0000) >> 16)) / 255.0 green:(((hex & 0xFF00) >> 8)) / 255.0 blue:((hex & 0xFF)) / 255.0 alpha:alpha]; 45 | } 46 | 47 | - (instancetype)uxy_blackOrWhiteContrastingColor 48 | { 49 | CGFloat r = 0; 50 | CGFloat g = 0; 51 | CGFloat b = 0; 52 | 53 | [self getRed:&r green:&g blue:&b alpha:NULL]; 54 | 55 | double a = 1 - ((0.299 * r) + (0.587 * g) + (0.114 * b)); 56 | return a < 0.5 ? [UIColor blackColor] : [UIColor whiteColor]; 57 | } 58 | 59 | - (NSString *)uxy_hexString 60 | { 61 | CGFloat r = 0; 62 | CGFloat g = 0; 63 | CGFloat b = 0; 64 | 65 | [self getRed:&r green:&g blue:&b alpha:NULL]; 66 | 67 | r *= 255; 68 | g *= 255; 69 | b *= 255; 70 | 71 | return [NSString stringWithFormat:@"#%02f%02f%02f", r, g, b]; 72 | } 73 | 74 | @end 75 | -------------------------------------------------------------------------------- /Pod/Classes/ui/extension/UILabel+XY.h: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | 31 | #import "XYQuick_Predefine.h" 32 | #import 33 | #pragma mark - 34 | 35 | @interface UILabel (XYExtension) 36 | 37 | typedef enum { 38 | XYLabelResizeType_constantHeight = 1, 39 | XYLabelResizeType_constantWidth, 40 | } XYLabelResizeType; 41 | 42 | /** 43 | * @brief 调整UILabel尺寸 44 | * @param type 调整尺寸时的条件, XYLabelResizeType_constantHeight 高度不变, XYLabelResizeType_constantWidth 宽度不变 45 | */ 46 | - (void)uxy_resize:(XYLabelResizeType)type; 47 | 48 | // 返回估计的尺寸 49 | - (CGSize)uxy_estimateUISizeByHeight:(CGFloat)height; 50 | - (CGSize)uxy_estimateUISizeByWidth:(CGFloat)width; 51 | 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /Pod/Classes/ui/extension/UINavigationBar+XY.h: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | 31 | #import "XYQuick_Predefine.h" 32 | #import 33 | #pragma mark - 34 | 35 | @interface UINavigationBar (XYExtension) 36 | 37 | // NavigationBar 变色 透明 尺寸 等方法 copy from https://github.com/ltebean/LTNavigationBar 38 | - (void)uxy_setBackgroundColor:(UIColor *)backgroundColor; 39 | - (void)uxy_setContentAlpha:(CGFloat)alpha; 40 | - (void)uxy_setTranslationY:(CGFloat)translationY; 41 | - (void)uxy_reset; 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /Pod/Classes/ui/extension/UITable+XY.h: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | 31 | #import "XYQuick_Predefine.h" 32 | #import 33 | #pragma mark - 34 | 35 | @interface UITableViewCell (XYExtension) 36 | 37 | // 子类需要重写此方法 38 | + (CGFloat)uxy_heightForRowWithData:(id)data; 39 | 40 | - (void)uxy_layoutSubviewsWithDictionary:(NSMutableDictionary *)dictionary; 41 | 42 | @end 43 | 44 | @interface UITableView (XYExtension) 45 | 46 | - (void)uxy_reloadData:(BOOL)animated; 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /Pod/Classes/ui/extension/UITable+XY.m: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | 31 | #import "UITable+XY.h" 32 | 33 | @implementation UITableViewCell (XYExtension) 34 | 35 | + (CGFloat)uxy_heightForRowWithData:(id)data 36 | { 37 | if (data == nil) 38 | { 39 | return -1; 40 | } 41 | 42 | return 44; 43 | } 44 | 45 | - (void)uxy_layoutSubviewsWithDictionary:(NSMutableDictionary *)dictionary 46 | { 47 | 48 | } 49 | 50 | @end 51 | 52 | 53 | @implementation UITableView (XYExtension) 54 | 55 | - (void)uxy_reloadData:(BOOL)animated 56 | { 57 | [self reloadData]; 58 | 59 | if (animated) 60 | { 61 | CATransition *animation = [CATransition animation]; 62 | [animation setType:kCATransitionReveal]; 63 | [animation setSubtype:kCATransitionFromBottom]; 64 | [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]]; 65 | [animation setFillMode:kCAFillModeBoth]; 66 | [animation setDuration:.3]; 67 | [[self layer] addAnimation:animation forKey:@"UITableViewReloadDataAnimationKey"]; 68 | } 69 | } 70 | 71 | @end -------------------------------------------------------------------------------- /Pod/Classes/ui/extension/UIViewController+XY.h: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | 31 | #import "XYQuick_Predefine.h" 32 | #import 33 | #pragma mark - 34 | 35 | typedef void(^UIViewController_block_void) (void); 36 | typedef void(^UIViewController_block_view) (UIView *view); 37 | 38 | @interface UIViewController (XYExtension) 39 | 40 | @property (nonatomic, strong) id uxy_parameters; // 参数 41 | 42 | // 导航 43 | - (void)uxy_pushVC:(NSString *)vcName; 44 | - (void)uxy_pushVC:(NSString *)vcName object:(id)object; 45 | - (void)uxy_popVC; 46 | 47 | // 模态 带导航控制器 48 | - (void)uxy_modalVC:(NSString *)vcName withNavigationVC:(NSString *)navName; 49 | - (void)uxy_modalVC:(NSString *)vcName withNavigationVC:(NSString *)navName object:(id)object succeed:(UIViewController_block_void)block; 50 | - (void)uxy_dismissModalVC; 51 | - (void)uxy_dismissModalVCWithSucceed:(UIViewController_block_void)block; 52 | 53 | #define UserGuide_tag 30912 54 | 55 | /** 56 | * @brief 显示用户引导图 57 | * @param imgName 图片名称,默认用无图片缓存方式加载, UIImageView tag == UserGuide_tag 58 | * @param key 引导图的key,默认每个key只显示一次 59 | * @param frameString 引导图的位置, full 全屏, center 居中, frame : @"{{0,0},{100,100}}", center : @"{{100,100}}" 60 | * @param block 点击背景执行的方法, 默认是淡出 61 | * @return 返回底层的蒙板view 62 | */ 63 | - (id)uxy_showUserGuideViewWithImage:(NSString *)imgName 64 | key:(NSString *)key 65 | alwaysShow:(BOOL)isAlwaysShow 66 | frame:(NSString *)frameString 67 | tapExecute:(UIViewController_block_view)block; 68 | 69 | 70 | @end 71 | 72 | @protocol XYSwitchControllerProtocol 73 | 74 | - (id)initWithObject:(id)object; 75 | 76 | @end -------------------------------------------------------------------------------- /Pod/Classes/ui/extension/UIWebView+XY.h: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | 31 | #import "XYQuick_Predefine.h" 32 | #import 33 | #pragma mark - 34 | 35 | @interface UIWebView (XYExtension) 36 | 37 | /// 清理网页,如果isCleanCache = YES, 就连NSURLCache,Disk,Memory也清理 38 | - (void)uxy_clean:(BOOL)isCleanCache; 39 | 40 | /// 获取当前页面的html 41 | - (NSString*)uxy_innerHTML; 42 | 43 | /// 获取userAgent 44 | - (NSString*)uxy_userAgent; 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Pod/Classes/ui/extension/UIWebView+XY.m: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | 31 | #import "UIWebView+XY.h" 32 | 33 | @implementation UIWebView (XYExtension) 34 | 35 | - (void)uxy_clean:(BOOL)isCleanCache 36 | { 37 | [self loadHTMLString:@"" baseURL:nil]; 38 | [self stopLoading]; 39 | self.delegate = nil; 40 | 41 | if (isCleanCache) 42 | { 43 | [[NSURLCache sharedURLCache] removeAllCachedResponses]; 44 | [[NSURLCache sharedURLCache] setDiskCapacity:0]; 45 | [[NSURLCache sharedURLCache] setMemoryCapacity:0]; 46 | } 47 | } 48 | 49 | 50 | - (NSString*)uxy_innerHTML 51 | { 52 | return [self stringByEvaluatingJavaScriptFromString:@"document.documentElement.innerHTML"]; 53 | } 54 | 55 | - (NSString*)uxy_userAgent 56 | { 57 | return [self stringByEvaluatingJavaScriptFromString:@"navigator.userAgent"];; 58 | } 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /Pod/Classes/ui/extension/UIWindow+XY.h: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | 31 | #import "XYQuick_Predefine.h" 32 | #import 33 | #pragma mark - 34 | 35 | @interface UIWindow (XYExtension) 36 | 37 | /// The app’s key window 38 | + (UIWindow *)uxy_mainWindow; 39 | 40 | /// 返回目前可见的最上层显示的 viewController 41 | + (UIViewController *)uxy_visibleViewController; 42 | 43 | /// 返回优化后的目前可见的最上层显示的 viewController, UITabBarController会取selectedViewController, UINavigationController取visibleViewController 44 | + (UIViewController *)uxy_optimizedVisibleViewController; 45 | 46 | /// 返回rootViewController上的可见的viewController 47 | + (UIViewController *)uxy_visibleViewControllerWithRootViewController:(UIViewController*)rootViewController; 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /Pod/Classes/ui/modules/XYHUDProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | 31 | #import 32 | 33 | @protocol XYHUDProtocol 34 | 35 | @optional 36 | - (void)showErrorViewWithParameter:(id)param; 37 | - (void)closeErrorView; 38 | 39 | - (void)showZeroDataViewWithParameter:(id)param; 40 | - (void)closeZeroDataView; 41 | 42 | - (void)showLoadingDataViewWithParameter:(id)param; 43 | - (void)closeLoadingDataView; 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /Pod/Classes/ui/modules/XYUIDefine.h: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | 31 | #ifndef JoinShow_XYUIDefine_h 32 | #define JoinShow_XYUIDefine_h 33 | 34 | #define XY_SINGLE_LINE_WIDTH (1.0f / [UIScreen mainScreen].scale) 35 | #define XY_SINGLE_LINE_ADJUST_OFFSET ((1.0f / [UIScreen mainScreen].scale) / 2.0f) 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /Pod/Classes/ui/modules/XYViewControllerManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // __ __ ____ _ _ 3 | // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ 4 | // \ / \_ _/ // / / | | | | | | / __| | |/ / 5 | // / \ / \ / \_/ / | |_| | | | | (__ | < 6 | // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ 7 | // // 8 | // Copyright (C) Heaven. 9 | // 10 | // https://github.com/uxyheaven/XYQuick 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | // 30 | 31 | #import "XYQuick_Predefine.h" 32 | #import 33 | #pragma mark - 34 | 35 | typedef UIViewController * (^XYViewControllerManager_createVC_block) (void); 36 | 37 | @interface XYViewControllerManager : UIViewController 38 | 39 | + (instancetype)sharedInstance; 40 | + (void)purgeSharedInstance; 41 | 42 | @property (nonatomic, strong, readonly) NSMutableDictionary *viewControllers; 43 | @property (nonatomic, weak) UIViewController *selectedViewController; 44 | @property (nonatomic, copy) NSString *selectedKey; 45 | @property (nonatomic, copy) NSString *firstKey; 46 | 47 | //@property (nonatomic, strong, readonly) NSMutableDictionary *viewControllerSetupBlocks; // 创建viewControllers的block 48 | 49 | @property (nonatomic, strong, readonly) UIView *contentView; // 子视图控制器显示的view 50 | 51 | 52 | - (void)addAViewController:(XYViewControllerManager_createVC_block)block key:(NSString *)key; 53 | 54 | - (void)clean; 55 | 56 | @end 57 | 58 | 59 | #pragma mark - category 60 | @interface UIViewController (XYViewControllerManager) 61 | 62 | @property (nonatomic, weak, readonly) XYViewControllerManager *uxy_viewControllerManager; 63 | 64 | @end 65 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # XYQuick 2 | 3 | [![CI Status](http://img.shields.io/travis/uxyheaven/XYQuick.svg?style=flat)](https://travis-ci.org/uxyheaven/XYQuick) 4 | [![Version](https://img.shields.io/cocoapods/v/XYQuick.svg?style=flat)](http://cocoapods.org/pods/XYQuick) 5 | [![License](https://img.shields.io/cocoapods/l/XYQuick.svg?style=flat)](http://cocoapods.org/pods/XYQuick) 6 | [![Platform](https://img.shields.io/cocoapods/p/XYQuick.svg?style=flat)](http://cocoapods.org/pods/XYQuick) 7 | 8 | ## Usage 9 | 10 | To run the example project, clone the repo, and run `pod install` from the Example directory first. 11 | 12 | ## Requirements 13 | 14 | ## Installation 15 | 16 | XYQuick is available through [CocoaPods](http://cocoapods.org). To install 17 | it, simply add the following line to your Podfile: 18 | 19 | ```ruby 20 | pod "XYQuick" 21 | ``` 22 | 23 | ## Author 24 | uxyheaven 25 | 26 | 27 | ## License 28 | 29 | XYQuick is available under the MIT license. See the LICENSE file for more info. 30 | #{XY} Quick 31 | 32 | {XY} 快速开发框架是用于快速高效开发的工具库.它包含`Core`, `Event`, `UI`三层, 33 | 封装了数据持久化,数据缓存(文件缓存,内存缓存),kvo, Notification, delegate, 动画, 图片处理, 自定义了 ViewController 生命周期. 34 | 35 | - 本库采用 ARC 36 | 37 | ### XYQuick 38 | 39 | #### Core 40 | 41 | - XYTimer // 定时器类 42 | - XYKVO // KVO 的封装 43 | - XYNotification // NSNotification 的封装 44 | - XYSandbox // 沙箱路径 45 | - XYSystemInfo // 系统信息 46 | - XYJSON // json to object , object to json 47 | - XYAOP // 面向切面编程 48 | - XYProtocolExtension // 协议扩展 49 | - XYReachability // 网络可达性检测 50 | 51 | ##### Cache 52 | 53 | 缓存模块, 包含内存缓存, 文件缓存, UserDefaults 54 | 55 | ##### Debug 56 | 57 | 调试模块, 包含单元测试, 时间统计 58 | 59 | #### Event 60 | 61 | - XYMulticastDelegate // 多路委托 62 | - XYSignal // 责任链信号 63 | - XYNotification // Notification 的封装 64 | - XYKVO // KVO 的封装 65 | - XYFlyweightTransmit // 轻量级的底层往高层传数据 66 | 67 | #### UI 68 | 69 | - XYKeyboardHelper // 弹出键盘时,移动所编辑的控件的通用解决方案 70 | - XYAnimate // UIView 动画的封装 71 | - XYTabBarController // 自定义的 UITabBarController 72 | - XYBaseViewController // 自定义 ViewController 生命周期 73 | - XYViewControllerManager // UIViewController 管理类 74 | 75 | ### XYVender 76 | 77 | - Extension 第三方库的一些简单包装,如 78 | - RequestHelper 网络通讯类 79 | - XYBaseDao 范化的本地 dao 类 80 | 81 | ### Laboratory 82 | 83 | 这里是一个实验室,里面有一些实验性质的代码.你可以参考这里的代码,如果觉得有用,可以自行拷贝到项目中. 84 | 85 | --- 86 | 87 | ## Installation 88 | 89 | - 本库基于 ARC 90 | - 拷贝 XYQuick 到项目里 91 | - 在需要用的文件或者 pch 里 `#import "XYQuick.h" 92 | - 在 `XYQuick_Predefine` 开启或者关闭需要的编译选项() 93 | 94 | ### Podfile 95 | 96 | ``` 97 | pod 'XYQuick' 98 | 99 | #import "XYQuick.h" 100 | ``` 101 | 102 | --- 103 | -------------------------------------------------------------------------------- /XYQuick.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod lib lint XYQuick.podspec' to ensure this is a 3 | # valid spec before submitting. 4 | # 5 | # Any lines starting with a # are optional, but their use is encouraged 6 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html 7 | # 8 | 9 | Pod::Spec.new do |s| 10 | s.name = "XYQuick" 11 | s.version = "0.9.10" 12 | s.summary = "A quick develop utility on iOS." 13 | 14 | # This description is used to generate tags and improve search results. 15 | # * Think: What does it do? Why did you write it? What is the focus? 16 | # * Try to keep it short, snappy and to the point. 17 | # * Write the description between the DESC delimiters below. 18 | # * Finally, don't worry about the indent, CocoaPods strips it! 19 | s.description = <<-DESC 20 | A quick develop utility on iOS... 21 | DESC 22 | 23 | s.homepage = "https://github.com/uxyheaven" 24 | # s.screenshots = "www.example.com/screenshots_1", "www.example.com/screenshots_2" 25 | s.license = 'MIT' 26 | s.author = { "uxyheaven" => "uxyheaven@163.com" } 27 | s.source = { :git => "https://github.com/uxyheaven/XYQuick.git", :tag => s.version.to_s } 28 | # s.social_media_url = 'https://twitter.com/' 29 | 30 | s.platform = :ios, '7.0' 31 | s.requires_arc = true 32 | 33 | #s.source_files = 'Pod/Classes/**/*' 34 | s.public_header_files = 'Pod/Classes/XYQuick.h' 35 | s.source_files = 'Pod/Classes/XYQuick.{h,m}' 36 | 37 | s.subspec 'predefine' do |ss| 38 | ss.source_files = 'Pod/Classes/predefine/*.{h,m}' 39 | ss.public_header_files = 'Pod/Classes/predefine/**/*.h' 40 | end 41 | 42 | s.subspec 'core' do |ss| 43 | ss.source_files = 'Pod/Classes/core/**/*' 44 | ss.public_header_files = 'Pod/Classes/core/**/*.h' 45 | ss.dependency 'XYQuick/predefine' 46 | end 47 | 48 | s.subspec 'ui' do |ss| 49 | ss.source_files = 'Pod/Classes/ui/**/*' 50 | ss.public_header_files = 'Pod/Classes/ui/**/*.h' 51 | ss.dependency 'XYQuick/predefine' 52 | ss.dependency 'XYQuick/core' 53 | end 54 | 55 | s.subspec 'event' do |ss| 56 | ss.source_files = 'Pod/Classes/event/**/*' 57 | ss.public_header_files = 'Pod/Classes/event/**/*.h' 58 | ss.dependency 'XYQuick/predefine' 59 | ss.dependency 'XYQuick/core' 60 | ss.dependency 'XYQuick/ui' 61 | end 62 | end 63 | -------------------------------------------------------------------------------- /_Pods.xcodeproj: -------------------------------------------------------------------------------- 1 | Example/Pods/Pods.xcodeproj --------------------------------------------------------------------------------