Skip to content

Latest commit

 

History

History
109 lines (73 loc) · 3.68 KB

README.md

File metadata and controls

109 lines (73 loc) · 3.68 KB

MSAppModuleKit

Join the chat at https://gitter.im/aelam/MSAppModuleKit

CI Status Version License Platform

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

MSAppModuleKit is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "MSAppModuleKit"

Author

Ryan Wang, wanglun02@gmail.com

License

MSAppModuleKit is available under the MIT license. See the LICENSE file for more info.

Module Development

Module Naming

For example: WebApp

Column Name
Module MSAppModuleWebApp
Setting MSAppSettingsWebApp
RepoName MSAppModuleWebApp

Create

Use pod lib create Ref Create Module with CocoaPods

Finder, find the current TopViewController

  1. Custom your Finder 使用[MSActiveControllerFinder setFinder:[CustomFinder new]]; Set it when app launch
  2. 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
  3. Before you route you can execute [MSActiveControllerFinder finder].resetStatus(); (implement by yourself). Usually You can close your sliderController if needed

Development

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;
// ...

Register Routes

- (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"]
}

App Architecture

App Architecture

Push to Specs

Create Module with CocoaPods

Module Tables on a server

|PageName |ModuleName | App-URL | Web-URL | pageId | |------ | ---- | ----- |--- | ---- | ----- | |Community| Community | community | | | |Web| WebApp | web | | |