// // MTAddFriendViewModel.m // // Created by Simon on 2019/8/16. // Copyright © 2019 Simon. All rights reserved. // #import "MTAddFriendViewModel.h" @implementation MTAddFriendViewModel -(NSArray *)listArray{ if (!_listArray) { _listArray = [NSArray array]; } return _listArray; } - (RACCommand *)command { if (!_command) { _command = [[RACCommand alloc] initWithSignalBlock:^RACSignal * _Nonnull(id _Nullable input) { return [RACSignal createSignal:^RACDisposable * _Nullable(id _Nonnull subscriber) { [MTHttpTool httpRequest:HttpRequestTypeOfPOST url:HTTP_SEVER_APPEND(@"") para:input success:^(MTBaseModel *baseModel) { [baseModel clarifyResultWithSuccess:^{ [subscriber sendNext:baseModel.data]; } failed:^(NSInteger code) { ShowMessage(baseModel.msg); }]; [subscriber sendCompleted]; } failure:^(NSError *error) { ShowMessage(@"网络链接失败"); [subscriber sendCompleted]; }]; return nil; }]; }]; } return _command; } - (RACSubject *)subject { if (!_subject) { _subject = [RACSubject subject]; } return _subject; } @end