Commit e6ffac3d authored by jz's avatar jz

add WMFetchDataViewModel+GMRequest.h

parent 23b71a2b
//
// WMFetchDataViewModel+GMRequest.h
// Gengmei
//
// Created by 汪俊 on 2017/7/13.
// Copyright © 2017年 更美互动信息科技有限公司. All rights reserved.
//
#import "WMFetchDataViewModel.h"
@interface WMFetchDataViewModel (GMRequest)
/**
因为这个是拼在url query中,所以后端给我们时,我们不需求关心它是NSNumber或者是String类型,原样传回去就可以
但其实在get方法的确是返回了String类型,因为这样便于清空offset,及对offset进行判断
未来offset会集成到FetchDataViewModel
*/
@property (nonatomic, strong) id offset;
@end
//
// WMFetchDataViewModel+GMRequest.m
// Gengmei
//
// Created by 汪俊 on 2017/7/13.
// Copyright © 2017年 更美互动信息科技有限公司. All rights reserved.
//
#import "WMFetchDataViewModel+GMRequest.h"
#import <objc/runtime.h>
@implementation WMFetchDataViewModel (GMRequest)
- (void)setOffset:(id)offset {
objc_setAssociatedObject(self, @selector(offset), offset, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
- (id)offset {
id _offset = objc_getAssociatedObject(self, @selector(offset));
if (_offset == nil) {
return @"";
}
if ([_offset isKindOfClass:[NSNumber class]]) {
return [_offset stringValue];
}
return _offset;
}
@end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment