From 71f94bed5ad0482fb96401838c419a53169e676f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=E4=BA=86=E4=B8=AAJ?= Date: Fri, 22 Jul 2016 18:43:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=80=E4=BA=9B=E5=B0=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1.某些属性的懒加载转为init初始化 2.过期方法处理 3.用更简单的方法过滤NSObject自动生成的属性 --- MJExtension.podspec | 2 +- MJExtension/MJProperty.m | 15 ++++----------- MJExtension/NSObject+MJProperty.m | 9 ++------- MJExtension/NSString+MJExtension.m | 4 +++- MJExtensionExample/main.m | 2 +- 5 files changed, 11 insertions(+), 21 deletions(-) diff --git a/MJExtension.podspec b/MJExtension.podspec index d7b49627..de57767a 100644 --- a/MJExtension.podspec +++ b/MJExtension.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "MJExtension" - s.version = "3.0.12" + s.version = "3.0.13" s.ios.deployment_target = '6.0' s.osx.deployment_target = '10.8' s.summary = "A fast and convenient conversion between JSON and model" diff --git a/MJExtension/MJProperty.m b/MJExtension/MJProperty.m index 2489d9a5..96710faf 100644 --- a/MJExtension/MJProperty.m +++ b/MJExtension/MJProperty.m @@ -18,21 +18,14 @@ @interface MJProperty() @implementation MJProperty -#pragma mark - 懒加载 -- (NSMutableDictionary *)propertyKeysDict +#pragma mark - 初始化 +- (instancetype)init { - if (!_propertyKeysDict) { + if (self = [super init]) { _propertyKeysDict = [NSMutableDictionary dictionary]; - } - return _propertyKeysDict; -} - -- (NSMutableDictionary *)objectClassInArrayDict -{ - if (!_objectClassInArrayDict) { _objectClassInArrayDict = [NSMutableDictionary dictionary]; } - return _objectClassInArrayDict; + return self; } #pragma mark - 缓存 diff --git a/MJExtension/NSObject+MJProperty.m b/MJExtension/NSObject+MJProperty.m index 2314c460..c9aff546 100644 --- a/MJExtension/NSObject+MJProperty.m +++ b/MJExtension/NSObject+MJProperty.m @@ -163,13 +163,8 @@ + (NSMutableArray *)properties // 2.遍历每一个成员变量 for (unsigned int i = 0; i