Skip to content

Commit f5b0688

Browse files
committed
添加扩展
1 parent 04fa857 commit f5b0688

File tree

4 files changed

+60
-4
lines changed

4 files changed

+60
-4
lines changed

JSONModel.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
Pod::Spec.new do |s|
22
s.name = "JSONModel"
3-
s.version = "1.1.1"
3+
s.version = "1.1.2"
44
s.summary = "Magical Data Modelling Framework for JSON. Create rapidly powerful, atomic and smart data model classes."
55
s.homepage = "http://www.jsonmodel.com"
66

77
s.license = { :type => 'MIT', :file => 'LICENSE_jsonmodel.txt' }
88
s.author = { "Marin Todorov" => "touch-code-magazine@underplot.com" }
99

10-
s.source = { :git => "https://github.com/icanzilb/JSONModel.git", :tag => "1.1.1" }
10+
s.source = { :git => "git@github.com:shulianyong/JSONModel.git", :tag => "1.1.2" }
1111

1212
s.ios.deployment_target = '5.0'
1313
s.osx.deployment_target = '10.7'
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//
2+
// JSONModel+SLYExtension.h
3+
// MeiQiReferrer
4+
//
5+
// Created by neil on 15/4/13.
6+
// Copyright (c) 2015年 MeiQi iOS Dev Team. All rights reserved.
7+
//
8+
9+
#import "JSONModel.h"
10+
11+
@interface JSONModel (SLYExtension)
12+
13+
//获取所有的属性
14+
- (NSDictionary*)classProperties;
15+
16+
@end
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
//
2+
// JSONModel+SLYExtension.m
3+
// MeiQiReferrer
4+
//
5+
// Created by neil on 15/4/13.
6+
// Copyright (c) 2015年 MeiQi iOS Dev Team. All rights reserved.
7+
//
8+
9+
#import <objc/runtime.h>
10+
#import "JSONModel+SLYExtension.h"
11+
12+
extern const char * kClassPropertiesKey;
13+
14+
@interface JSONModel ()
15+
16+
-(void)__setup__;
17+
18+
@end
19+
20+
@implementation JSONModel (SLYExtension)
21+
22+
//获取所有的属性
23+
- (NSDictionary*)classProperties
24+
{
25+
NSDictionary* classProperties = objc_getAssociatedObject(self.class, &kClassPropertiesKey);
26+
if (classProperties)
27+
return classProperties;
28+
//if here, the class needs to inspect itself
29+
[self __setup__];
30+
return [self classProperties];
31+
}
32+
33+
34+
@end

JSONModelDemo_iOS.xcodeproj/project.pbxproj

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10-
4A50001D19C5DCCF00C161A0 /* InitWithDataTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A50001C19C5DCCF00C161A0 /* InitWithDataTests.m */; };
10+
28AAF20D1B0B3AF70006A101 /* JSONModel+SLYExtension.m in Sources */ = {isa = PBXBuildFile; fileRef = 28AAF20C1B0B3AF70006A101 /* JSONModel+SLYExtension.m */; };
1111
358FD078D3C0D56C77ACD770 /* ExtremeNestingModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 358FDBE28A19497358D1A6DA /* ExtremeNestingModel.m */; };
1212
358FD179E0B41C47C67713B5 /* InteractionModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 358FDCB3CFE05DBA0DE27E5F /* InteractionModel.m */; };
1313
358FD61804BD21F41035348E /* ExtremeNestingTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 358FDBA42551FF88466BD5C3 /* ExtremeNestingTests.m */; };
1414
358FD640BFEAB00349FBBA4A /* DrugModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 358FD25356988AC33EA6A935 /* DrugModel.m */; };
15+
4A50001D19C5DCCF00C161A0 /* InitWithDataTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A50001C19C5DCCF00C161A0 /* InitWithDataTests.m */; };
1516
69286BDA17FA280900D1BA81 /* nestedDataWithDictionaryError.json in Resources */ = {isa = PBXBuildFile; fileRef = 69286BD917FA280900D1BA81 /* nestedDataWithDictionaryError.json */; };
1617
69286BDB17FA280900D1BA81 /* nestedDataWithDictionaryError.json in Resources */ = {isa = PBXBuildFile; fileRef = 69286BD917FA280900D1BA81 /* nestedDataWithDictionaryError.json */; };
1718
697852FD17D934B5006BFCD0 /* nestedDataWithTypeMismatchOnImages.json in Resources */ = {isa = PBXBuildFile; fileRef = 697852FC17D934B5006BFCD0 /* nestedDataWithTypeMismatchOnImages.json */; };
@@ -156,7 +157,8 @@
156157
/* End PBXContainerItemProxy section */
157158

