Coder Social home page Coder Social logo

doraemonplugins's Introduction

DoraemonPlugins

DoraemonKit插件

示例图

  • 环境切换插件

    用于app内部环境的切换

可以添加自定义环境

  • JS脚本插件

    用于在webView执行JavaScript代码

要求

  • Swift 5.0 / Objective-C
  • Xcode 11
  • iOS 9.0+

使用


//添加DoraemonEnvPlugin
[DoraemonEnvPlugin installWithTitle:@"环境切换" icon:[UIImage imageNamed:@"icon_env"] desc:@"用于app内部环境切换" atModule:@"业务专区" handle:^(NSString * _Nonnull env, NSString * _Nonnull data) {
  //当环境变更时,会触发handle回调,你在这里修改相关的环境配置
  apiUrl = data; //比如修改接口地址
}];
//支持添加默认环境
[DoraemonEnvPlugin addDefaultEnv:@"正式环境" withData:@"https://api.domain.com"];
[DoraemonEnvPlugin addDefaultEnv:@"测试环境" withData:@"https://test-api.domain.com"];

//添加DoraemonJavaScriptPlugin
[DoraemonJavaScriptPlugin installWithTitle:@"JS脚本" icon:[UIImage imageNamed:@"icon_js"] desc:@"用于在指定webView中执行JS代码" atModule:@"业务专区" handle:^(id  _Nullable result, NSError * _Nullable error) {
  //JS代码执行的返回结果
  NSLog(@"result: %@", result);
}];

集成

CocoaPods
pod 'DoraemonPlugins'
Swift Package Manager
dependencies: [
    .package(url: "https://github.com/moliya/DoraemonPlugins", from: "1.2")
]

License

DoraemonPlugins is released under the MIT license. See LICENSE for details.

doraemonplugins's People

Contributors

moliya avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

learn-to-use

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.