1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- //
- // YMBaseViewModel.m
- // MSYOUPAI
- //
- // Created by YoMi on 2024/2/4.
- // Copyright © 2024 MS. All rights reserved.
- //
- #import "YMBaseViewModel.h"
- @interface YMBaseViewModel()
- /// 参数
- @property (nonatomic, copy, readwrite) NSDictionary *params;
- /// 刷新UI
- @property (nonatomic, strong, readwrite) RACSubject *refreshUISubject;
- @end
- @implementation YMBaseViewModel
- + (instancetype)allocWithZone:(struct _NSZone *)zone {
- YMBaseViewModel *viewModel = [super allocWithZone:zone];
-
- @weakify(viewModel)
- [[viewModel rac_signalForSelector:@selector(initWithParams:)] subscribeNext:^(id x) {
- @strongify(viewModel)
- [viewModel ym_initialize];
- }];
-
- return viewModel;
- }
- - (instancetype)initWithParams:(NSDictionary *)params {
- if (self = [super init]) {
- self.params = params;
- }
- return self;
- }
- - (void)ym_initialize {
- }
- - (RACSubject *)refreshUISubject {
- if (!_refreshUISubject) {
- _refreshUISubject = [RACSubject subject];
- }
- return _refreshUISubject;
- }
- @end
|