158159
/* Begin PBXFileReference section */
159-
4A50001C19C5DCCF00C161A0 /* InitWithDataTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InitWithDataTests.m; sourceTree = "<group>"; };
160+
28AAF20B1B0B3AF70006A101 /* JSONModel+SLYExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "JSONModel+SLYExtension.h"; sourceTree = "<group>"; };
161+
28AAF20C1B0B3AF70006A101 /* JSONModel+SLYExtension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "JSONModel+SLYExtension.m"; sourceTree = "<group>"; };
160162
358FD25356988AC33EA6A935 /* DrugModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DrugModel.m; sourceTree = "<group>"; };
161163
358FD7AD55FD213CBAAB460F /* ExtremeNestingModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExtremeNestingModel.h; sourceTree = "<group>"; };
162164
358FD807C3E86F5DC4058645 /* ExtremeNestingTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExtremeNestingTests.h; sourceTree = "<group>"; };
@@ -165,6 +167,7 @@
165167
358FDBE28A19497358D1A6DA /* ExtremeNestingModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ExtremeNestingModel.m; sourceTree = "<group>"; };
166168
358FDCB3CFE05DBA0DE27E5F /* InteractionModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InteractionModel.m; sourceTree = "<group>"; };
167169
358FDED5E028AA00D3E6564D /* InteractionModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InteractionModel.h; sourceTree = "<group>"; };
170+
4A50001C19C5DCCF00C161A0 /* InitWithDataTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InitWithDataTests.m; sourceTree = "<group>"; };
168171
69286BD917FA280900D1BA81 /* nestedDataWithDictionaryError.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = nestedDataWithDictionaryError.json; sourceTree = "<group>"; };
169172
697852FC17D934B5006BFCD0 /* nestedDataWithTypeMismatchOnImages.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = nestedDataWithTypeMismatchOnImages.json; sourceTree = "<group>"; };
170173
697852FE17D93546006BFCD0 /* nestedDataWithTypeMismatchOnImagesObject.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = nestedDataWithTypeMismatchOnImagesObject.json; sourceTree = "<group>"; };
@@ -493,6 +496,8 @@
493496
9C66E014168CF0AA0015CCDF /* JSONModelCategories */ = {
494497
isa = PBXGroup;
495498
children = (
499+
28AAF20B1B0B3AF70006A101 /* JSONModel+SLYExtension.h */,
500+
28AAF20C1B0B3AF70006A101 /* JSONModel+SLYExtension.m */,
496501
9C66E015168CF0AA0015CCDF /* NSArray+JSONModel.h */,
497502
9C66E016168CF0AA0015CCDF /* NSArray+JSONModel.m */,
498503
);
@@ -925,6 +930,7 @@
925930
9C55AF0F189033AE004EBD8A /* GitHubRepoModel.m in Sources */,
926931
9CBBBFB1166BBB05008B4326 /* MyDataModel.m in Sources */,
927932
9CBBBFB5166BBB21008B4326 /* StorageViewController.m in Sources */,
933+
28AAF20D1B0B3AF70006A101 /* JSONModel+SLYExtension.m in Sources */,
928934
9C0D0240166E6BBF001EA645 /* KivaViewControllerNetworking.m in Sources */,
929935
9C55AF0E18903300004EBD8A /* ReposModel.m in Sources */,
930936
9C66E024168CF0AA0015CCDF /* JSONModel.m in Sources */,

0 commit comments

Comments
 (0)