- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我有一个 View 和一个 View 模型。 View 包含一个按钮,每次用户按下它时,我都希望 View Model 得到通知。我还希望在第一个 View 模型收到事件时通知第二个 View 模型。
因此点击事件将按如下方式传播:
Button -> ViewModel1 -> ViewModel2
我可以通过将 button.rx_tap
绑定(bind)到 viewModel1.onButtonTapped()
来设计它,但是因为我希望 viewModel2
订阅也得到事件,我需要某种可观察到的接收 Action 并传播它的对象。我相信这就是 RACCommand
所做的。
我如何使用 RxSwift 实现它?
最佳答案
现在在 RxSwift 本身中没有直接等同于 RACCommand
。
但是,在RxSwiftCommunity 中有一个项目,叫做Action ,其灵感来自 RACCommand
。
RxSwift 的创建者在 GitHub issue建议在 RACCommand
可能有用的某些情况下可以使用 ActivityIndicator
类。
关于ios - RxSwift 中 RACCommand 的等价物是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36070549/
使用 ReactiveCocoa 2.0,是否有更好的方法来执行以下操作,而无需具体化/取消具体化,并且仍然能够从 3 个信号中的任何一个捕获错误,而无需重复代码? 有 3 个登录按钮。每个都返回一个
我一直在研究 MVVM example ,使用 ReactiveCocoa,它是一个 Collection View 中的 App.net 帖子的简单集合,它在到达 Collection View 的
我正在使用 UAGitHubEngine 访问 GitHub 的 API。我想编写一个功能性的响应式(Reactive)应用程序来获取一些数据。我依赖于代码 here设置异步网络请求。我正在寻找的是某
在 MVVM pattern , ViewModel发个RACCommand和 View使用 RACCommand 绑定(bind)按钮,但是如何测试RACCommand ? 我有两个方面需要测试:
我有一个用于保存数据元素数组的 UITableView 的 ViewModel。 UITableView 实现了下拉刷新和无限滚动行为。数据元素是通过 RestKit 从服务器以分页方式请求的,这意味
我如何创建 2 个 RACCommand,以便在另一个执行时禁用一个,并且反之亦然? 像这样, _prevTrackCommand = [[RACCommand alloc] initWithEnab
我将 RACCommand 用于我的 UI 按钮单击事件。我正在使用 MVVM 架构。在我的 ViewModel 中,我有这个: @property (strong, nonatomic) RACCo
我有一个 View 和一个 View 模型。 View 包含一个按钮,每次用户按下它时,我都希望 View Model 得到通知。我还希望在第一个 View 模型收到事件时通知第二个 View 模型。
我是 Reactive Cocoa Framework 的新手,我只是在做一些简单的测试,但我遇到了一个我想了解的问题。 基本上,我只是执行一个 API 调用以从我的服务器获取一个 JSON 对象,我
我学习了很多关于 ReactiveCocoa 的知识但有一件事仍然让我感到困惑:为什么 RACCommand 上的信号 block 本身会返回一个信号? 我了解 RACCommand 的用例、它的 c
我有一个登录按钮,其中分配了一个 RACCommand 来执行登录请求并返回一个用户对象。 我想处理按钮信号错误中的错误。 loginButton.rac_command.executionSigna
我在我的应用程序中使用 ReactiveCocoa 框架来获得使用 MVVM 设计模式的强大功能。 所以对于每个 Controller ,我都有一个 ViewModel。并且Controller绑定(
我是一名优秀的程序员,十分优秀!