Git Product home page Git Product logo

nysmc's Introduction

(logo) NYSMC

  • 自动选择加载“壳应用”/“真应用”的简单框架。
  • Auto Choose Sheel/Application framework.

How to use

  • Installation with CocoaPods:pod 'NYSMC','~>0.2.0'
  • Manual import:
    • Drag All files in the NYSMC folder to project
    • Import the main file:#import <NYSMC/NYSMC.h>

Application Instance by NYSMC

Running MOV Flow Chart Image

- Example Program

Server API Pattern:

  • Step 1.Need Server API
/** 需要后端组的同学准备一个接口 */
// Method: POST
// Server: http://xxx.NYSMC.com:8080
// API: /api/getReviewData
// Parameters: PARM
/* JSON返回数据结构:*/
{
    "param": {},
    "error": null,
    "returnValue": {
        "gmtCreate": "2018-06-25 11:12:35",
        "gmtModify": null,
        "id": 1,
        "version": "1.0", //(审核中版本号)
        "reviewTime": 1534419240000, //(预计审核完成时间)
        "url": "github.com/niyongsheng", //(链接地址)
        "status": 0 //(马甲开关:0关闭  1开启)
    },
    "msg": null,
    "list": null,
    "unread": null,
    "type": null,
    "success": true
}
  • Step 2.AppDelegate.m
#import <NYSMC/NYSMC.h>
#import "tabViewController.h"

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // I.初始化NYSC
    [NYSCake initWithEstimatedAuditDays:2 PostURL:@"http://xxx.NYSMC.com:8080/api/getReviewData" ValidateParameters:PARM BootMethod:NYSCBootMethod_Cold];
    // II.选择分支
    [NYSCake chooseViewControllerWithPriorityType:NYSCPriorityType_Server_Status errorBootFromType:BootFrom_Sheel matchSheelBlock:^{
        // 马甲
        self.window.rootViewController = [[tabViewController alloc] init];
        [self.window makeKeyAndVisible];
    } ApplicationBlock:^{
        // 应用
        self.window.rootViewController = [[NYSWebViewController alloc] init];
        [self.window makeKeyAndVisible];
    }];
    
    // III.获取服务器中的配置参数(热启动不需要调用此方法)
    [NYSCake updataServerParameters];
    
    return YES;
}

NO Server API Pattern:

  • Step 1.Add Shell

    XCode->Product->Scheme->Edit Scheme->Build->Pre-actions->Add new shell(New run script action)

echo "In the build time script run."
infoplist="$BUILT_PRODUCTS_DIR/$INFOPLIST_PATH"
builddate=`date`
if [[ -n "$builddate" ]]; then
# if BuildDateString doesn't exist, add it
/usr/libexec/PlistBuddy -c "Add :BuildDate string $builddate" ${infoplist}
# and if BuildDateString already existed, update it
/usr/libexec/PlistBuddy -c "Set :BuildDate string $builddate" ${infoplist}
fi
  • Step 2.AppDelegate.m
#import <NYSMC/NYSMC.h>

#import "SheelViewController.h"
#import "ApplicationViewController.h"

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // I.初始化NYSC
    [NYSCake initWithEstimatedAuditDays:2 PostURL:nil ValidateParameters:nil BootMethod:NYSCBootMethod_Cold];
    // II.选择分支
    [NYSCake chooseViewControllerWithPriorityType:NYSCPriorityType_Server_Version errorBootFromType:BootFrom_Application matchSheelBlock:^{
    	// 马甲
        self.window.rootViewController = [[SheelViewController alloc] init];
        [self.window makeKeyAndVisible];
    } ApplicationBlock:^{
    	// 应用
        self.window.rootViewController = [[ApplicationViewController alloc] init];
        [self.window makeKeyAndVisible];
    }];
    
    return YES;
}

Remind

  • ARC
  • iOS >= 8.0
  • iPhone \ iPad screen anyway

Contribution

Reward🍭 Encourage❤️

Contact Me :octocat:

nysmc's People

Contributors

niyongsheng avatar

Watchers

James Cloos avatar CharleeLv avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.