Coder Social home page Coder Social logo

easymvvm's Introduction

image-20190423005047011

EasyMVVM 是什么?

EasyMVVM是EasyReact的上层框架,可以用来作为MVVM的最佳实践。

特性

  • 可监听的 action
  • 绑定一个 action 到 UIButton 上
  • 串行/并行执行若干个 action
  • 在值变化时执行一个action并将值本身作为参数
  • UIControls 和 UIGestureRecognizers 支持可监听的 value 扩展
  • 内存高速数据交换中心
  • 事件对象 Event 和事件处理行为 Handler
  • 数据绑定,和事件绑定API
  • 带有修改记录的容器

系统需求

  • iOS 8.0+
  • Xcode 8.0+

如何运行示例项目

clone 本项目,在 Example 文件夹下执行pod install,然后打开EasyMVVM.xcworkspace.

安装

CocoaPods

Podfile中添加

pod 'EasyMVVM'

然后运行pod install即可

如何使用 (如需更详细的例子,请查看示例工程 Tests 文件夹下的测试用例)

可监听结果和错误的 Action

ERAction<NSNumber *> *action = [[ERAction alloc] initWithBlock:^(id param, EZRNode *result, EZRNode<NSError *> *error) {
    result.value = @([param integERNode] * 10);
}];
[action execute:@123];
// action.result.value => @1230

ERAction *action = [ERAction actionWithBlock:^(id param, EZRNode *result, EZRNode<NSError *> *error) {
    if (!param) {
        error.value = [NSError errorWithDomain:@"xx" code:123 userInfo:@{@"reason": @"param is nil"}];
    } else {
        result.value = @"succ";
    }
}];
[action execute:nil];
// action.error.value => [NSError errorWithDomain:@"xx" code:123 userInfo:@{@"reason": @"param is nil"}];

单元测试

EasyMVVM 包含了完善的单元测试,相关代码在示例工程的 Tests 文件夹下。你可以打开示例工程并执行 Test 命令来运行这些单元测试。

Author

WilliamZang, [email protected]
姜沂, [email protected] Qin Hong, [email protected] SketchK, [email protected]

License

EasyReact is Apache Public License 2.0

easymvvm's People

Contributors

soulteary avatar

Watchers

 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.