-
Notifications
You must be signed in to change notification settings - Fork 451
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
132 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// | ||
// SMKAbstractMediator.h | ||
// SUIMVVMDemo | ||
// | ||
// Created by yuantao on 16/4/15. | ||
// Copyright © 2016年 lovemo. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import "SMKViewModelProtocol.h" | ||
#import "SMKViewMangerProtocol.h" | ||
|
||
@interface SMKAbstractMediator : NSObject | ||
|
||
/** | ||
* viewModel | ||
*/ | ||
@property (nonatomic, strong) NSObject<SMKViewModelProtocol> *viewModel; | ||
|
||
/** | ||
* viewManger | ||
*/ | ||
@property (nonatomic, strong) NSObject<SMKViewMangerProtocol> *viewManger; | ||
|
||
/** | ||
* 初始化 | ||
*/ | ||
- (instancetype)initWithViewModel:(id<SMKViewModelProtocol>)viewModel viewManger:(id<SMKViewMangerProtocol>)viewManger; | ||
|
||
+ (instancetype)mediatorWithViewModel:(id<SMKViewModelProtocol>)viewModel viewManger:(id<SMKViewMangerProtocol>)viewManger; | ||
|
||
/** | ||
* 将infos通知viewModel | ||
*/ | ||
- (void)noticeViewModelWithInfos:(NSDictionary *)infos; | ||
|
||
/** | ||
* 将infos通知viewMnager | ||
*/ | ||
- (void)noticeViewMangerWithInfos:(NSDictionary *)infos; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// | ||
// SMKAbstractMediator.m | ||
// SUIMVVMDemo | ||
// | ||
// Created by yuantao on 16/4/15. | ||
// Copyright © 2016年 lovemo. All rights reserved. | ||
// | ||
|
||
#import "SMKAbstractMediator.h" | ||
#import "NSObject+SMKRequest.h" | ||
|
||
@implementation SMKAbstractMediator | ||
|
||
- (instancetype)initWithViewModel:(id<SMKViewModelProtocol>)viewModel viewManger:(id<SMKViewMangerProtocol>)viewManger { | ||
if (self = [super init]) { | ||
self.viewModel = (NSObject<SMKViewModelProtocol> *)viewModel; | ||
self.viewManger = (NSObject<SMKViewMangerProtocol> *)viewManger; | ||
} | ||
return self; | ||
} | ||
|
||
+ (instancetype)mediatorWithViewModel:(id<SMKViewModelProtocol>)viewModel viewManger:(id<SMKViewMangerProtocol>)viewManger { | ||
return [[self alloc]initWithViewModel:viewModel viewManger:viewManger]; | ||
} | ||
|
||
- (void)noticeViewModelWithInfos:(NSDictionary *)infos { | ||
self.viewModel.smk_viewModelInfos = infos; | ||
} | ||
|
||
- (void)noticeViewMangerWithInfos:(NSDictionary *)infos { | ||
self.viewManger.smk_viewMangerInfos = infos; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters