├── .gitignore ├── OCRedux ├── AHSActionDispatcher.h ├── AHSActionDispatcher.m ├── AHSActionReducer.h ├── AHSActionReducer.m ├── AHSDetectStore+Private.h ├── AHSDetectStore.h ├── AHSDetectStore.m ├── AHSDispatchAction.h ├── AHSDispatchAction.m ├── AHSOCRedux.h ├── AHSRequestAction.h ├── AHSRequestAction.m ├── NSObject+Redux.h └── NSObject+Redux.m ├── OCReduxDemo ├── OCReduxDemo.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── OCReduxDemo.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── OCReduxDemo │ ├── AHSBaseModel.h │ ├── AHSBaseModel.m │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── Contents.json │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Info.plist │ ├── OCReduxDemo.pch │ ├── Reducers │ │ ├── AHSLogReducer.h │ │ ├── AHSLogReducer.m │ │ ├── AHSUploadLogReducer.h │ │ └── AHSUploadLogReducer.m │ ├── ViewController.h │ ├── ViewController.m │ └── main.m ├── Podfile └── Podfile.lock └── readme.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xccheckout 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | *.dSYM.zip 29 | *.dSYM 30 | 31 | # CocoaPods 32 | # 33 | # We recommend against adding the Pods directory to your .gitignore. However 34 | # you should judge for yourself, the pros and cons are mentioned at: 35 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 36 | # 37 | Pods/ 38 | 39 | # Carthage 40 | # 41 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 42 | # Carthage/Checkouts 43 | 44 | Carthage/Build 45 | 46 | # fastlane 47 | # 48 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 49 | # screenshots whenever they are needed. 50 | # For more informat -------------------------------------------------------------------------------- /OCRedux/AHSActionDispatcher.h: -------------------------------------------------------------------------------- 1 | // 2 | // AHSActionDispatcher.h 3 | // AHSBasic 4 | // 5 | // Created by sam on 2019/5/31. 6 | // Copyright © 2019 sam. All rights reserved. 7 | // 8 | 9 | #import "AHSBaseModel.h" 10 | #import "AHSDispatchAction.h" 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @protocol AHSReceiveActionProtocol 14 | - (void)handleAction:(AHSDispatchAction *)action; 15 | @end 16 | 17 | extern void ahs_redux_dispatch(AHSDispatchAction *action); 18 | 19 | @interface AHSActionDispatcher : AHSBaseModel 20 | + (instancetype)dispatcher; 21 | @end 22 | 23 | NS_ASSUME_NONNULL_END 24 | -------------------------------------------------------------------------------- /OCRedux/AHSActionDispatcher.m: -------------------------------------------------------------------------------- 1 | // 2 | // AHSActionDispatcher.m 3 | // AHSBasic 4 | // 5 | // Created by sam on 2019/5/31. 6 | // Copyright © 2019 sam. All rights reserved. 7 | // 8 | 9 | #import "AHSActionDispatcher.h" 10 | 11 | @interface AHSActionDispatcher() 12 | @property (nonatomic, strong) NSMutableDictionary *recivers; 13 | - (void)dispatchAction:(AHSDispatchAction *)action; 14 | @end 15 | 16 | @implementation AHSActionDispatcher 17 | 18 | + (instancetype)dispatcher { 19 | static AHSActionDispatcher *dis = nil; 20 | static dispatch_once_t onceToken; 21 | dispatch_once(&onceToken, ^{ 22 | dis = [[AHSActionDispatcher alloc] init]; 23 | }); 24 | return dis; 25 | } 26 | 27 | 28 | - (instancetype)init { 29 | if (self = [super init]) { 30 | self.recivers = @{}.mutableCopy; 31 | } 32 | return self; 33 | } 34 | - (void)addReceiver:(id )receiver forIdentifier:(NSString *)identifier { 35 | if (!self.recivers[identifier]) { 36 | self.recivers[identifier] = [[NSPointerArray alloc] initWithOptions:NSPointerFunctionsWeakMemory]; 37 | } 38 | [self.recivers[identifier] compact]; 39 | NSArray *arr = [self.recivers[identifier] allObjects]; 40 | if (![arr containsObject:receiver]) { 41 | [self.recivers[identifier] addPointer:(__bridge void * _Nullable)(receiver)]; 42 | } 43 | } 44 | 45 | - (void)dispatchAction:(AHSDispatchAction *)action { 46 | if (!self.recivers[action.identifier]) return; 47 | [self.recivers[action.identifier] compact]; 48 | NSArray *arr = [self.recivers[action.identifier] allObjects]; 49 | for (id receiver in arr) { 50 | NSAssert([receiver respondsToSelector:@selector(handleAction:)], action.identifier, receiver, @"not handle"); 51 | if ([receiver respondsToSelector:@selector(handleAction:)]) [receiver handleAction:action]; 52 | } 53 | } 54 | 55 | 56 | @end 57 | 58 | void ahs_redux_dispatch(AHSDispatchAction *action) { 59 | [[AHSActionDispatcher dispatcher] dispatchAction:action]; 60 | } 61 | 62 | -------------------------------------------------------------------------------- /OCRedux/AHSActionReducer.h: -------------------------------------------------------------------------------- 1 | // 2 | // AHSActionReducer.h 3 | // AHSBasic 4 | // 5 | // Created by sam on 2019/5/31. 6 | // Copyright © 2019 sam. All rights reserved. 7 | // 8 | 9 | #import "AHSBaseModel.h" 10 | #import "AHSRequestAction.h" 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface AHSActionReducer : AHSBaseModel 14 | 15 | // 在 + (void)load 方法中注册 16 | - (void)registForUrl:(NSString *)url; 17 | - (void)registForUrl:(NSString *)url inScope:(NSString *)scope; 18 | // 子类 overwrite 19 | - (void)handleUrl:(NSString *)url requestAction:(AHSRequestAction *)action; 20 | 21 | - (void)startWith:(NSString *)url; 22 | @end 23 | 24 | NS_ASSUME_NONNULL_END 25 | -------------------------------------------------------------------------------- /OCRedux/AHSActionReducer.m: -------------------------------------------------------------------------------- 1 | // 2 | // AHSActionReducer.m 3 | // AHSBasic 4 | // 5 | // Created by sam on 2019/5/31. 6 | // Copyright © 2019 sam. All rights reserved. 7 | // 8 | 9 | #import "AHSActionReducer.h" 10 | #import "AHSDetectStore.h" 11 | #import "AHSDetectStore+Private.h" 12 | 13 | extern NSString *ahs_default_scope; 14 | @implementation AHSActionReducer 15 | - (void)registForUrl:(NSString *)url inScope:(NSString *)scope { 16 | [[AHSDetectStore store] registReducer:self ForUrl:url inScope:scope]; 17 | } 18 | 19 | - (void)registForUrl:(NSString *)url { 20 | [self registForUrl:url inScope:ahs_default_scope]; 21 | } 22 | 23 | - (void)handleUrl:(NSString *)url requestAction:(AHSRequestAction *)action { 24 | 25 | } 26 | 27 | - (void)startWith:(NSString *)url { 28 | 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /OCRedux/AHSDetectStore+Private.h: -------------------------------------------------------------------------------- 1 | // 2 | // AHSDetectStore+Private.h 3 | // AHSBasic 4 | // 5 | // Created by sam on 2019/5/31. 6 | // Copyright © 2019 sam. All rights reserved. 7 | // 8 | 9 | #ifndef AHSDetectStore_Private_h 10 | #define AHSDetectStore_Private_h 11 | #import "AHSDetectStore.h" 12 | #import "AHSRequestAction.h" 13 | #import "AHSActionReducer.h" 14 | @interface AHSDetectStore () 15 | - (void)registReducer:(AHSActionReducer *)reducer ForUrl:(NSString *)url inScope:(NSString *)scope; 16 | - (void)handleUrl:(NSString *)url requestAction:(AHSRequestAction *)action inScope:(NSString *)scope; 17 | @end 18 | 19 | #endif /* AHSDetectStore_Private_h */ 20 | -------------------------------------------------------------------------------- /OCRedux/AHSDetectStore.h: -------------------------------------------------------------------------------- 1 | // 2 | // ASHDetectStore.h 3 | // AHSBasic 4 | // 5 | // Created by sam on 2019/5/31. 6 | // Copyright © 2019 sam. All rights reserved. 7 | // 8 | 9 | #import "AHSBaseModel.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface AHSDetectStore : AHSBaseModel 14 | + (instancetype)store; 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /OCRedux/AHSDetectStore.m: -------------------------------------------------------------------------------- 1 | // 2 | // ASHDetectStore.m 3 | // AHSBasic 4 | // 5 | // Created by sam on 2019/5/31. 6 | // Copyright © 2019 sam. All rights reserved. 7 | // 8 | #import "AHSActionReducer.h" 9 | #import "AHSDetectStore.h" 10 | #import 11 | 12 | 13 | 14 | @interface AHSDetectStore() 15 | @property (nonatomic, strong) NSMutableDictionary *> *> *store; 16 | @end 17 | 18 | @implementation AHSDetectStore 19 | + (instancetype)store { 20 | static AHSDetectStore *store = nil; 21 | static dispatch_once_t onceToken; 22 | dispatch_once(&onceToken, ^{ 23 | store = [[AHSDetectStore alloc] init]; 24 | }); 25 | return store; 26 | } 27 | 28 | - (instancetype)init { 29 | if (self = [super init]) { 30 | self.store = @{}.mutableCopy; 31 | [[[NSNotificationCenter defaultCenter] rac_addObserverForName:UIApplicationDidFinishLaunchingNotification object:nil] subscribeNext:^(id x) { 32 | [self.store enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull scope, NSMutableDictionary *> * _Nonnull firstMap, BOOL * _Nonnull stop) { 33 | [firstMap enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull url, NSMutableArray * _Nonnull reducers, BOOL * _Nonnull stop) { 34 | [reducers enumerateObjectsUsingBlock:^(AHSActionReducer * _Nonnull reducer, NSUInteger idx, BOOL * _Nonnull stop) { 35 | [reducer startWith:url]; 36 | }]; 37 | }]; 38 | }]; 39 | }]; 40 | } 41 | return self; 42 | } 43 | - (void)registReducer:(AHSActionReducer *)reducer ForUrl:(NSString *)url inScope:(NSString *)scope { 44 | if (!self.store[scope]) self.store[scope] = @{}.mutableCopy; 45 | if (!self.store[scope][url]) self.store[scope][url] = @[].mutableCopy; 46 | 47 | if (![self.store[scope][url] containsObject:reducer]) { 48 | [self.store[scope][url] addObject:reducer]; 49 | } 50 | } 51 | 52 | - (void)handleUrl:(NSString *)url requestAction:(AHSRequestAction *)action inScope:(NSString *)scope { 53 | NSArray *reducers = self.store[scope][url]; 54 | if (!reducers) return; 55 | [reducers enumerateObjectsUsingBlock:^(AHSActionReducer *obj, NSUInteger idx, BOOL * _Nonnull stop) { 56 | [obj handleUrl:url requestAction:action]; 57 | }]; 58 | } 59 | @end 60 | -------------------------------------------------------------------------------- /OCRedux/AHSDispatchAction.h: -------------------------------------------------------------------------------- 1 | // 2 | // AHSDispatchAction.h 3 | // AHSBasic 4 | // 5 | // Created by sam on 2019/5/31. 6 | // Copyright © 2019 sam. All rights reserved. 7 | // 8 | 9 | #import "AHSBaseModel.h" 10 | #import 11 | NS_ASSUME_NONNULL_BEGIN 12 | @interface AHSDispatchAction : AHSBaseModel 13 | @property (nonatomic, copy) NSString *identifier; 14 | @end 15 | 16 | @interface AHSDispatchSignalAction : AHSDispatchAction 17 | @property (nonatomic, strong) RACSignal *signal; 18 | @end 19 | 20 | 21 | typedef NS_ENUM(NSUInteger, AHSDispatchRouteType) { 22 | AHSDispatchRouteTypePush, 23 | AHSDispatchRouteTypePop, 24 | AHSDispatchRouteTypePopToRoot, 25 | AHSDispatchRouteTypePresent 26 | }; 27 | 28 | @interface AHSDispatchRouteAction : AHSDispatchAction 29 | @property (nonatomic, copy) NSString *targetClass; 30 | @property (nonatomic, copy) NSDictionary *extras; 31 | @property (nonatomic, assign) AHSDispatchRouteType routeType; 32 | @end 33 | 34 | @interface AHSDispatchDataAction : AHSDispatchAction 35 | @property (nonatomic, strong) id data; 36 | @end 37 | NS_ASSUME_NONNULL_END 38 | -------------------------------------------------------------------------------- /OCRedux/AHSDispatchAction.m: -------------------------------------------------------------------------------- 1 | // 2 | // AHSDispatchAction.m 3 | // AHSBasic 4 | // 5 | // Created by sam on 2019/5/31. 6 | // Copyright © 2019 sam. All rights reserved. 7 | // 8 | 9 | #import "AHSDispatchAction.h" 10 | 11 | @implementation AHSDispatchAction 12 | @end 13 | 14 | @implementation AHSDispatchRouteAction 15 | @end 16 | 17 | @implementation AHSDispatchSignalAction 18 | @end 19 | 20 | @implementation AHSDispatchDataAction 21 | @end 22 | -------------------------------------------------------------------------------- /OCRedux/AHSOCRedux.h: -------------------------------------------------------------------------------- 1 | // 2 | // AHSOCRedux.h 3 | // OcReduxDemo 4 | // 5 | // Created by sam on 2019/9/20. 6 | // Copyright © 2019 sam. All rights reserved. 7 | // 8 | 9 | #ifndef AHSOCRedux_h 10 | #define AHSOCRedux_h 11 | #import "AHSActionDispatcher.h" 12 | #import "AHSActionReducer.h" 13 | #import "AHSDetectStore.h" 14 | #import "AHSDispatchAction.h" 15 | #import "AHSRequestAction.h" 16 | #import "NSObject+Redux.h" 17 | 18 | #endif /* AHSOCRedux_h */ 19 | -------------------------------------------------------------------------------- /OCRedux/AHSRequestAction.h: -------------------------------------------------------------------------------- 1 | // 2 | // AHSRequestAction.h 3 | // AHSBasic 4 | // 5 | // Created by sam on 2019/5/31. 6 | // Copyright © 2019 sam. All rights reserved. 7 | // 8 | 9 | #import "AHSBaseModel.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface AHSRequestAction : AHSBaseModel 14 | @property (nonatomic, copy ) NSString *identifier; 15 | @property (nonatomic, strong) id data; 16 | @end 17 | 18 | NS_ASSUME_NONNULL_END 19 | -------------------------------------------------------------------------------- /OCRedux/AHSRequestAction.m: -------------------------------------------------------------------------------- 1 | // 2 | // AHSRequestAction.m 3 | // AHSBasic 4 | // 5 | // Created by sam on 2019/5/31. 6 | // Copyright © 2019 sam. All rights reserved. 7 | // 8 | 9 | #import "AHSRequestAction.h" 10 | 11 | @implementation AHSRequestAction 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /OCRedux/NSObject+Redux.h: -------------------------------------------------------------------------------- 1 | // 2 | // AHSBaseViewController+Redux.h 3 | // AHSBasic 4 | // 5 | // Created by sam on 2019/5/31. 6 | // Copyright © 2019 sam. All rights reserved. 7 | // 8 | 9 | #import "AHSBaseModel.h" 10 | #import "AHSActionDispatcher.h" 11 | #import "AHSRequestAction.h" 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | 15 | @interface NSObject(Redux) 16 | // 自己发送的 requestAction 的回调是一定可以收到的, 如果想收到别的回调, 需要手动添加 17 | // 如果只发送一个 request 可以不用写 id, 如果有多个则一定要写 id 18 | 19 | - (void)requestForUrl:(NSString *)url action:(AHSRequestAction *)action; 20 | - (void)requestForUrl:(NSString *)url action:(AHSRequestAction *)action inScope:(NSString *)scope; 21 | 22 | - (void)registToReceiveActionForIdentifier:(NSString *)identifier; 23 | 24 | // 子类 overwrite 25 | - (NSString *)defaultRequestActionIdentifier; 26 | @end 27 | 28 | NS_ASSUME_NONNULL_END 29 | -------------------------------------------------------------------------------- /OCRedux/NSObject+Redux.m: -------------------------------------------------------------------------------- 1 | // 2 | // AHSBaseViewController+Redux.m 3 | // AHSBasic 4 | // 5 | // Created by sam on 2019/5/31. 6 | // Copyright © 2019 sam. All rights reserved. 7 | // 8 | 9 | #import "NSObject+Redux.h" 10 | #import "AHSRequestAction.h" 11 | #import "AHSActionDispatcher.h" 12 | #import "AHSDetectStore.h" 13 | #import "AHSDetectStore+Private.h" 14 | 15 | NSString *ahs_default_scope = @"ahs_app"; 16 | @interface AHSActionDispatcher () 17 | - (void)addReceiver:(id )receiver forIdentifier:(NSString *)identifier; 18 | @end 19 | 20 | @implementation NSObject (Redux) 21 | - (void)requestForUrl:(NSString *)url action:(AHSRequestAction *)action inScope:(NSString *)scope { 22 | if (!action.identifier) action.identifier = [self defaultRequestActionIdentifier]; 23 | [[AHSActionDispatcher dispatcher] addReceiver:self forIdentifier:action.identifier]; 24 | [[AHSDetectStore store] handleUrl:url requestAction:action inScope:scope]; 25 | } 26 | 27 | - (void)requestForUrl:(NSString *)url action:(AHSRequestAction *)action { 28 | [self requestForUrl:url action:action inScope:ahs_default_scope]; 29 | } 30 | 31 | 32 | - (void)registToReceiveActionForIdentifier:(NSString *)identifier { 33 | [[AHSActionDispatcher dispatcher] addReceiver:self forIdentifier:identifier]; 34 | } 35 | 36 | - (void)handleAction:(AHSDispatchAction *)action { 37 | 38 | } 39 | 40 | - (NSString *)defaultRequestActionIdentifier { 41 | return NSStringFromClass([self class]); 42 | } 43 | @end 44 | -------------------------------------------------------------------------------- /OCReduxDemo/OCReduxDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 221C72112334F47D00E3D010 /* AHSBaseModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 221C72102334F47D00E3D010 /* AHSBaseModel.m */; }; 11 | 221C72222334F54200E3D010 /* AHSActionReducer.m in Sources */ = {isa = PBXBuildFile; fileRef = 221C72142334F54100E3D010 /* AHSActionReducer.m */; }; 12 | 221C72232334F54200E3D010 /* AHSRequestAction.m in Sources */ = {isa = PBXBuildFile; fileRef = 221C72162334F54100E3D010 /* AHSRequestAction.m */; }; 13 | 221C72242334F54200E3D010 /* AHSDetectStore.m in Sources */ = {isa = PBXBuildFile; fileRef = 221C72172334F54100E3D010 /* AHSDetectStore.m */; }; 14 | 221C72252334F54200E3D010 /* AHSActionDispatcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 221C72192334F54100E3D010 /* AHSActionDispatcher.m */; }; 15 | 221C72262334F54200E3D010 /* AHSDispatchAction.m in Sources */ = {isa = PBXBuildFile; fileRef = 221C721D2334F54100E3D010 /* AHSDispatchAction.m */; }; 16 | 221C72272334F54200E3D010 /* NSObject+Redux.m in Sources */ = {isa = PBXBuildFile; fileRef = 221C721E2334F54100E3D010 /* NSObject+Redux.m */; }; 17 | 221C722B2334F59200E3D010 /* AHSUploadLogReducer.m in Sources */ = {isa = PBXBuildFile; fileRef = 221C722A2334F59200E3D010 /* AHSUploadLogReducer.m */; }; 18 | 221C722E2334F5A300E3D010 /* AHSLogReducer.m in Sources */ = {isa = PBXBuildFile; fileRef = 221C722D2334F5A300E3D010 /* AHSLogReducer.m */; }; 19 | 22CFBA5D2334F40900D381B3 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 22CFBA5C2334F40900D381B3 /* AppDelegate.m */; }; 20 | 22CFBA602334F40900D381B3 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 22CFBA5F2334F40900D381B3 /* ViewController.m */; }; 21 | 22CFBA632334F40900D381B3 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 22CFBA612334F40900D381B3 /* Main.storyboard */; }; 22 | 22CFBA652334F40A00D381B3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 22CFBA642334F40A00D381B3 /* Assets.xcassets */; }; 23 | 22CFBA682334F40A00D381B3 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 22CFBA662334F40A00D381B3 /* LaunchScreen.storyboard */; }; 24 | 22CFBA6B2334F40A00D381B3 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 22CFBA6A2334F40A00D381B3 /* main.m */; }; 25 | 7B6E2C421D698C7D6AEAFA90 /* Pods_OCReduxDemo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E768845621F37ED501301A36 /* Pods_OCReduxDemo.framework */; }; 26 | /* End PBXBuildFile section */ 27 | 28 | /* Begin PBXFileReference section */ 29 | 221C720F2334F47D00E3D010 /* AHSBaseModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AHSBaseModel.h; sourceTree = ""; }; 30 | 221C72102334F47D00E3D010 /* AHSBaseModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AHSBaseModel.m; sourceTree = ""; }; 31 | 221C72122334F4B900E3D010 /* OCReduxDemo.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OCReduxDemo.pch; sourceTree = ""; }; 32 | 221C72142334F54100E3D010 /* AHSActionReducer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AHSActionReducer.m; sourceTree = ""; }; 33 | 221C72152334F54100E3D010 /* AHSDispatchAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AHSDispatchAction.h; sourceTree = ""; }; 34 | 221C72162334F54100E3D010 /* AHSRequestAction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AHSRequestAction.m; sourceTree = ""; }; 35 | 221C72172334F54100E3D010 /* AHSDetectStore.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AHSDetectStore.m; sourceTree = ""; }; 36 | 221C72182334F54100E3D010 /* NSObject+Redux.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+Redux.h"; sourceTree = ""; }; 37 | 221C72192334F54100E3D010 /* AHSActionDispatcher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AHSActionDispatcher.m; sourceTree = ""; }; 38 | 221C721A2334F54100E3D010 /* AHSDetectStore+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "AHSDetectStore+Private.h"; sourceTree = ""; }; 39 | 221C721B2334F54100E3D010 /* AHSActionReducer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AHSActionReducer.h; sourceTree = ""; }; 40 | 221C721C2334F54100E3D010 /* AHSOCRedux.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AHSOCRedux.h; sourceTree = ""; }; 41 | 221C721D2334F54100E3D010 /* AHSDispatchAction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AHSDispatchAction.m; sourceTree = ""; }; 42 | 221C721E2334F54100E3D010 /* NSObject+Redux.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+Redux.m"; sourceTree = ""; }; 43 | 221C721F2334F54100E3D010 /* AHSDetectStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AHSDetectStore.h; sourceTree = ""; }; 44 | 221C72202334F54100E3D010 /* AHSRequestAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AHSRequestAction.h; sourceTree = ""; }; 45 | 221C72212334F54100E3D010 /* AHSActionDispatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AHSActionDispatcher.h; sourceTree = ""; }; 46 | 221C72292334F59200E3D010 /* AHSUploadLogReducer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AHSUploadLogReducer.h; sourceTree = ""; }; 47 | 221C722A2334F59200E3D010 /* AHSUploadLogReducer.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AHSUploadLogReducer.m; sourceTree = ""; }; 48 | 221C722C2334F5A300E3D010 /* AHSLogReducer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AHSLogReducer.h; sourceTree = ""; }; 49 | 221C722D2334F5A300E3D010 /* AHSLogReducer.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AHSLogReducer.m; sourceTree = ""; }; 50 | 22CFBA582334F40900D381B3 /* OCReduxDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OCReduxDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 51 | 22CFBA5B2334F40900D381B3 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 52 | 22CFBA5C2334F40900D381B3 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 53 | 22CFBA5E2334F40900D381B3 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 54 | 22CFBA5F2334F40900D381B3 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 55 | 22CFBA622334F40900D381B3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 56 | 22CFBA642334F40A00D381B3 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 57 | 22CFBA672334F40A00D381B3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 58 | 22CFBA692334F40A00D381B3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 59 | 22CFBA6A2334F40A00D381B3 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 60 | D4C78C0DC28968B71791BBAB /* Pods-OCReduxDemo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OCReduxDemo.release.xcconfig"; path = "Target Support Files/Pods-OCReduxDemo/Pods-OCReduxDemo.release.xcconfig"; sourceTree = ""; }; 61 | E768845621F37ED501301A36 /* Pods_OCReduxDemo.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_OCReduxDemo.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 62 | FE909FE18E9794AF26FE2EB7 /* Pods-OCReduxDemo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OCReduxDemo.debug.xcconfig"; path = "Target Support Files/Pods-OCReduxDemo/Pods-OCReduxDemo.debug.xcconfig"; sourceTree = ""; }; 63 | /* End PBXFileReference section */ 64 | 65 | /* Begin PBXFrameworksBuildPhase section */ 66 | 22CFBA552334F40900D381B3 /* Frameworks */ = { 67 | isa = PBXFrameworksBuildPhase; 68 | buildActionMask = 2147483647; 69 | files = ( 70 | 7B6E2C421D698C7D6AEAFA90 /* Pods_OCReduxDemo.framework in Frameworks */, 71 | ); 72 | runOnlyForDeploymentPostprocessing = 0; 73 | }; 74 | /* End PBXFrameworksBuildPhase section */ 75 | 76 | /* Begin PBXGroup section */ 77 | 05EF79C089AB10F7B2DF18D9 /* Pods */ = { 78 | isa = PBXGroup; 79 | children = ( 80 | FE909FE18E9794AF26FE2EB7 /* Pods-OCReduxDemo.debug.xcconfig */, 81 | D4C78C0DC28968B71791BBAB /* Pods-OCReduxDemo.release.xcconfig */, 82 | ); 83 | path = Pods; 84 | sourceTree = ""; 85 | }; 86 | 221C72132334F54100E3D010 /* OCRedux */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | 221C721C2334F54100E3D010 /* AHSOCRedux.h */, 90 | 221C72212334F54100E3D010 /* AHSActionDispatcher.h */, 91 | 221C72192334F54100E3D010 /* AHSActionDispatcher.m */, 92 | 221C721B2334F54100E3D010 /* AHSActionReducer.h */, 93 | 221C72142334F54100E3D010 /* AHSActionReducer.m */, 94 | 221C721F2334F54100E3D010 /* AHSDetectStore.h */, 95 | 221C72172334F54100E3D010 /* AHSDetectStore.m */, 96 | 221C721A2334F54100E3D010 /* AHSDetectStore+Private.h */, 97 | 221C72152334F54100E3D010 /* AHSDispatchAction.h */, 98 | 221C721D2334F54100E3D010 /* AHSDispatchAction.m */, 99 | 221C72202334F54100E3D010 /* AHSRequestAction.h */, 100 | 221C72162334F54100E3D010 /* AHSRequestAction.m */, 101 | 221C72182334F54100E3D010 /* NSObject+Redux.h */, 102 | 221C721E2334F54100E3D010 /* NSObject+Redux.m */, 103 | ); 104 | name = OCRedux; 105 | path = ../../OCRedux; 106 | sourceTree = ""; 107 | }; 108 | 221C72282334F57100E3D010 /* Reducers */ = { 109 | isa = PBXGroup; 110 | children = ( 111 | 221C72292334F59200E3D010 /* AHSUploadLogReducer.h */, 112 | 221C722A2334F59200E3D010 /* AHSUploadLogReducer.m */, 113 | 221C722C2334F5A300E3D010 /* AHSLogReducer.h */, 114 | 221C722D2334F5A300E3D010 /* AHSLogReducer.m */, 115 | ); 116 | path = Reducers; 117 | sourceTree = ""; 118 | }; 119 | 22CFBA4F2334F40900D381B3 = { 120 | isa = PBXGroup; 121 | children = ( 122 | 22CFBA5A2334F40900D381B3 /* OCReduxDemo */, 123 | 22CFBA592334F40900D381B3 /* Products */, 124 | 05EF79C089AB10F7B2DF18D9 /* Pods */, 125 | FB2AA7ED49C9C7D496C08357 /* Frameworks */, 126 | ); 127 | sourceTree = ""; 128 | }; 129 | 22CFBA592334F40900D381B3 /* Products */ = { 130 | isa = PBXGroup; 131 | children = ( 132 | 22CFBA582334F40900D381B3 /* OCReduxDemo.app */, 133 | ); 134 | name = Products; 135 | sourceTree = ""; 136 | }; 137 | 22CFBA5A2334F40900D381B3 /* OCReduxDemo */ = { 138 | isa = PBXGroup; 139 | children = ( 140 | 221C72282334F57100E3D010 /* Reducers */, 141 | 221C72132334F54100E3D010 /* OCRedux */, 142 | 22CFBA5B2334F40900D381B3 /* AppDelegate.h */, 143 | 22CFBA5C2334F40900D381B3 /* AppDelegate.m */, 144 | 22CFBA5E2334F40900D381B3 /* ViewController.h */, 145 | 22CFBA5F2334F40900D381B3 /* ViewController.m */, 146 | 22CFBA612334F40900D381B3 /* Main.storyboard */, 147 | 22CFBA642334F40A00D381B3 /* Assets.xcassets */, 148 | 22CFBA662334F40A00D381B3 /* LaunchScreen.storyboard */, 149 | 22CFBA692334F40A00D381B3 /* Info.plist */, 150 | 22CFBA6A2334F40A00D381B3 /* main.m */, 151 | 221C720F2334F47D00E3D010 /* AHSBaseModel.h */, 152 | 221C72102334F47D00E3D010 /* AHSBaseModel.m */, 153 | 221C72122334F4B900E3D010 /* OCReduxDemo.pch */, 154 | ); 155 | path = OCReduxDemo; 156 | sourceTree = ""; 157 | }; 158 | FB2AA7ED49C9C7D496C08357 /* Frameworks */ = { 159 | isa = PBXGroup; 160 | children = ( 161 | E768845621F37ED501301A36 /* Pods_OCReduxDemo.framework */, 162 | ); 163 | name = Frameworks; 164 | sourceTree = ""; 165 | }; 166 | /* End PBXGroup section */ 167 | 168 | /* Begin PBXNativeTarget section */ 169 | 22CFBA572334F40900D381B3 /* OCReduxDemo */ = { 170 | isa = PBXNativeTarget; 171 | buildConfigurationList = 22CFBA6E2334F40A00D381B3 /* Build configuration list for PBXNativeTarget "OCReduxDemo" */; 172 | buildPhases = ( 173 | 7697A6E7FD5B0BC1191E6309 /* [CP] Check Pods Manifest.lock */, 174 | 22CFBA542334F40900D381B3 /* Sources */, 175 | 22CFBA552334F40900D381B3 /* Frameworks */, 176 | 22CFBA562334F40900D381B3 /* Resources */, 177 | 5F3860DEC9D50A679BDE3171 /* [CP] Embed Pods Frameworks */, 178 | ); 179 | buildRules = ( 180 | ); 181 | dependencies = ( 182 | ); 183 | name = OCReduxDemo; 184 | productName = OCReduxDemo; 185 | productReference = 22CFBA582334F40900D381B3 /* OCReduxDemo.app */; 186 | productType = "com.apple.product-type.application"; 187 | }; 188 | /* End PBXNativeTarget section */ 189 | 190 | /* Begin PBXProject section */ 191 | 22CFBA502334F40900D381B3 /* Project object */ = { 192 | isa = PBXProject; 193 | attributes = { 194 | LastUpgradeCheck = 1030; 195 | ORGANIZATIONNAME = sam; 196 | TargetAttributes = { 197 | 22CFBA572334F40900D381B3 = { 198 | CreatedOnToolsVersion = 10.3; 199 | }; 200 | }; 201 | }; 202 | buildConfigurationList = 22CFBA532334F40900D381B3 /* Build configuration list for PBXProject "OCReduxDemo" */; 203 | compatibilityVersion = "Xcode 9.3"; 204 | developmentRegion = en; 205 | hasScannedForEncodings = 0; 206 | knownRegions = ( 207 | en, 208 | Base, 209 | ); 210 | mainGroup = 22CFBA4F2334F40900D381B3; 211 | productRefGroup = 22CFBA592334F40900D381B3 /* Products */; 212 | projectDirPath = ""; 213 | projectRoot = ""; 214 | targets = ( 215 | 22CFBA572334F40900D381B3 /* OCReduxDemo */, 216 | ); 217 | }; 218 | /* End PBXProject section */ 219 | 220 | /* Begin PBXResourcesBuildPhase section */ 221 | 22CFBA562334F40900D381B3 /* Resources */ = { 222 | isa = PBXResourcesBuildPhase; 223 | buildActionMask = 2147483647; 224 | files = ( 225 | 22CFBA682334F40A00D381B3 /* LaunchScreen.storyboard in Resources */, 226 | 22CFBA652334F40A00D381B3 /* Assets.xcassets in Resources */, 227 | 22CFBA632334F40900D381B3 /* Main.storyboard in Resources */, 228 | ); 229 | runOnlyForDeploymentPostprocessing = 0; 230 | }; 231 | /* End PBXResourcesBuildPhase section */ 232 | 233 | /* Begin PBXShellScriptBuildPhase section */ 234 | 5F3860DEC9D50A679BDE3171 /* [CP] Embed Pods Frameworks */ = { 235 | isa = PBXShellScriptBuildPhase; 236 | buildActionMask = 2147483647; 237 | files = ( 238 | ); 239 | inputFileListPaths = ( 240 | ); 241 | inputPaths = ( 242 | "${PODS_ROOT}/Target Support Files/Pods-OCReduxDemo/Pods-OCReduxDemo-frameworks.sh", 243 | "${BUILT_PRODUCTS_DIR}/ReactiveCocoa/ReactiveCocoa.framework", 244 | "${BUILT_PRODUCTS_DIR}/YYKit/YYKit.framework", 245 | ); 246 | name = "[CP] Embed Pods Frameworks"; 247 | outputFileListPaths = ( 248 | ); 249 | outputPaths = ( 250 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ReactiveCocoa.framework", 251 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/YYKit.framework", 252 | ); 253 | runOnlyForDeploymentPostprocessing = 0; 254 | shellPath = /bin/sh; 255 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-OCReduxDemo/Pods-OCReduxDemo-frameworks.sh\"\n"; 256 | showEnvVarsInLog = 0; 257 | }; 258 | 7697A6E7FD5B0BC1191E6309 /* [CP] Check Pods Manifest.lock */ = { 259 | isa = PBXShellScriptBuildPhase; 260 | buildActionMask = 2147483647; 261 | files = ( 262 | ); 263 | inputFileListPaths = ( 264 | ); 265 | inputPaths = ( 266 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 267 | "${PODS_ROOT}/Manifest.lock", 268 | ); 269 | name = "[CP] Check Pods Manifest.lock"; 270 | outputFileListPaths = ( 271 | ); 272 | outputPaths = ( 273 | "$(DERIVED_FILE_DIR)/Pods-OCReduxDemo-checkManifestLockResult.txt", 274 | ); 275 | runOnlyForDeploymentPostprocessing = 0; 276 | shellPath = /bin/sh; 277 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 278 | showEnvVarsInLog = 0; 279 | }; 280 | /* End PBXShellScriptBuildPhase section */ 281 | 282 | /* Begin PBXSourcesBuildPhase section */ 283 | 22CFBA542334F40900D381B3 /* Sources */ = { 284 | isa = PBXSourcesBuildPhase; 285 | buildActionMask = 2147483647; 286 | files = ( 287 | 221C722B2334F59200E3D010 /* AHSUploadLogReducer.m in Sources */, 288 | 221C72222334F54200E3D010 /* AHSActionReducer.m in Sources */, 289 | 221C72252334F54200E3D010 /* AHSActionDispatcher.m in Sources */, 290 | 22CFBA602334F40900D381B3 /* ViewController.m in Sources */, 291 | 221C72232334F54200E3D010 /* AHSRequestAction.m in Sources */, 292 | 221C72112334F47D00E3D010 /* AHSBaseModel.m in Sources */, 293 | 221C722E2334F5A300E3D010 /* AHSLogReducer.m in Sources */, 294 | 221C72242334F54200E3D010 /* AHSDetectStore.m in Sources */, 295 | 221C72272334F54200E3D010 /* NSObject+Redux.m in Sources */, 296 | 22CFBA6B2334F40A00D381B3 /* main.m in Sources */, 297 | 22CFBA5D2334F40900D381B3 /* AppDelegate.m in Sources */, 298 | 221C72262334F54200E3D010 /* AHSDispatchAction.m in Sources */, 299 | ); 300 | runOnlyForDeploymentPostprocessing = 0; 301 | }; 302 | /* End PBXSourcesBuildPhase section */ 303 | 304 | /* Begin PBXVariantGroup section */ 305 | 22CFBA612334F40900D381B3 /* Main.storyboard */ = { 306 | isa = PBXVariantGroup; 307 | children = ( 308 | 22CFBA622334F40900D381B3 /* Base */, 309 | ); 310 | name = Main.storyboard; 311 | sourceTree = ""; 312 | }; 313 | 22CFBA662334F40A00D381B3 /* LaunchScreen.storyboard */ = { 314 | isa = PBXVariantGroup; 315 | children = ( 316 | 22CFBA672334F40A00D381B3 /* Base */, 317 | ); 318 | name = LaunchScreen.storyboard; 319 | sourceTree = ""; 320 | }; 321 | /* End PBXVariantGroup section */ 322 | 323 | /* Begin XCBuildConfiguration section */ 324 | 22CFBA6C2334F40A00D381B3 /* Debug */ = { 325 | isa = XCBuildConfiguration; 326 | buildSettings = { 327 | ALWAYS_SEARCH_USER_PATHS = NO; 328 | CLANG_ANALYZER_NONNULL = YES; 329 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 330 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 331 | CLANG_CXX_LIBRARY = "libc++"; 332 | CLANG_ENABLE_MODULES = YES; 333 | CLANG_ENABLE_OBJC_ARC = YES; 334 | CLANG_ENABLE_OBJC_WEAK = YES; 335 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 336 | CLANG_WARN_BOOL_CONVERSION = YES; 337 | CLANG_WARN_COMMA = YES; 338 | CLANG_WARN_CONSTANT_CONVERSION = YES; 339 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 340 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 341 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 342 | CLANG_WARN_EMPTY_BODY = YES; 343 | CLANG_WARN_ENUM_CONVERSION = YES; 344 | CLANG_WARN_INFINITE_RECURSION = YES; 345 | CLANG_WARN_INT_CONVERSION = YES; 346 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 347 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 348 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 349 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 350 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 351 | CLANG_WARN_STRICT_PROTOTYPES = YES; 352 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 353 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 354 | CLANG_WARN_UNREACHABLE_CODE = YES; 355 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 356 | CODE_SIGN_IDENTITY = "iPhone Developer"; 357 | COPY_PHASE_STRIP = NO; 358 | DEBUG_INFORMATION_FORMAT = dwarf; 359 | ENABLE_STRICT_OBJC_MSGSEND = YES; 360 | ENABLE_TESTABILITY = YES; 361 | GCC_C_LANGUAGE_STANDARD = gnu11; 362 | GCC_DYNAMIC_NO_PIC = NO; 363 | GCC_NO_COMMON_BLOCKS = YES; 364 | GCC_OPTIMIZATION_LEVEL = 0; 365 | GCC_PREPROCESSOR_DEFINITIONS = ( 366 | "DEBUG=1", 367 | "$(inherited)", 368 | ); 369 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 370 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 371 | GCC_WARN_UNDECLARED_SELECTOR = YES; 372 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 373 | GCC_WARN_UNUSED_FUNCTION = YES; 374 | GCC_WARN_UNUSED_VARIABLE = YES; 375 | IPHONEOS_DEPLOYMENT_TARGET = 12.4; 376 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 377 | MTL_FAST_MATH = YES; 378 | ONLY_ACTIVE_ARCH = YES; 379 | SDKROOT = iphoneos; 380 | }; 381 | name = Debug; 382 | }; 383 | 22CFBA6D2334F40A00D381B3 /* Release */ = { 384 | isa = XCBuildConfiguration; 385 | buildSettings = { 386 | ALWAYS_SEARCH_USER_PATHS = NO; 387 | CLANG_ANALYZER_NONNULL = YES; 388 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 389 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 390 | CLANG_CXX_LIBRARY = "libc++"; 391 | CLANG_ENABLE_MODULES = YES; 392 | CLANG_ENABLE_OBJC_ARC = YES; 393 | CLANG_ENABLE_OBJC_WEAK = YES; 394 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 395 | CLANG_WARN_BOOL_CONVERSION = YES; 396 | CLANG_WARN_COMMA = YES; 397 | CLANG_WARN_CONSTANT_CONVERSION = YES; 398 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 399 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 400 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 401 | CLANG_WARN_EMPTY_BODY = YES; 402 | CLANG_WARN_ENUM_CONVERSION = YES; 403 | CLANG_WARN_INFINITE_RECURSION = YES; 404 | CLANG_WARN_INT_CONVERSION = YES; 405 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 406 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 407 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 408 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 409 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 410 | CLANG_WARN_STRICT_PROTOTYPES = YES; 411 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 412 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 413 | CLANG_WARN_UNREACHABLE_CODE = YES; 414 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 415 | CODE_SIGN_IDENTITY = "iPhone Developer"; 416 | COPY_PHASE_STRIP = NO; 417 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 418 | ENABLE_NS_ASSERTIONS = NO; 419 | ENABLE_STRICT_OBJC_MSGSEND = YES; 420 | GCC_C_LANGUAGE_STANDARD = gnu11; 421 | GCC_NO_COMMON_BLOCKS = YES; 422 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 423 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 424 | GCC_WARN_UNDECLARED_SELECTOR = YES; 425 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 426 | GCC_WARN_UNUSED_FUNCTION = YES; 427 | GCC_WARN_UNUSED_VARIABLE = YES; 428 | IPHONEOS_DEPLOYMENT_TARGET = 12.4; 429 | MTL_ENABLE_DEBUG_INFO = NO; 430 | MTL_FAST_MATH = YES; 431 | SDKROOT = iphoneos; 432 | VALIDATE_PRODUCT = YES; 433 | }; 434 | name = Release; 435 | }; 436 | 22CFBA6F2334F40A00D381B3 /* Debug */ = { 437 | isa = XCBuildConfiguration; 438 | baseConfigurationReference = FE909FE18E9794AF26FE2EB7 /* Pods-OCReduxDemo.debug.xcconfig */; 439 | buildSettings = { 440 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 441 | CODE_SIGN_STYLE = Automatic; 442 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 443 | GCC_PREFIX_HEADER = "$(PROJECT_DIR)/OCReduxDemo/OCReduxDemo.pch"; 444 | INFOPLIST_FILE = OCReduxDemo/Info.plist; 445 | LD_RUNPATH_SEARCH_PATHS = ( 446 | "$(inherited)", 447 | "@executable_path/Frameworks", 448 | ); 449 | PRODUCT_BUNDLE_IDENTIFIER = www.sam.com.OCReduxDemo; 450 | PRODUCT_NAME = "$(TARGET_NAME)"; 451 | TARGETED_DEVICE_FAMILY = "1,2"; 452 | }; 453 | name = Debug; 454 | }; 455 | 22CFBA702334F40A00D381B3 /* Release */ = { 456 | isa = XCBuildConfiguration; 457 | baseConfigurationReference = D4C78C0DC28968B71791BBAB /* Pods-OCReduxDemo.release.xcconfig */; 458 | buildSettings = { 459 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 460 | CODE_SIGN_STYLE = Automatic; 461 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 462 | GCC_PREFIX_HEADER = "$(PROJECT_DIR)/OCReduxDemo/OCReduxDemo.pch"; 463 | INFOPLIST_FILE = OCReduxDemo/Info.plist; 464 | LD_RUNPATH_SEARCH_PATHS = ( 465 | "$(inherited)", 466 | "@executable_path/Frameworks", 467 | ); 468 | PRODUCT_BUNDLE_IDENTIFIER = www.sam.com.OCReduxDemo; 469 | PRODUCT_NAME = "$(TARGET_NAME)"; 470 | TARGETED_DEVICE_FAMILY = "1,2"; 471 | }; 472 | name = Release; 473 | }; 474 | /* End XCBuildConfiguration section */ 475 | 476 | /* Begin XCConfigurationList section */ 477 | 22CFBA532334F40900D381B3 /* Build configuration list for PBXProject "OCReduxDemo" */ = { 478 | isa = XCConfigurationList; 479 | buildConfigurations = ( 480 | 22CFBA6C2334F40A00D381B3 /* Debug */, 481 | 22CFBA6D2334F40A00D381B3 /* Release */, 482 | ); 483 | defaultConfigurationIsVisible = 0; 484 | defaultConfigurationName = Release; 485 | }; 486 | 22CFBA6E2334F40A00D381B3 /* Build configuration list for PBXNativeTarget "OCReduxDemo" */ = { 487 | isa = XCConfigurationList; 488 | buildConfigurations = ( 489 | 22CFBA6F2334F40A00D381B3 /* Debug */, 490 | 22CFBA702334F40A00D381B3 /* Release */, 491 | ); 492 | defaultConfigurationIsVisible = 0; 493 | defaultConfigurationName = Release; 494 | }; 495 | /* End XCConfigurationList section */ 496 | }; 497 | rootObject = 22CFBA502334F40900D381B3 /* Project object */; 498 | } 499 | -------------------------------------------------------------------------------- /OCReduxDemo/OCReduxDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /OCReduxDemo/OCReduxDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /OCReduxDemo/OCReduxDemo.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /OCReduxDemo/OCReduxDemo.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /OCReduxDemo/OCReduxDemo/AHSBaseModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // AHSBaseModel.h 3 | // OCReduxDemo 4 | // 5 | // Created by sam on 2019/9/20. 6 | // Copyright © 2019 sam. All rights reserved. 7 | // 8 | 9 | #import 10 | NS_ASSUME_NONNULL_BEGIN 11 | @interface AHSBaseModel : NSObject 12 | 13 | @end 14 | 15 | NS_ASSUME_NONNULL_END 16 | -------------------------------------------------------------------------------- /OCReduxDemo/OCReduxDemo/AHSBaseModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // AHSBaseModel.m 3 | // OCReduxDemo 4 | // 5 | // Created by sam on 2019/9/20. 6 | // Copyright © 2019 sam. All rights reserved. 7 | // 8 | 9 | #import "AHSBaseModel.h" 10 | @implementation AHSBaseModel 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /OCReduxDemo/OCReduxDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // OCReduxDemo 4 | // 5 | // Created by sam on 2019/9/20. 6 | // Copyright © 2019 sam. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /OCReduxDemo/OCReduxDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // OCReduxDemo 4 | // 5 | // Created by sam on 2019/9/20. 6 | // Copyright © 2019 sam. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | 24 | - (void)applicationWillResignActive:(UIApplication *)application { 25 | // 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. 26 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 27 | } 28 | 29 | 30 | - (void)applicationDidEnterBackground:(UIApplication *)application { 31 | // 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. 32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 33 | } 34 | 35 | 36 | - (void)applicationWillEnterForeground:(UIApplication *)application { 37 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 38 | } 39 | 40 | 41 | - (void)applicationDidBecomeActive:(UIApplication *)application { 42 | // 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. 43 | } 44 | 45 | 46 | - (void)applicationWillTerminate:(UIApplication *)application { 47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 48 | } 49 | 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /OCReduxDemo/OCReduxDemo/Assets.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 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /OCReduxDemo/OCReduxDemo/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /OCReduxDemo/OCReduxDemo/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /OCReduxDemo/OCReduxDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /OCReduxDemo/OCReduxDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /OCReduxDemo/OCReduxDemo/OCReduxDemo.pch: -------------------------------------------------------------------------------- 1 | // 2 | // OCReduxDemo.pch 3 | // OCReduxDemo 4 | // 5 | // Created by sam on 2019/9/20. 6 | // Copyright © 2019 sam. All rights reserved. 7 | // 8 | 9 | #ifndef OCReduxDemo_pch 10 | #define OCReduxDemo_pch 11 | 12 | // Include any system framework and library headers here that should be included in all compilation units. 13 | // You will also need to set the Prefix Header build setting of one or more of your targets to reference this file. 14 | #import 15 | #import 16 | #import "AHSBaseModel.h" 17 | #import "AHSOCRedux.h" 18 | #endif /* OCReduxDemo_pch */ 19 | -------------------------------------------------------------------------------- /OCReduxDemo/OCReduxDemo/Reducers/AHSLogReducer.h: -------------------------------------------------------------------------------- 1 | // 2 | // AHSLogReducer.h 3 | // OCReduxDemo 4 | // 5 | // Created by sam on 2019/9/20. 6 | // Copyright © 2019 sam. All rights reserved. 7 | // 8 | 9 | #import "AHSActionReducer.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface AHSLogReducer : AHSActionReducer 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /OCReduxDemo/OCReduxDemo/Reducers/AHSLogReducer.m: -------------------------------------------------------------------------------- 1 | // 2 | // AHSLogReducer.m 3 | // OCReduxDemo 4 | // 5 | // Created by sam on 2019/9/20. 6 | // Copyright © 2019 sam. All rights reserved. 7 | // 8 | 9 | #import "AHSLogReducer.h" 10 | 11 | @implementation AHSLogReducer 12 | + (void)load { 13 | AHSLogReducer *reducer = [AHSLogReducer new]; 14 | [reducer registForUrl:@"ahs://nouserInterfaceinteraction"]; 15 | [reducer registToReceiveActionForIdentifier:@"log_data"]; 16 | } 17 | 18 | - (void)handleAction:(AHSDispatchDataAction *)action { 19 | if ([action isKindOfClass:[AHSDispatchDataAction class]]) { 20 | NSLog(@"log is %@", action.data); 21 | } 22 | } 23 | @end 24 | -------------------------------------------------------------------------------- /OCReduxDemo/OCReduxDemo/Reducers/AHSUploadLogReducer.h: -------------------------------------------------------------------------------- 1 | // 2 | // AHSUploadLogReducer.h 3 | // OCReduxDemo 4 | // 5 | // Created by sam on 2019/9/20. 6 | // Copyright © 2019 sam. All rights reserved. 7 | // 8 | 9 | #import "AHSActionReducer.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface AHSUploadLogReducer : AHSActionReducer 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /OCReduxDemo/OCReduxDemo/Reducers/AHSUploadLogReducer.m: -------------------------------------------------------------------------------- 1 | // 2 | // AHSUploadLogReducer.m 3 | // OCReduxDemo 4 | // 5 | // Created by sam on 2019/9/20. 6 | // Copyright © 2019 sam. All rights reserved. 7 | // 8 | 9 | #import "AHSUploadLogReducer.h" 10 | #import 11 | @implementation AHSUploadLogReducer 12 | + (void)load { 13 | AHSUploadLogReducer *reducer = [AHSUploadLogReducer new]; 14 | [reducer registForUrl:@"ahs://uploadlog"]; 15 | [reducer registForUrl:@"ahs://otherurl"]; 16 | } 17 | 18 | - (void)handleUrl:(NSString *)url requestAction:(AHSRequestAction *)action { 19 | if ([url isEqualToString:@"ahs://uploadlog"]) { 20 | NSLog(@"上传的日志为 %@", action.data); 21 | AHSDispatchSignalAction *progressAction = [AHSDispatchSignalAction new]; 22 | progressAction.identifier = action.identifier; 23 | progressAction.signal = [RACSignal createSignal:^RACDisposable *(id subscriber) { 24 | [[[RACSignal interval:1 onScheduler:RACScheduler.mainThreadScheduler] take:10] subscribe:subscriber]; 25 | return nil; 26 | }]; 27 | ahs_redux_dispatch(progressAction); 28 | 29 | AHSDispatchDataAction *logAction = [AHSDispatchDataAction new]; 30 | logAction.identifier = @"log_data"; 31 | logAction.data = action.data; 32 | ahs_redux_dispatch(logAction); 33 | } 34 | } 35 | 36 | - (void)startWith:(NSString *)url { 37 | if ([url isEqualToString:@"ahs://uploadlog"]) { 38 | NSLog(@"init job for ahs://uploadlog"); 39 | } else if ([url isEqualToString:@"ahs://otherurl"]) { 40 | NSLog(@"init job for ahs://otherurl"); 41 | } 42 | } 43 | @end 44 | -------------------------------------------------------------------------------- /OCReduxDemo/OCReduxDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // OCReduxDemo 4 | // 5 | // Created by sam on 2019/9/20. 6 | // Copyright © 2019 sam. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /OCReduxDemo/OCReduxDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // OCReduxDemo 4 | // 5 | // Created by sam on 2019/9/20. 6 | // Copyright © 2019 sam. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | @interface ViewController () 12 | 13 | @end 14 | 15 | @implementation ViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view. 20 | self.view.backgroundColor = [UIColor redColor]; 21 | AHSRequestAction *action = [AHSRequestAction new]; 22 | action.data = @"白日依山尽, 黄河入海流, 欲穷千里目, 更上一层楼"; 23 | action.identifier = @"ahs://uploadlog"; 24 | [self requestForUrl:@"ahs://uploadlog" action:action]; 25 | } 26 | 27 | 28 | - (void)handleAction:(AHSDispatchSignalAction *)action { 29 | if ([action isKindOfClass:[AHSDispatchSignalAction class]] && 30 | [action.identifier isEqualToString:@"ahs://uploadlog"]) { 31 | [action.signal subscribeNext:^(id x) { 32 | NSLog(@"上传中"); 33 | } completed:^{ 34 | NSLog(@"上传完成"); 35 | }]; 36 | } 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /OCReduxDemo/OCReduxDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // OCReduxDemo 4 | // 5 | // Created by sam on 2019/9/20. 6 | // Copyright © 2019 sam. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /OCReduxDemo/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment the next line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | use_frameworks! 4 | inhibit_all_warnings! 5 | target 'OCReduxDemo' do 6 | # Uncomment the next line if you're using Swift or would like to use dynamic frameworks 7 | # use_frameworks! 8 | 9 | # Pods for OcReduxDemo 10 | pod 'YYKit' , '1.0.9' 11 | pod 'ReactiveCocoa', '2.5.0' 12 | 13 | end 14 | -------------------------------------------------------------------------------- /OCReduxDemo/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - ReactiveCocoa (2.5): 3 | - ReactiveCocoa/UI (= 2.5) 4 | - ReactiveCocoa/Core (2.5): 5 | - ReactiveCocoa/no-arc 6 | - ReactiveCocoa/no-arc (2.5) 7 | - ReactiveCocoa/UI (2.5): 8 | - ReactiveCocoa/Core 9 | - YYKit (1.0.9): 10 | - YYKit/no-arc (= 1.0.9) 11 | - YYKit/no-arc (1.0.9) 12 | 13 | DEPENDENCIES: 14 | - ReactiveCocoa (= 2.5.0) 15 | - YYKit (= 1.0.9) 16 | 17 | SPEC REPOS: 18 | https://github.com/cocoapods/specs.git: 19 | - ReactiveCocoa 20 | - YYKit 21 | 22 | SPEC CHECKSUMS: 23 | ReactiveCocoa: e2db045570aa97c695e7aa97c2bcab222ae51f4a 24 | YYKit: 7cda43304a8dc3696c449041e2cb3107b4e236e7 25 | 26 | PODFILE CHECKSUM: b72620a2cc70eb64952f12e3f567f011b195acdc 27 | 28 | COCOAPODS: 1.6.1 29 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | ## AHSRedux 2 | AHSRedux 是 react-redux + thunk 的简易实现, 同时根据 iOS 平台的特点做了合理的精简 3 | 4 | ### 与 redux 相同的地方 5 | 1. store, action, reducer, dispatcher, 基本元素一致 6 | 2. 由 store 管理所有的 reducer 7 | 3. 由 action 触发状态改变 8 | 4. 由 diapatcher 分发 action 9 | 10 | ### 与 react-redux 不同的地方 11 | 由于 iOS 有天然的 controller, 所以我们只需要关心 controller 层级的状态共享即可, AHSRedux 相对于标准的 react-redux 有如下区别 12 | 1. 隐式的 store, 使用者不需要手动创建 store, 也不需要 combineReducer, 一切都自然而然的发生 13 | 2. 分散的 state, iOS controller 之间共享的状态可能仅仅是几个属性, 因此维持一个统一的 state 树显得非常的没有必要, 由相关的 reducer 管理 14 | 3. 方便的 connect, 相较于 react-redux 中 connect 的弯弯绕, AHSRedux 的状态绑定显得非常直接, 一句话概括为, 谁请求, 谁处理, 谁需要, 谁订阅 15 | 4. 天然的 thunk, AHSRedux 并没有中间件系统, 因此借助 ReactiveCocoa 将 thunk 整合了进来, 使用方式与其他 action 统一 16 | 17 | ### 示例 18 | 1. 上传一段日志, 并监听状态 19 | ```objc 20 | 21 | - (void)viewDidLoad { 22 | [super viewDidLoad]; 23 | // Do any additional setup after loading the view. 24 | self.view.backgroundColor = [UIColor redColor]; 25 | AHSRequestAction *action = [AHSRequestAction new]; 26 | action.data = @"白日依山尽, 黄河入海流, 欲穷千里目, 更上一层楼"; 27 | action.identifier = @"ahs://uploadlog"; 28 | [self requestForUrl:@"ahs://uploadlog" action:action]; 29 | } 30 | 31 | - (void)handleAction:(AHSDispatchSignalAction *)action { 32 | if ([action isKindOfClass:[AHSDispatchSignalAction class]] && 33 | [action.identifier isEqualToString:@"ahs://uploadlog"]) { 34 | [action.signal subscribeNext:^(id x) { 35 | NSLog(@"上传中"); 36 | } completed:^{ 37 | NSLog(@"上传完成"); 38 | }]; 39 | } 40 | } 41 | 42 | ``` 43 | 44 | 2. 注册 reducer, 订阅需要的信息或状态 45 | 46 | ```objc 47 | @implementation AHSUploadLogReducer 48 | + (void)load { 49 | AHSUploadLogReducer *reducer = [AHSUploadLogReducer new]; 50 | [reducer registForUrl:@"ahs://uploadlog"]; 51 | [reducer registForUrl:@"ahs://otherurl"]; 52 | } 53 | 54 | - (void)handleUrl:(NSString *)url requestAction:(AHSRequestAction *)action { 55 | if ([url isEqualToString:@"ahs://uploadlog"]) { 56 | NSLog(@"上传的日志为 %@", action.data); 57 | AHSDispatchSignalAction *progressAction = [AHSDispatchSignalAction new]; 58 | progressAction.identifier = action.identifier; 59 | progressAction.signal = [RACSignal createSignal:^RACDisposable *(id subscriber) { 60 | [[[RACSignal interval:1 onScheduler:RACScheduler.mainThreadScheduler] take:10] subscribe:subscriber]; 61 | return nil; 62 | }]; 63 | ahs_redux_dispatch(progressAction); 64 | 65 | AHSDispatchDataAction *logAction = [AHSDispatchDataAction new]; 66 | logAction.identifier = @"log_data"; 67 | logAction.data = action.data; 68 | ahs_redux_dispatch(logAction); 69 | } 70 | } 71 | 72 | - (void)startWith:(NSString *)url { 73 | if ([url isEqualToString:@"ahs://uploadlog"]) { 74 | NSLog(@"init job for ahs://uploadlog"); 75 | } else if ([url isEqualToString:@"ahs://otherurl"]) { 76 | NSLog(@"init job for ahs://otherurl"); 77 | } 78 | } 79 | @end 80 | 81 | @implementation AHSLogReducer 82 | + (void)load { 83 | AHSLogReducer *reducer = [AHSLogReducer new]; 84 | [reducer registForUrl:@"ahs://nouserInterfaceinteraction"]; 85 | [reducer registToReceiveActionForIdentifier:@"log_data"]; 86 | } 87 | 88 | - (void)handleAction:(AHSDispatchDataAction *)action { 89 | if ([action isKindOfClass:[AHSDispatchDataAction class]]) { 90 | NSLog(@"log is %@", action.data); 91 | } 92 | } 93 | @end 94 | ``` 95 | ### 写在最后 96 | AHSRedux 是为了应对跨模块, 跨界面之间消息传递和状态共享的需求, 参考了前端的 react-redux, 根据 iOS 平台的特点实现的一个库. 是一层很薄的实现, 并没有限制做任何的扩展. 97 | --------------------------------------------------------------------------------