We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
我的代码如下,但是列表就是没有数据展示?实在不解
class ViewController: UIViewController{ var viewModel : MyViewModel? = MyViewModel() let disposeBag = DisposeBag() var tableView : UITableView! = { var tableView = UITableView(frame: UIScreen.main.bounds, style: .plain) tableView.rowHeight = 44.0 tableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell") tableView.tableFooterView = UIView() return tableView }() override func viewDidLoad() { super.viewDidLoad() view.addSubview(tableView) self.viewModel? .homeAction? .execute(()) .bind(to: tableView.rx.items(cellIdentifier: "cell", cellType: UITableViewCell.self)){ index, model, cell in cell.textLabel?.text = model.nick_name } //.disposed(by:disposeBag) }
var homeAction: Action<Void, [BaseUser]>? let model = Model() var data: [BaseUser]? init() { initialize() } func initialize() { homeAction = Action<Void, [BaseUser]>.init(workFactory: {[unowned self] in var params : Dictionary<String, Any> = [:] params["lp"] = "" params["page"] = "1" params["age_min"] = "-1" params["age_max"] = "-1" params["height_min"] = "-1" params["height_max"] = "-1" params["prov"] = "" params["city"] = "" params["user_id"] = "1" return self.model.request(UserAPI.homeList(params), Msg<BaseUser>.self) .debug() .map{$0.list ?? []} .do(onNext: { self.data = $0 }) })
The text was updated successfully, but these errors were encountered:
do onNext里面顺利回调了么?
Sorry, something went wrong.
@JianweiWangs 原来是我删除了 MVVM/Model/RxMoya/MoyaProvider+Rx.swift 文件,导致请求网络后没正常响应。 我发现Moya/RxSwift 下也要一个相同名字的文件。这两个文件不是一样的吗?
不是一样的,这个在Moya下也是一个isuess,主要是moya对象自身是否需要被持有的问题,我有意覆盖掉了,诸如你这种情况直接用Moya的就会发生请求序列的dispose。
明白,谢谢
No branches or pull requests
我的代码如下,但是列表就是没有数据展示?实在不解
The text was updated successfully, but these errors were encountered: