To run the example project, clone the repo, and run pod install
from the Example directory first.
MSAppModuleKit is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "MSAppModuleKit"
Ryan Wang, [email protected]
MSAppModuleKit is available under the MIT license. See the LICENSE file for more info.
For example: WebApp
Column | Name |
---|---|
Module | MSAppModuleWebApp |
Setting | MSAppSettingsWebApp |
RepoName | MSAppModuleWebApp |
Use pod lib create
Ref
Create Module with CocoaPods
- Custom your Finder 使用
[MSActiveControllerFinder setFinder:[CustomFinder new]];
Set it when app launch - run
[MSActiveControllerFinder finder]
, You can get the a Finder,If you just don't implement it by yourself,[MSActiveControllerFinder finder]
will give you a TopViewController which is based on a UITabBarController+UINavigationControllers structure - Before you route you can execute
[MSActiveControllerFinder finder].resetStatus();
(implement by yourself). Usually You can close your sliderController if needed
CocoaPods helps you a lot to isolate your module with each other, it make modules hardly to be tainted.
Settings can make your same module works in different apps! Or you need to do is implement all Modules' settings in a setting class
id<OneOfYouModuleSettings> settings = [appModuleManager appModuleWithClass:[YourModuleClass class]].moduleSettings;
NSString *productId = settings.productId;
// ...
- (void)moduleRegisterRoutes:(JLRoutes *)route {
#if USE_TRADE_FLAG
[route addRoute:@"trade" priority:0 handler:^BOOL(NSDictionary *parameters) {
[MSActiveControllerFinder finder].resetStatus();
NSString *stockCode = parameters[@"stockCode"];
NSString *tradeType = parameters[@"tradeType"];
UINavigationController *navController = [MSActiveControllerFinder finder].activeNavigationController();
[navController pushToTradeStockCode:[stockCode integerValue] withTradeType:[tradeType integerValue]];
return YES;
}];
#else
NSLog(@"模拟器为实现买卖股票");
#endif
}
- (void)moduleUnregisterRoutes:(JLRoutes *)route {
[route removeRoute:@"trade"]
}
|PageName |ModuleName | App-URL | Web-URL | pageId | |------ | ---- | ----- |--- | ---- | ----- | |Community| Community | community | | | |Web| WebApp | web | | |