├── Pods ├── Headers │ ├── Private │ │ ├── Mantle │ │ │ ├── Mantle.h │ │ │ ├── MTLModel.h │ │ │ ├── EXTScope.h │ │ │ ├── MTLJSONAdapter.h │ │ │ ├── MTLReflection.h │ │ │ ├── metamacros.h │ │ │ ├── MTLModel+NSCoding.h │ │ │ ├── MTLValueTransformer.h │ │ │ ├── EXTKeyPathCoding.h │ │ │ ├── EXTRuntimeExtensions.h │ │ │ ├── NSError+MTLModelException.h │ │ │ ├── MTLTransformerErrorHandling.h │ │ │ ├── NSDictionary+MTLJSONKeyPath.h │ │ │ ├── NSObject+MTLComparisonAdditions.h │ │ │ ├── NSArray+MTLManipulationAdditions.h │ │ │ ├── NSDictionary+MTLMappingAdditions.h │ │ │ ├── NSDictionary+MTLManipulationAdditions.h │ │ │ ├── NSValueTransformer+MTLInversionAdditions.h │ │ │ └── NSValueTransformer+MTLPredefinedTransformerAdditions.h │ │ ├── JSONKit-NoWarning │ │ │ └── JSONKit.h │ │ ├── JSONModel │ │ │ ├── JSONModelLib.h │ │ │ ├── JSONModel.h │ │ │ ├── JSONAPI.h │ │ │ ├── JSONModelArray.h │ │ │ ├── JSONModelError.h │ │ │ ├── JSONHTTPClient.h │ │ │ ├── JSONKeyMapper.h │ │ │ ├── JSONModelClassProperty.h │ │ │ ├── NSArray+JSONModel.h │ │ │ ├── JSONModel+networking.h │ │ │ └── JSONValueTransformer.h │ │ ├── MGBenchmark │ │ │ ├── MGBenchmark.h │ │ │ ├── MGConsoleUtil.h │ │ │ ├── MGBenchmarkSession.h │ │ │ ├── MGConsoleOutput.h │ │ │ ├── MGBenchmarkTarget.h │ │ │ └── MGConsoleSummaryOutput.h │ │ └── MJExtension │ │ │ ├── MJConst.h │ │ │ ├── MJType.h │ │ │ ├── MJProperty.h │ │ │ ├── MJExtension.h │ │ │ ├── MJFoundation.h │ │ │ ├── NSObject+MJCoding.h │ │ │ ├── NSObject+MJKeyValue.h │ │ │ ├── NSObject+MJProperty.h │ │ │ └── NSString+MJExtension.h │ └── Public │ │ ├── Mantle │ │ ├── Mantle.h │ │ ├── MTLModel.h │ │ ├── MTLJSONAdapter.h │ │ ├── MTLReflection.h │ │ ├── MTLModel+NSCoding.h │ │ ├── MTLValueTransformer.h │ │ ├── MTLTransformerErrorHandling.h │ │ ├── NSDictionary+MTLJSONKeyPath.h │ │ ├── NSError+MTLModelException.h │ │ ├── NSArray+MTLManipulationAdditions.h │ │ ├── NSDictionary+MTLMappingAdditions.h │ │ ├── NSObject+MTLComparisonAdditions.h │ │ ├── NSDictionary+MTLManipulationAdditions.h │ │ ├── NSValueTransformer+MTLInversionAdditions.h │ │ └── NSValueTransformer+MTLPredefinedTransformerAdditions.h │ │ ├── JSONKit-NoWarning │ │ └── JSONKit.h │ │ ├── JSONModel │ │ ├── JSONModelLib.h │ │ ├── JSONModel.h │ │ ├── JSONAPI.h │ │ ├── JSONModelArray.h │ │ ├── JSONModelError.h │ │ ├── JSONHTTPClient.h │ │ ├── JSONKeyMapper.h │ │ ├── JSONModelClassProperty.h │ │ ├── NSArray+JSONModel.h │ │ ├── JSONModel+networking.h │ │ └── JSONValueTransformer.h │ │ ├── MGBenchmark │ │ ├── MGBenchmark.h │ │ ├── MGConsoleUtil.h │ │ ├── MGBenchmarkSession.h │ │ ├── MGConsoleOutput.h │ │ ├── MGBenchmarkTarget.h │ │ └── MGConsoleSummaryOutput.h │ │ └── MJExtension │ │ ├── MJConst.h │ │ ├── MJType.h │ │ ├── MJProperty.h │ │ ├── MJExtension.h │ │ ├── MJFoundation.h │ │ ├── NSObject+MJCoding.h │ │ ├── NSObject+MJKeyValue.h │ │ ├── NSObject+MJProperty.h │ │ └── NSString+MJExtension.h ├── Target Support Files │ ├── Pods-JsonReciprocityTests-JSONModel │ │ ├── Pods-JsonReciprocityTests-JSONModel.xcconfig │ │ ├── Pods-JsonReciprocityTests-JSONModel-prefix.pch │ │ ├── Pods-JsonReciprocityTests-JSONModel-dummy.m │ │ └── Pods-JsonReciprocityTests-JSONModel-Private.xcconfig │ ├── Pods-JsonReciprocityTests-MGBenchmark │ │ ├── Pods-JsonReciprocityTests-MGBenchmark.xcconfig │ │ ├── Pods-JsonReciprocityTests-MGBenchmark-prefix.pch │ │ ├── Pods-JsonReciprocityTests-MGBenchmark-dummy.m │ │ └── Pods-JsonReciprocityTests-MGBenchmark-Private.xcconfig │ ├── Pods-JsonReciprocityTests-MJExtension │ │ ├── Pods-JsonReciprocityTests-MJExtension.xcconfig │ │ ├── Pods-JsonReciprocityTests-MJExtension-prefix.pch │ │ ├── Pods-JsonReciprocityTests-MJExtension-dummy.m │ │ └── Pods-JsonReciprocityTests-MJExtension-Private.xcconfig │ ├── Pods-JsonReciprocityTests-JSONKit-NoWarning │ │ ├── Pods-JsonReciprocityTests-JSONKit-NoWarning.xcconfig │ │ ├── Pods-JsonReciprocityTests-JSONKit-NoWarning-prefix.pch │ │ ├── Pods-JsonReciprocityTests-JSONKit-NoWarning-dummy.m │ │ └── Pods-JsonReciprocityTests-JSONKit-NoWarning-Private.xcconfig │ ├── Pods-JsonReciprocityTests-Mantle │ │ ├── Pods-JsonReciprocityTests-Mantle.xcconfig │ │ ├── Pods-JsonReciprocityTests-Mantle-prefix.pch │ │ ├── Pods-JsonReciprocityTests-Mantle-dummy.m │ │ └── Pods-JsonReciprocityTests-Mantle-Private.xcconfig │ └── Pods-JsonReciprocityTests │ │ ├── Pods-JsonReciprocityTests-dummy.m │ │ ├── Pods-JsonReciprocityTests.debug.xcconfig │ │ ├── Pods-JsonReciprocityTests.release.xcconfig │ │ └── Pods-JsonReciprocityTests-environment.h ├── JSONKit-NoWarning │ └── README.md ├── MJExtension │ ├── MJExtensionExample │ │ └── MJExtensionExample │ │ │ └── MJExtension │ │ │ ├── NSString+MJExtension.h │ │ │ ├── MJFoundation.h │ │ │ ├── NSString+MJExtension.m │ │ │ ├── MJExtension.h │ │ │ ├── MJConst.m │ │ │ ├── MJType.h │ │ │ ├── NSObject+MJCoding.h │ │ │ ├── MJFoundation.m │ │ │ ├── MJProperty.h │ │ │ ├── NSObject+MJCoding.m │ │ │ ├── MJType.m │ │ │ ├── MJConst.h │ │ │ ├── NSObject+MJProperty.h │ │ │ └── MJProperty.m │ └── LICENSE ├── Mantle │ ├── Mantle │ │ ├── extobjc │ │ │ ├── EXTScope.m │ │ │ ├── EXTKeyPathCoding.h │ │ │ ├── EXTRuntimeExtensions.h │ │ │ └── EXTScope.h │ │ ├── NSObject+MTLComparisonAdditions.m │ │ ├── NSObject+MTLComparisonAdditions.h │ │ ├── MTLTransformerErrorHandling.m │ │ ├── NSDictionary+MTLMappingAdditions.h │ │ ├── NSValueTransformer+MTLInversionAdditions.h │ │ ├── NSDictionary+MTLMappingAdditions.m │ │ ├── NSError+MTLModelException.h │ │ ├── Mantle.h │ │ ├── NSArray+MTLManipulationAdditions.h │ │ ├── NSArray+MTLManipulationAdditions.m │ │ ├── NSDictionary+MTLJSONKeyPath.h │ │ ├── NSError+MTLModelException.m │ │ ├── NSDictionary+MTLManipulationAdditions.m │ │ ├── NSDictionary+MTLManipulationAdditions.h │ │ ├── MTLReflection.h │ │ ├── NSValueTransformer+MTLInversionAdditions.m │ │ ├── NSDictionary+MTLJSONKeyPath.m │ │ ├── MTLReflection.m │ │ ├── MTLValueTransformer.h │ │ ├── MTLTransformerErrorHandling.h │ │ └── NSValueTransformer+MTLPredefinedTransformerAdditions.h │ └── LICENSE.md ├── MGBenchmark │ ├── LICENSE.txt │ └── MGBenchmark │ │ ├── Output │ │ ├── MGConsoleUtil.h │ │ ├── MGBenchmarkTarget.h │ │ ├── MGConsoleUtil.m │ │ ├── MGConsoleSummaryOutput.h │ │ ├── MGConsoleOutput.m │ │ ├── MGConsoleOutput.h │ │ └── MGConsoleSummaryOutput.m │ │ ├── MGBenchmarkSession.h │ │ ├── MGBenchmark.h │ │ ├── MGBenchmark.m │ │ └── MGBenchmarkSession.m └── JSONModel │ ├── LICENSE_jsonmodel.txt │ └── JSONModel │ ├── JSONModelCategories │ ├── NSArray+JSONModel.m │ └── NSArray+JSONModel.h │ ├── JSONModelLib.h │ ├── JSONModel │ ├── JSONModelClassProperty.m │ ├── JSONModelArray.h │ └── JSONModelClassProperty.h │ └── JSONModelNetworking │ └── JSONModel+networking.m ├── JsonReciprocity.xcodeproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── JsonReciprocity ├── Model │ ├── CarModel.m │ ├── HouseModel.m │ ├── BaseObject.m │ ├── CarModel.h │ ├── HouseModel.h │ ├── BaseObject.h │ ├── TestObject.h │ ├── PersonModel.h │ ├── PersonModel.m │ └── TestObject.m ├── ViewController.h ├── JsonReciprocity │ ├── JsonReciprocity.h │ ├── NSMutableDictionary+SafeSet.h │ ├── JsonReciprocityManager.h │ ├── JsonSerialization.h │ ├── NSMutableDictionary+SafeSet.m │ ├── JsonReciprocityManager.m │ ├── JsonDeserialization.h │ ├── NSObject+JsonReciprocity.h │ ├── JsonSerialization.m │ └── JsonDeserializstion.m ├── AppDelegate.h ├── main.m ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Info.plist ├── Base.lproj │ ├── Main.storyboard │ └── LaunchScreen.xib └── AppDelegate.m ├── JsonReciprocityTests ├── TestModels │ ├── CarJsonModel.m │ ├── HouseJsonModel.m │ ├── SimpleTypeTestModel.m │ ├── CustomObject.m │ ├── CarJsonModel.h │ ├── CarMTLModel.h │ ├── CarMTLModel.m │ ├── HouseJsonModel.h │ ├── IrregularTestModel.m │ ├── HouseMTLModel.m │ ├── PersonJsonModel.m │ ├── HouseMTLModel.h │ ├── CustomObject.h │ ├── IrregularTestModel.h │ ├── PersonJsonModel.h │ ├── PersonMTLModel.h │ ├── PersonMTLModel.m │ └── SimpleTypeTestModel.h ├── JsonFile │ ├── irregular_key.json │ ├── single_complex.json │ ├── simple_type.json │ └── complex.json ├── Info.plist ├── JsonReciprocityTests.m ├── IrregularTests.m ├── JsonSerializationTests.m ├── CustomTests.m ├── SimpleTypeTests.m ├── ObjectSerializationTests.m ├── ExchangeEachTests.m └── ComplexStructureTests.m ├── JsonReciprocity.xcworkspace └── contents.xcworkspacedata ├── Podfile ├── .gitignore ├── JsonReciprocity.podspec └── LICENSE /Pods/Headers/Private/Mantle/Mantle.h: -------------------------------------------------------------------------------- 1 | ../../../Mantle/Mantle/Mantle.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Mantle/Mantle.h: -------------------------------------------------------------------------------- 1 | ../../../Mantle/Mantle/Mantle.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Mantle/MTLModel.h: -------------------------------------------------------------------------------- 1 | ../../../Mantle/Mantle/MTLModel.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Mantle/MTLModel.h: -------------------------------------------------------------------------------- 1 | ../../../Mantle/Mantle/MTLModel.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Mantle/EXTScope.h: -------------------------------------------------------------------------------- 1 | ../../../Mantle/Mantle/extobjc/EXTScope.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Mantle/MTLJSONAdapter.h: -------------------------------------------------------------------------------- 1 | ../../../Mantle/Mantle/MTLJSONAdapter.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Mantle/MTLReflection.h: -------------------------------------------------------------------------------- 1 | ../../../Mantle/Mantle/MTLReflection.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Mantle/metamacros.h: -------------------------------------------------------------------------------- 1 | ../../../Mantle/Mantle/extobjc/metamacros.h -------------------------------------------------------------------------------- /Pods/Headers/Public/JSONKit-NoWarning/JSONKit.h: -------------------------------------------------------------------------------- 1 | ../../../JSONKit-NoWarning/JSONKit.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Mantle/MTLJSONAdapter.h: -------------------------------------------------------------------------------- 1 | ../../../Mantle/Mantle/MTLJSONAdapter.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Mantle/MTLReflection.h: -------------------------------------------------------------------------------- 1 | ../../../Mantle/Mantle/MTLReflection.h -------------------------------------------------------------------------------- /Pods/Headers/Private/JSONKit-NoWarning/JSONKit.h: -------------------------------------------------------------------------------- 1 | ../../../JSONKit-NoWarning/JSONKit.h -------------------------------------------------------------------------------- /Pods/Headers/Private/JSONModel/JSONModelLib.h: -------------------------------------------------------------------------------- 1 | ../../../JSONModel/JSONModel/JSONModelLib.h -------------------------------------------------------------------------------- /Pods/Headers/Public/JSONModel/JSONModelLib.h: -------------------------------------------------------------------------------- 1 | ../../../JSONModel/JSONModel/JSONModelLib.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Mantle/MTLModel+NSCoding.h: -------------------------------------------------------------------------------- 1 | ../../../Mantle/Mantle/MTLModel+NSCoding.h -------------------------------------------------------------------------------- /Pods/Headers/Private/JSONModel/JSONModel.h: -------------------------------------------------------------------------------- 1 | ../../../JSONModel/JSONModel/JSONModel/JSONModel.h -------------------------------------------------------------------------------- /Pods/Headers/Private/MGBenchmark/MGBenchmark.h: -------------------------------------------------------------------------------- 1 | ../../../MGBenchmark/MGBenchmark/MGBenchmark.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Mantle/MTLModel+NSCoding.h: -------------------------------------------------------------------------------- 1 | ../../../Mantle/Mantle/MTLModel+NSCoding.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Mantle/MTLValueTransformer.h: -------------------------------------------------------------------------------- 1 | ../../../Mantle/Mantle/MTLValueTransformer.h -------------------------------------------------------------------------------- /Pods/Headers/Public/JSONModel/JSONModel.h: -------------------------------------------------------------------------------- 1 | ../../../JSONModel/JSONModel/JSONModel/JSONModel.h -------------------------------------------------------------------------------- /Pods/Headers/Public/MGBenchmark/MGBenchmark.h: -------------------------------------------------------------------------------- 1 | ../../../MGBenchmark/MGBenchmark/MGBenchmark.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Mantle/MTLValueTransformer.h: -------------------------------------------------------------------------------- 1 | ../../../Mantle/Mantle/MTLValueTransformer.h -------------------------------------------------------------------------------- /Pods/Headers/Private/JSONModel/JSONAPI.h: -------------------------------------------------------------------------------- 1 | ../../../JSONModel/JSONModel/JSONModelNetworking/JSONAPI.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Mantle/EXTKeyPathCoding.h: -------------------------------------------------------------------------------- 1 | ../../../Mantle/Mantle/extobjc/EXTKeyPathCoding.h -------------------------------------------------------------------------------- /Pods/Headers/Public/JSONModel/JSONAPI.h: -------------------------------------------------------------------------------- 1 | ../../../JSONModel/JSONModel/JSONModelNetworking/JSONAPI.h -------------------------------------------------------------------------------- /Pods/Headers/Private/JSONModel/JSONModelArray.h: -------------------------------------------------------------------------------- 1 | ../../../JSONModel/JSONModel/JSONModel/JSONModelArray.h -------------------------------------------------------------------------------- /Pods/Headers/Private/JSONModel/JSONModelError.h: -------------------------------------------------------------------------------- 1 | ../../../JSONModel/JSONModel/JSONModel/JSONModelError.h -------------------------------------------------------------------------------- /Pods/Headers/Private/MGBenchmark/MGConsoleUtil.h: -------------------------------------------------------------------------------- 1 | ../../../MGBenchmark/MGBenchmark/Output/MGConsoleUtil.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Mantle/EXTRuntimeExtensions.h: -------------------------------------------------------------------------------- 1 | ../../../Mantle/Mantle/extobjc/EXTRuntimeExtensions.h -------------------------------------------------------------------------------- /Pods/Headers/Public/JSONModel/JSONModelArray.h: -------------------------------------------------------------------------------- 1 | ../../../JSONModel/JSONModel/JSONModel/JSONModelArray.h -------------------------------------------------------------------------------- /Pods/Headers/Public/JSONModel/JSONModelError.h: -------------------------------------------------------------------------------- 1 | ../../../JSONModel/JSONModel/JSONModel/JSONModelError.h -------------------------------------------------------------------------------- /Pods/Headers/Public/MGBenchmark/MGConsoleUtil.h: -------------------------------------------------------------------------------- 1 | ../../../MGBenchmark/MGBenchmark/Output/MGConsoleUtil.h -------------------------------------------------------------------------------- /Pods/Headers/Private/MGBenchmark/MGBenchmarkSession.h: -------------------------------------------------------------------------------- 1 | ../../../MGBenchmark/MGBenchmark/MGBenchmarkSession.h -------------------------------------------------------------------------------- /Pods/Headers/Private/MGBenchmark/MGConsoleOutput.h: -------------------------------------------------------------------------------- 1 | ../../../MGBenchmark/MGBenchmark/Output/MGConsoleOutput.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Mantle/NSError+MTLModelException.h: -------------------------------------------------------------------------------- 1 | ../../../Mantle/Mantle/NSError+MTLModelException.h -------------------------------------------------------------------------------- /Pods/Headers/Public/MGBenchmark/MGBenchmarkSession.h: -------------------------------------------------------------------------------- 1 | ../../../MGBenchmark/MGBenchmark/MGBenchmarkSession.h -------------------------------------------------------------------------------- /Pods/Headers/Public/MGBenchmark/MGConsoleOutput.h: -------------------------------------------------------------------------------- 1 | ../../../MGBenchmark/MGBenchmark/Output/MGConsoleOutput.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Mantle/MTLTransformerErrorHandling.h: -------------------------------------------------------------------------------- 1 | ../../../Mantle/Mantle/MTLTransformerErrorHandling.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Mantle/NSDictionary+MTLJSONKeyPath.h: -------------------------------------------------------------------------------- 1 | ../../../Mantle/Mantle/NSDictionary+MTLJSONKeyPath.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Mantle/NSError+MTLModelException.h: -------------------------------------------------------------------------------- 1 | ../../../Mantle/Mantle/NSError+MTLModelException.h -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-JsonReciprocityTests-JSONModel/Pods-JsonReciprocityTests-JSONModel.xcconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Pods/Headers/Private/JSONModel/JSONHTTPClient.h: -------------------------------------------------------------------------------- 1 | ../../../JSONModel/JSONModel/JSONModelNetworking/JSONHTTPClient.h -------------------------------------------------------------------------------- /Pods/Headers/Private/MGBenchmark/MGBenchmarkTarget.h: -------------------------------------------------------------------------------- 1 | ../../../MGBenchmark/MGBenchmark/Output/MGBenchmarkTarget.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Mantle/MTLTransformerErrorHandling.h: -------------------------------------------------------------------------------- 1 | ../../../Mantle/Mantle/MTLTransformerErrorHandling.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Mantle/NSDictionary+MTLJSONKeyPath.h: -------------------------------------------------------------------------------- 1 | ../../../Mantle/Mantle/NSDictionary+MTLJSONKeyPath.h -------------------------------------------------------------------------------- /Pods/Headers/Public/JSONModel/JSONHTTPClient.h: -------------------------------------------------------------------------------- 1 | ../../../JSONModel/JSONModel/JSONModelNetworking/JSONHTTPClient.h -------------------------------------------------------------------------------- /Pods/Headers/Public/MGBenchmark/MGBenchmarkTarget.h: -------------------------------------------------------------------------------- 1 | ../../../MGBenchmark/MGBenchmark/Output/MGBenchmarkTarget.h -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-JsonReciprocityTests-MGBenchmark/Pods-JsonReciprocityTests-MGBenchmark.xcconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-JsonReciprocityTests-MJExtension/Pods-JsonReciprocityTests-MJExtension.xcconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Pods/Headers/Private/JSONModel/JSONKeyMapper.h: -------------------------------------------------------------------------------- 1 | ../../../JSONModel/JSONModel/JSONModelTransformations/JSONKeyMapper.h -------------------------------------------------------------------------------- /Pods/Headers/Private/JSONModel/JSONModelClassProperty.h: -------------------------------------------------------------------------------- 1 | ../../../JSONModel/JSONModel/JSONModel/JSONModelClassProperty.h -------------------------------------------------------------------------------- /Pods/Headers/Private/JSONModel/NSArray+JSONModel.h: -------------------------------------------------------------------------------- 1 | ../../../JSONModel/JSONModel/JSONModelCategories/NSArray+JSONModel.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Mantle/NSObject+MTLComparisonAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Mantle/Mantle/NSObject+MTLComparisonAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Public/JSONModel/JSONKeyMapper.h: -------------------------------------------------------------------------------- 1 | ../../../JSONModel/JSONModel/JSONModelTransformations/JSONKeyMapper.h -------------------------------------------------------------------------------- /Pods/Headers/Public/JSONModel/JSONModelClassProperty.h: -------------------------------------------------------------------------------- 1 | ../../../JSONModel/JSONModel/JSONModel/JSONModelClassProperty.h -------------------------------------------------------------------------------- /Pods/Headers/Public/JSONModel/NSArray+JSONModel.h: -------------------------------------------------------------------------------- 1 | ../../../JSONModel/JSONModel/JSONModelCategories/NSArray+JSONModel.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Mantle/NSArray+MTLManipulationAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Mantle/Mantle/NSArray+MTLManipulationAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Mantle/NSDictionary+MTLMappingAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Mantle/Mantle/NSDictionary+MTLMappingAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Mantle/NSObject+MTLComparisonAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Mantle/Mantle/NSObject+MTLComparisonAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Private/MGBenchmark/MGConsoleSummaryOutput.h: -------------------------------------------------------------------------------- 1 | ../../../MGBenchmark/MGBenchmark/Output/MGConsoleSummaryOutput.h -------------------------------------------------------------------------------- /Pods/Headers/Private/MJExtension/MJConst.h: -------------------------------------------------------------------------------- 1 | ../../../MJExtension/MJExtensionExample/MJExtensionExample/MJExtension/MJConst.h -------------------------------------------------------------------------------- /Pods/Headers/Private/MJExtension/MJType.h: -------------------------------------------------------------------------------- 1 | ../../../MJExtension/MJExtensionExample/MJExtensionExample/MJExtension/MJType.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Mantle/NSArray+MTLManipulationAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Mantle/Mantle/NSArray+MTLManipulationAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Mantle/NSDictionary+MTLMappingAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Mantle/Mantle/NSDictionary+MTLMappingAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Public/JSONModel/JSONModel+networking.h: -------------------------------------------------------------------------------- 1 | ../../../JSONModel/JSONModel/JSONModelNetworking/JSONModel+networking.h -------------------------------------------------------------------------------- /Pods/Headers/Public/MGBenchmark/MGConsoleSummaryOutput.h: -------------------------------------------------------------------------------- 1 | ../../../MGBenchmark/MGBenchmark/Output/MGConsoleSummaryOutput.h -------------------------------------------------------------------------------- /Pods/Headers/Public/MJExtension/MJConst.h: -------------------------------------------------------------------------------- 1 | ../../../MJExtension/MJExtensionExample/MJExtensionExample/MJExtension/MJConst.h -------------------------------------------------------------------------------- /Pods/Headers/Public/MJExtension/MJType.h: -------------------------------------------------------------------------------- 1 | ../../../MJExtension/MJExtensionExample/MJExtensionExample/MJExtension/MJType.h -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-JsonReciprocityTests-JSONKit-NoWarning/Pods-JsonReciprocityTests-JSONKit-NoWarning.xcconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Pods/Headers/Private/JSONModel/JSONModel+networking.h: -------------------------------------------------------------------------------- 1 | ../../../JSONModel/JSONModel/JSONModelNetworking/JSONModel+networking.h -------------------------------------------------------------------------------- /Pods/Headers/Private/MJExtension/MJProperty.h: -------------------------------------------------------------------------------- 1 | ../../../MJExtension/MJExtensionExample/MJExtensionExample/MJExtension/MJProperty.h -------------------------------------------------------------------------------- /Pods/Headers/Public/JSONModel/JSONValueTransformer.h: -------------------------------------------------------------------------------- 1 | ../../../JSONModel/JSONModel/JSONModelTransformations/JSONValueTransformer.h -------------------------------------------------------------------------------- /Pods/Headers/Public/MJExtension/MJProperty.h: -------------------------------------------------------------------------------- 1 | ../../../MJExtension/MJExtensionExample/MJExtensionExample/MJExtension/MJProperty.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Mantle/NSDictionary+MTLManipulationAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Mantle/Mantle/NSDictionary+MTLManipulationAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Private/JSONModel/JSONValueTransformer.h: -------------------------------------------------------------------------------- 1 | ../../../JSONModel/JSONModel/JSONModelTransformations/JSONValueTransformer.h -------------------------------------------------------------------------------- /Pods/Headers/Private/MJExtension/MJExtension.h: -------------------------------------------------------------------------------- 1 | ../../../MJExtension/MJExtensionExample/MJExtensionExample/MJExtension/MJExtension.h -------------------------------------------------------------------------------- /Pods/Headers/Private/MJExtension/MJFoundation.h: -------------------------------------------------------------------------------- 1 | ../../../MJExtension/MJExtensionExample/MJExtensionExample/MJExtension/MJFoundation.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Mantle/NSDictionary+MTLManipulationAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Mantle/Mantle/NSDictionary+MTLManipulationAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Public/MJExtension/MJExtension.h: -------------------------------------------------------------------------------- 1 | ../../../MJExtension/MJExtensionExample/MJExtensionExample/MJExtension/MJExtension.h -------------------------------------------------------------------------------- /Pods/Headers/Public/MJExtension/MJFoundation.h: -------------------------------------------------------------------------------- 1 | ../../../MJExtension/MJExtensionExample/MJExtensionExample/MJExtension/MJFoundation.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Mantle/NSValueTransformer+MTLInversionAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Mantle/Mantle/NSValueTransformer+MTLInversionAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Mantle/NSValueTransformer+MTLInversionAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Mantle/Mantle/NSValueTransformer+MTLInversionAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Private/MJExtension/NSObject+MJCoding.h: -------------------------------------------------------------------------------- 1 | ../../../MJExtension/MJExtensionExample/MJExtensionExample/MJExtension/NSObject+MJCoding.h -------------------------------------------------------------------------------- /Pods/Headers/Public/MJExtension/NSObject+MJCoding.h: -------------------------------------------------------------------------------- 1 | ../../../MJExtension/MJExtensionExample/MJExtensionExample/MJExtension/NSObject+MJCoding.h -------------------------------------------------------------------------------- /Pods/Headers/Private/MJExtension/NSObject+MJKeyValue.h: -------------------------------------------------------------------------------- 1 | ../../../MJExtension/MJExtensionExample/MJExtensionExample/MJExtension/NSObject+MJKeyValue.h -------------------------------------------------------------------------------- /Pods/Headers/Private/MJExtension/NSObject+MJProperty.h: -------------------------------------------------------------------------------- 1 | ../../../MJExtension/MJExtensionExample/MJExtensionExample/MJExtension/NSObject+MJProperty.h -------------------------------------------------------------------------------- /Pods/Headers/Private/MJExtension/NSString+MJExtension.h: -------------------------------------------------------------------------------- 1 | ../../../MJExtension/MJExtensionExample/MJExtensionExample/MJExtension/NSString+MJExtension.h -------------------------------------------------------------------------------- /Pods/Headers/Public/MJExtension/NSObject+MJKeyValue.h: -------------------------------------------------------------------------------- 1 | ../../../MJExtension/MJExtensionExample/MJExtensionExample/MJExtension/NSObject+MJKeyValue.h -------------------------------------------------------------------------------- /Pods/Headers/Public/MJExtension/NSObject+MJProperty.h: -------------------------------------------------------------------------------- 1 | ../../../MJExtension/MJExtensionExample/MJExtensionExample/MJExtension/NSObject+MJProperty.h -------------------------------------------------------------------------------- /Pods/Headers/Public/MJExtension/NSString+MJExtension.h: -------------------------------------------------------------------------------- 1 | ../../../MJExtension/MJExtensionExample/MJExtensionExample/MJExtension/NSString+MJExtension.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Mantle/NSValueTransformer+MTLPredefinedTransformerAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Mantle/Mantle/NSValueTransformer+MTLPredefinedTransformerAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/Private/Mantle/NSValueTransformer+MTLPredefinedTransformerAdditions.h: -------------------------------------------------------------------------------- 1 | ../../../Mantle/Mantle/NSValueTransformer+MTLPredefinedTransformerAdditions.h -------------------------------------------------------------------------------- /Pods/JSONKit-NoWarning/README.md: -------------------------------------------------------------------------------- 1 | # JSONKit 2 | 3 | Please refer to the original documentation. 4 | This fork fix some warning raised with xcode5 and 64bit. 5 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-JsonReciprocityTests-Mantle/Pods-JsonReciprocityTests-Mantle.xcconfig: -------------------------------------------------------------------------------- 1 | PODS_JSONRECIPROCITYTESTS_MANTLE_OTHER_LDFLAGS = -framework "Foundation" -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-JsonReciprocityTests-Mantle/Pods-JsonReciprocityTests-Mantle-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | #import "Pods-JsonReciprocityTests-environment.h" 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-JsonReciprocityTests-JSONModel/Pods-JsonReciprocityTests-JSONModel-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | #import "Pods-JsonReciprocityTests-environment.h" 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-JsonReciprocityTests-MGBenchmark/Pods-JsonReciprocityTests-MGBenchmark-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | #import "Pods-JsonReciprocityTests-environment.h" 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-JsonReciprocityTests-MJExtension/Pods-JsonReciprocityTests-MJExtension-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | #import "Pods-JsonReciprocityTests-environment.h" 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-JsonReciprocityTests-JSONKit-NoWarning/Pods-JsonReciprocityTests-JSONKit-NoWarning-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | #import "Pods-JsonReciprocityTests-environment.h" 6 | -------------------------------------------------------------------------------- /JsonReciprocity.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-JsonReciprocityTests/Pods-JsonReciprocityTests-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_JsonReciprocityTests : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_JsonReciprocityTests 5 | @end 6 | -------------------------------------------------------------------------------- /JsonReciprocity/Model/CarModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // CarModel.m 3 | // JVReciprocity 4 | // 5 | // Created by liu on 15-5-7. 6 | // Copyright (c) 2015年 liu. All rights reserved. 7 | // 8 | 9 | #import "CarModel.h" 10 | 11 | @implementation CarModel 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /JsonReciprocity/Model/HouseModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // HouseModel.m 3 | // JVReciprocity 4 | // 5 | // Created by liu on 15-5-7. 6 | // Copyright (c) 2015年 liu. All rights reserved. 7 | // 8 | 9 | #import "HouseModel.h" 10 | 11 | @implementation HouseModel 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /JsonReciprocity/Model/BaseObject.m: -------------------------------------------------------------------------------- 1 | // 2 | // BaseObject.m 3 | // JsonReciprocity 4 | // 5 | // Created by liu on 15/11/17. 6 | // Copyright © 2015年 liu. All rights reserved. 7 | // 8 | 9 | #import "BaseObject.h" 10 | 11 | @implementation BaseObject 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-JsonReciprocityTests-Mantle/Pods-JsonReciprocityTests-Mantle-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_JsonReciprocityTests_Mantle : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_JsonReciprocityTests_Mantle 5 | @end 6 | -------------------------------------------------------------------------------- /JsonReciprocityTests/TestModels/CarJsonModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // CarJsonModel.m 3 | // JVReciprocity 4 | // 5 | // Created by liu on 15-5-8. 6 | // Copyright (c) 2015年 liu. All rights reserved. 7 | // 8 | 9 | #import "CarJsonModel.h" 10 | 11 | @implementation CarJsonModel 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-JsonReciprocityTests-JSONModel/Pods-JsonReciprocityTests-JSONModel-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_JsonReciprocityTests_JSONModel : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_JsonReciprocityTests_JSONModel 5 | @end 6 | -------------------------------------------------------------------------------- /JsonReciprocityTests/JsonFile/irregular_key.json: -------------------------------------------------------------------------------- 1 | { 2 | "Id" : 111, 3 | "user_Id" : 4096, 4 | "car_id" : 1234, 5 | "expride_time": 1430647083, 6 | "lastDate":1430647083, 7 | "qiche":"car", 8 | "__camel___CASE__tEST__": "this is string", 9 | "upper_case": "upper" 10 | } -------------------------------------------------------------------------------- /JsonReciprocityTests/TestModels/HouseJsonModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // HouseJsonModel.m 3 | // JVReciprocity 4 | // 5 | // Created by liu on 15-5-8. 6 | // Copyright (c) 2015年 liu. All rights reserved. 7 | // 8 | 9 | #import "HouseJsonModel.h" 10 | 11 | @implementation HouseJsonModel 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-JsonReciprocityTests-MGBenchmark/Pods-JsonReciprocityTests-MGBenchmark-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_JsonReciprocityTests_MGBenchmark : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_JsonReciprocityTests_MGBenchmark 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-JsonReciprocityTests-MJExtension/Pods-JsonReciprocityTests-MJExtension-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_JsonReciprocityTests_MJExtension : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_JsonReciprocityTests_MJExtension 5 | @end 6 | -------------------------------------------------------------------------------- /JsonReciprocity/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // JsonReciprocity 4 | // 5 | // Created by liu on 15/7/9. 6 | // Copyright (c) 2015年 liu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /JsonReciprocityTests/TestModels/SimpleTypeTestModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // SimpleTypeTestModel.m 3 | // JVReciprocity 4 | // 5 | // Created by liu on 15-5-7. 6 | // Copyright (c) 2015年 liu. All rights reserved. 7 | // 8 | 9 | #import "SimpleTypeTestModel.h" 10 | 11 | @implementation SimpleTypeTestModel 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-JsonReciprocityTests-JSONKit-NoWarning/Pods-JsonReciprocityTests-JSONKit-NoWarning-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_JsonReciprocityTests_JSONKit_NoWarning : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_JsonReciprocityTests_JSONKit_NoWarning 5 | @end 6 | -------------------------------------------------------------------------------- /JsonReciprocity.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /JsonReciprocity/JsonReciprocity/JsonReciprocity.h: -------------------------------------------------------------------------------- 1 | // 2 | // JsonReciprocity.h 3 | // JVReciprocity 4 | // 5 | // Created by liu on 15/7/8. 6 | // Copyright (c) 2015年 liu. All rights reserved. 7 | // 8 | 9 | #import "NSObject+JsonReciprocity.h" 10 | #import "JsonSerialization.h" 11 | #import "JsonDeserialization.h" 12 | -------------------------------------------------------------------------------- /JsonReciprocityTests/TestModels/CustomObject.m: -------------------------------------------------------------------------------- 1 | // 2 | // CustomObject.m 3 | // JsonReciprocity 4 | // 5 | // Created by liu on 15/8/26. 6 | // Copyright (c) 2015年 liu. All rights reserved. 7 | // 8 | 9 | #import "CustomObject.h" 10 | 11 | @implementation CustomObject 12 | 13 | //- (NSString *)test { 14 | // return @"111"; 15 | //} 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /JsonReciprocity/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // JsonReciprocity 4 | // 5 | // Created by liu on 15/7/9. 6 | // Copyright (c) 2015年 liu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /Pods/MJExtension/MJExtensionExample/MJExtensionExample/MJExtension/NSString+MJExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+MJExtension.h 3 | // TestTabBar 4 | // 5 | // Created by MJ Lee on 15/4/17. 6 | // Copyright (c) 2015年 Mac Z. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSString (MJExtension) 12 | - (id)JSONObject; 13 | @end 14 | -------------------------------------------------------------------------------- /Pods/Mantle/Mantle/extobjc/EXTScope.m: -------------------------------------------------------------------------------- 1 | // 2 | // EXTScope.m 3 | // extobjc 4 | // 5 | // Created by Justin Spahr-Summers on 2011-05-04. 6 | // Copyright (C) 2012 Justin Spahr-Summers. 7 | // Released under the MIT license. 8 | // 9 | 10 | #import "EXTScope.h" 11 | 12 | void mtl_executeCleanupBlock (__strong mtl_cleanupBlock_t *block) { 13 | (*block)(); 14 | } 15 | 16 | -------------------------------------------------------------------------------- /JsonReciprocity/Model/CarModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // CarModel.h 3 | // JVReciprocity 4 | // 5 | // Created by liu on 15-5-7. 6 | // Copyright (c) 2015年 liu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CarModel : NSObject 12 | 13 | @property (copy, nonatomic) NSString *num; 14 | @property (copy, nonatomic) NSString *brand; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Pods/MJExtension/MJExtensionExample/MJExtensionExample/MJExtension/MJFoundation.h: -------------------------------------------------------------------------------- 1 | // 2 | // MJFoundation.h 3 | // MJExtensionExample 4 | // 5 | // Created by MJ Lee on 14/7/16. 6 | // Copyright (c) 2014年 小码哥. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MJFoundation : NSObject 12 | + (BOOL)isClassFromFoundation:(Class)c; 13 | @end 14 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '6.0' 3 | 4 | target 'JsonReciprocity' do 5 | 6 | end 7 | 8 | target 'JsonReciprocityTests' do 9 | 10 | pod 'MGBenchmark', '~> 0.3.0' 11 | pod 'JSONKit-NoWarning', '~> 1.2' 12 | pod 'JSONModel', '~> 1.0.2' 13 | pod 'MJExtension', '~> 2.0.2' 14 | pod 'Mantle', '~> 2.0' 15 | 16 | end 17 | 18 | -------------------------------------------------------------------------------- /JsonReciprocityTests/TestModels/CarJsonModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // CarJsonModel.h 3 | // JVReciprocity 4 | // 5 | // Created by liu on 15-5-8. 6 | // Copyright (c) 2015年 liu. All rights reserved. 7 | // 8 | 9 | #import "JSONModel.h" 10 | 11 | @interface CarJsonModel : JSONModel 12 | 13 | @property (copy, nonatomic) NSString *num; 14 | @property (copy, nonatomic) NSString *brand; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /JsonReciprocity/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // JsonReciprocity 4 | // 5 | // Created by liu on 15/7/9. 6 | // Copyright (c) 2015年 liu. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /JsonReciprocityTests/TestModels/CarMTLModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // CarMTLModel.h 3 | // JVReciprocity 4 | // 5 | // Created by liu on 15-5-8. 6 | // Copyright (c) 2015年 liu. All rights reserved. 7 | // 8 | 9 | #import "MTLModel.h" 10 | #import 11 | 12 | @interface CarMTLModel : MTLModel 13 | 14 | @property (copy, nonatomic) NSString *num; 15 | @property (copy, nonatomic) NSString *brand; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /JsonReciprocityTests/TestModels/CarMTLModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // CarMTLModel.m 3 | // JVReciprocity 4 | // 5 | // Created by liu on 15-5-8. 6 | // Copyright (c) 2015年 liu. All rights reserved. 7 | // 8 | 9 | #import "CarMTLModel.h" 10 | 11 | @implementation CarMTLModel 12 | 13 | + (NSDictionary *)JSONKeyPathsByPropertyKey { 14 | return @{ 15 | @"num": @"num", 16 | @"brand": @"brand", 17 | }; 18 | } 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /JsonReciprocity/JsonReciprocity/NSMutableDictionary+SafeSet.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSMutableDictionary+SafeSet.h 3 | // CompositeTest 4 | // 5 | // Created by liu on 14-12-30. 6 | // 7 | // 8 | 9 | #import 10 | 11 | @interface NSMutableDictionary (SafeSet) 12 | 13 | - (void)safeSetObject:(id)object forKey:(NSString *)key placeHolderObject:(id)placeHolder; 14 | 15 | - (void)safeSetObject:(id)object forKey:(NSString *)key; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /JsonReciprocity/Model/HouseModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // HouseModel.h 3 | // JVReciprocity 4 | // 5 | // Created by liu on 15-5-7. 6 | // Copyright (c) 2015年 liu. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface HouseModel : NSObject 13 | 14 | @property (copy, nonatomic) NSString *address; 15 | @property (assign, nonatomic) CGFloat area; 16 | @property (strong, nonatomic) NSArray *tags; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /JsonReciprocityTests/TestModels/HouseJsonModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // HouseJsonModel.h 3 | // JVReciprocity 4 | // 5 | // Created by liu on 15-5-8. 6 | // Copyright (c) 2015年 liu. All rights reserved. 7 | // 8 | 9 | #import "JSONModel.h" 10 | #import 11 | 12 | @interface HouseJsonModel : JSONModel 13 | 14 | @property (copy, nonatomic) NSString *address; 15 | @property (assign, nonatomic) CGFloat area; 16 | @property (strong, nonatomic) NSArray *tags; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /JsonReciprocityTests/TestModels/IrregularTestModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // IrregularTestModel.m 3 | // JVReciprocity 4 | // 5 | // Created by liu on 15-5-7. 6 | // Copyright (c) 2015年 liu. All rights reserved. 7 | // 8 | 9 | #import "IrregularTestModel.h" 10 | 11 | @implementation IrregularTestModel 12 | 13 | + (NSDictionary *)customReferenceDict { 14 | return @{@"Id": @"id", 15 | @"qiche": @"car", 16 | @"upper_case": @"upper_case"}; 17 | } 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /JsonReciprocityTests/JsonFile/single_complex.json: -------------------------------------------------------------------------------- 1 | { 2 | "code":200, 3 | "total":1, 4 | "page":1, 5 | "msg":"success", 6 | "data":[{ 7 | "id": 1420194, 8 | "name" : "Jack", 9 | "score" : 88.33, 10 | "register_date" : 1428647083, 11 | "last_login_time" : 1430642742, 12 | "cars":[{ 13 | "brand":"benz", 14 | "num":"A14212" 15 | },{ 16 | "brand":"audi", 17 | "num":"B83143" 18 | }], 19 | "house": { 20 | "address": "China GuangZhou", 21 | "area": 95.6, 22 | "tags":[ 23 | "nice", 24 | "comfort" 25 | ]} 26 | }] 27 | } -------------------------------------------------------------------------------- /JsonReciprocityTests/TestModels/HouseMTLModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // HouseMTLModel.m 3 | // JVReciprocity 4 | // 5 | // Created by liu on 15-5-8. 6 | // Copyright (c) 2015年 liu. All rights reserved. 7 | // 8 | 9 | #import "HouseMTLModel.h" 10 | 11 | @implementation HouseMTLModel 12 | 13 | + (NSDictionary *)JSONKeyPathsByPropertyKey { 14 | return @{ 15 | @"address": @"address", 16 | @"area": @"area", 17 | @"tags": @"tags", 18 | }; 19 | } 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /JsonReciprocityTests/TestModels/PersonJsonModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // PersonJsonModel.m 3 | // JVReciprocity 4 | // 5 | // Created by liu on 15-5-8. 6 | // Copyright (c) 2015年 liu. All rights reserved. 7 | // 8 | 9 | #import "PersonJsonModel.h" 10 | 11 | @implementation PersonJsonModel 12 | 13 | +(BOOL)propertyIsOptional:(NSString*)propertyName 14 | { 15 | return YES; 16 | } 17 | 18 | + (JSONKeyMapper *)keyMapper { 19 | return [JSONKeyMapper mapperFromUnderscoreCaseToCamelCase]; 20 | } 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /Pods/Mantle/Mantle/NSObject+MTLComparisonAdditions.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+MTLComparisonAdditions.m 3 | // Mantle 4 | // 5 | // Created by Josh Vera on 10/26/12. 6 | // Copyright (c) 2012 GitHub. All rights reserved. 7 | // 8 | // Portions copyright (c) 2011 Bitswift. All rights reserved. 9 | // See the LICENSE file for more information. 10 | // 11 | 12 | #import "NSObject+MTLComparisonAdditions.h" 13 | 14 | BOOL MTLEqualObjects(id obj1, id obj2) { 15 | return (obj1 == obj2 || [obj1 isEqual:obj2]); 16 | } 17 | -------------------------------------------------------------------------------- /JsonReciprocityTests/TestModels/HouseMTLModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // HouseMTLModel.h 3 | // JVReciprocity 4 | // 5 | // Created by liu on 15-5-8. 6 | // Copyright (c) 2015年 liu. All rights reserved. 7 | // 8 | 9 | #import "MTLModel.h" 10 | #import 11 | #import 12 | 13 | @interface HouseMTLModel : MTLModel 14 | 15 | @property (copy, nonatomic) NSString *address; 16 | @property (assign, nonatomic) CGFloat area; 17 | @property (strong, nonatomic) NSArray *tags; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /Pods/MJExtension/MJExtensionExample/MJExtensionExample/MJExtension/NSString+MJExtension.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+MJExtension.m 3 | // TestTabBar 4 | // 5 | // Created by MJ Lee on 15/4/17. 6 | // Copyright (c) 2015年 Mac Z. All rights reserved. 7 | // 8 | 9 | #import "NSString+MJExtension.h" 10 | 11 | @implementation NSString (MJExtension) 12 | - (id)JSONObject 13 | { 14 | return [NSJSONSerialization JSONObjectWithData:[self dataUsingEncoding:NSUTF8StringEncoding] options:kNilOptions error:nil]; 15 | } 16 | @end 17 | -------------------------------------------------------------------------------- /Pods/Mantle/Mantle/NSObject+MTLComparisonAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+MTLComparisonAdditions.h 3 | // Mantle 4 | // 5 | // Created by Josh Vera on 10/26/12. 6 | // Copyright (c) 2012 GitHub. All rights reserved. 7 | // 8 | // Portions copyright (c) 2011 Bitswift. All rights reserved. 9 | // See the LICENSE file for more information. 10 | // 11 | 12 | #import 13 | 14 | /// Returns whether both objects are identical or equal via -isEqual: 15 | BOOL MTLEqualObjects(id obj1, id obj2); 16 | -------------------------------------------------------------------------------- /JsonReciprocityTests/TestModels/CustomObject.h: -------------------------------------------------------------------------------- 1 | // 2 | // CustomObject.h 3 | // JsonReciprocity 4 | // 5 | // Created by liu on 15/8/26. 6 | // Copyright (c) 2015年 liu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CustomObject : NSObject 12 | 13 | @property (strong, nonatomic) NSString *code; 14 | @property (strong, nonatomic) NSString *message; 15 | @property (strong, nonatomic) NSString *data; 16 | @property (strong, nonatomic, readonly) NSString *test; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Pods/MJExtension/MJExtensionExample/MJExtensionExample/MJExtension/MJExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // MJExtension.h 3 | // MJExtension 4 | // 5 | // Created by mj on 14-1-15. 6 | // Copyright (c) 2014年 小码哥. All rights reserved. 7 | // 代码地址:https://github.com/CoderMJLee/MJExtension 8 | // 代码地址:http://code4app.com/ios/%E5%AD%97%E5%85%B8-JSON-%E4%B8%8E%E6%A8%A1%E5%9E%8B%E7%9A%84%E8%BD%AC%E6%8D%A2/5339992a933bf062608b4c57 9 | 10 | #import "NSObject+MJCoding.h" 11 | #import "NSObject+MJProperty.h" 12 | #import "NSObject+MJKeyValue.h" 13 | -------------------------------------------------------------------------------- /JsonReciprocity/Model/BaseObject.h: -------------------------------------------------------------------------------- 1 | // 2 | // BaseObject.h 3 | // JsonReciprocity 4 | // 5 | // Created by liu on 15/11/17. 6 | // Copyright © 2015年 liu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface BaseObject : NSObject 12 | 13 | @property (strong, nonatomic) NSDate *date1; 14 | @property (strong, nonatomic) NSDate *date2; 15 | 16 | @property (strong, nonatomic) NSString *str; 17 | @property (assign, nonatomic) int x; 18 | @property (copy, nonatomic) NSString *tt; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /JsonReciprocityTests/JsonFile/simple_type.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | "shortNumber": 121, 4 | "intNumber": 12, 5 | "longNumber": 12124, 6 | "integerNumber": 12124, 7 | "numberInt":12124, 8 | 9 | "floatNumber": 12.12, 10 | "doubleNumber": 121231312.124, 11 | "cgfloatNumber": 121231312.124, 12 | "numberFloat": 121231312.124, 13 | 14 | "boolYES": true, 15 | "numberBool": false, 16 | "boolNum": 1, 17 | 18 | "timestamp":1430647083, 19 | 20 | "date":1430647083, 21 | 22 | "string":"this is string.", 23 | 24 | "url":"http://www.baidu.com", 25 | 26 | } -------------------------------------------------------------------------------- /JsonReciprocity/Model/TestObject.h: -------------------------------------------------------------------------------- 1 | // 2 | // TestObject.h 3 | // JsonReciprocity 4 | // 5 | // Created by liu on 15/7/12. 6 | // Copyright (c) 2015年 liu. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "JsonReciprocity.h" 11 | #import "BaseObject.h" 12 | 13 | @interface TestObject : BaseObject 14 | 15 | @property (strong, nonatomic) NSDate *date1; 16 | @property (strong, nonatomic) NSDate *date2; 17 | 18 | @property (strong, nonatomic) NSString *test; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /JsonReciprocity/JsonReciprocity/JsonReciprocityManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // JsonReciprocityManager.h 3 | // DDBaseLib 4 | // 5 | // Created by liu on 15/11/18. 6 | // Copyright © 2015年 dingdone. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #if DEBUG 12 | #define JRLog(format,...) if ([JsonReciprocityManager logEnable]) NSLog(format, ##__VA_ARGS__) 13 | #else 14 | #define JRLog(format,...) 15 | #endif 16 | 17 | @interface JsonReciprocityManager : NSObject 18 | 19 | + (void)setLogEnable:(BOOL)enable; 20 | + (BOOL)logEnable; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /JsonReciprocity/JsonReciprocity/JsonSerialization.h: -------------------------------------------------------------------------------- 1 | // 2 | // JsonSerialization.h 3 | // 4 | // Created by liu on 15-2-11. 5 | // Copyright (c) 2015年 liu. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | @interface NSObject (JsonSerialization) 11 | 12 | - (NSString *)toJsonString; 13 | 14 | - (NSString *)toPrettyJsonString; 15 | 16 | @end 17 | 18 | @interface NSString (JsonSerialization) 19 | 20 | + (NSString *)jsonStringFromObject:(id)object; 21 | 22 | + (NSString *)jsonStringFromObject:(id)object isPretty:(BOOL)isPretty; 23 | 24 | @end -------------------------------------------------------------------------------- /Pods/Mantle/Mantle/MTLTransformerErrorHandling.m: -------------------------------------------------------------------------------- 1 | // 2 | // MTLTransformerErrorHandling.h 3 | // Mantle 4 | // 5 | // Created by Robert Böhnke on 10/6/13. 6 | // Copyright (c) 2013 GitHub. All rights reserved. 7 | // 8 | 9 | #import "MTLTransformerErrorHandling.h" 10 | 11 | NSString * const MTLTransformerErrorHandlingErrorDomain = @"MTLTransformerErrorHandlingErrorDomain"; 12 | 13 | const NSInteger MTLTransformerErrorHandlingErrorInvalidInput = 1; 14 | 15 | NSString * const MTLTransformerErrorHandlingInputValueErrorKey = @"MTLTransformerErrorHandlingInputValueErrorKey"; 16 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-JsonReciprocityTests-JSONModel/Pods-JsonReciprocityTests-JSONModel-Private.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods-JsonReciprocityTests-JSONModel.xcconfig" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/JSONModel" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/JSONKit-NoWarning" "${PODS_ROOT}/Headers/Public/JSONModel" "${PODS_ROOT}/Headers/Public/MGBenchmark" "${PODS_ROOT}/Headers/Public/MJExtension" "${PODS_ROOT}/Headers/Public/Mantle" 4 | OTHER_LDFLAGS = -ObjC 5 | PODS_ROOT = ${SRCROOT} 6 | SKIP_INSTALL = YES -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-JsonReciprocityTests-MGBenchmark/Pods-JsonReciprocityTests-MGBenchmark-Private.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods-JsonReciprocityTests-MGBenchmark.xcconfig" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/MGBenchmark" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/JSONKit-NoWarning" "${PODS_ROOT}/Headers/Public/JSONModel" "${PODS_ROOT}/Headers/Public/MGBenchmark" "${PODS_ROOT}/Headers/Public/MJExtension" "${PODS_ROOT}/Headers/Public/Mantle" 4 | OTHER_LDFLAGS = -ObjC 5 | PODS_ROOT = ${SRCROOT} 6 | SKIP_INSTALL = YES -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-JsonReciprocityTests-MJExtension/Pods-JsonReciprocityTests-MJExtension-Private.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods-JsonReciprocityTests-MJExtension.xcconfig" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/MJExtension" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/JSONKit-NoWarning" "${PODS_ROOT}/Headers/Public/JSONModel" "${PODS_ROOT}/Headers/Public/MGBenchmark" "${PODS_ROOT}/Headers/Public/MJExtension" "${PODS_ROOT}/Headers/Public/Mantle" 4 | OTHER_LDFLAGS = -ObjC 5 | PODS_ROOT = ${SRCROOT} 6 | SKIP_INSTALL = YES -------------------------------------------------------------------------------- /Pods/Mantle/Mantle/NSDictionary+MTLMappingAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSDictionary+MTLMappingAdditions.h 3 | // Mantle 4 | // 5 | // Created by Robert Böhnke on 10/31/13. 6 | // Copyright (c) 2013 GitHub. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSDictionary (MTLMappingAdditions) 12 | 13 | /// Creates an identity mapping for serialization. 14 | /// 15 | /// class - A subclass of MTLModel. 16 | /// 17 | /// Returns a dictionary that maps all properties of the given class to 18 | /// themselves. 19 | + (NSDictionary *)mtl_identityPropertyMapWithModel:(Class)modelClass; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-JsonReciprocityTests-JSONKit-NoWarning/Pods-JsonReciprocityTests-JSONKit-NoWarning-Private.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods-JsonReciprocityTests-JSONKit-NoWarning.xcconfig" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/JSONKit-NoWarning" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/JSONKit-NoWarning" "${PODS_ROOT}/Headers/Public/JSONModel" "${PODS_ROOT}/Headers/Public/MGBenchmark" "${PODS_ROOT}/Headers/Public/MJExtension" "${PODS_ROOT}/Headers/Public/Mantle" 4 | OTHER_LDFLAGS = -ObjC 5 | PODS_ROOT = ${SRCROOT} 6 | SKIP_INSTALL = YES -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-JsonReciprocityTests-Mantle/Pods-JsonReciprocityTests-Mantle-Private.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods-JsonReciprocityTests-Mantle.xcconfig" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/Mantle" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/JSONKit-NoWarning" "${PODS_ROOT}/Headers/Public/JSONModel" "${PODS_ROOT}/Headers/Public/MGBenchmark" "${PODS_ROOT}/Headers/Public/MJExtension" "${PODS_ROOT}/Headers/Public/Mantle" 4 | OTHER_LDFLAGS = ${PODS_JSONRECIPROCITYTESTS_MANTLE_OTHER_LDFLAGS} -ObjC 5 | PODS_ROOT = ${SRCROOT} 6 | SKIP_INSTALL = YES -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | *.xccheckout 14 | *.moved-aside 15 | DerivedData 16 | *.hmap 17 | *.ipa 18 | *.xcuserstate 19 | 20 | # CocoaPods 21 | # 22 | # We recommend against adding the Pods directory to your .gitignore. However 23 | # you should judge for yourself, the pros and cons are mentioned at: 24 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 25 | # 26 | 27 | .DS_Store 28 | *.lock 29 | 30 | # Framework 31 | Products 32 | -------------------------------------------------------------------------------- /JsonReciprocity/JsonReciprocity/NSMutableDictionary+SafeSet.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSMutableDictionary+SafeSet.m 3 | // CompositeTest 4 | // 5 | // Created by liu on 14-12-30. 6 | // 7 | // 8 | 9 | #import "NSMutableDictionary+SafeSet.h" 10 | 11 | @implementation NSMutableDictionary (SafeSet) 12 | 13 | - (void)safeSetObject:(id)object forKey:(NSString *)key placeHolderObject:(id)placeHolder { 14 | if (object) { 15 | self[key] = object; 16 | } else if (placeHolder) { 17 | self[key] = placeHolder; 18 | } 19 | } 20 | 21 | - (void)safeSetObject:(id)object forKey:(NSString *)key { 22 | [self safeSetObject:object forKey:key placeHolderObject:nil]; 23 | } 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /Pods/Mantle/Mantle/NSValueTransformer+MTLInversionAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSValueTransformer+MTLInversionAdditions.h 3 | // Mantle 4 | // 5 | // Created by Justin Spahr-Summers on 2013-05-18. 6 | // Copyright (c) 2013 GitHub. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSValueTransformer (MTLInversionAdditions) 12 | 13 | /// Flips the direction of the receiver's transformation, such that 14 | /// -transformedValue: will become -reverseTransformedValue:, and vice-versa. 15 | /// 16 | /// The receiver must allow reverse transformation. 17 | /// 18 | /// Returns an inverted transformer. 19 | - (NSValueTransformer *)mtl_invertedTransformer; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Pods/Mantle/Mantle/NSDictionary+MTLMappingAdditions.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSDictionary+MTLMappingAdditions.m 3 | // Mantle 4 | // 5 | // Created by Robert Böhnke on 10/31/13. 6 | // Copyright (c) 2013 GitHub. All rights reserved. 7 | // 8 | 9 | #import "MTLModel.h" 10 | 11 | #import "NSDictionary+MTLMappingAdditions.h" 12 | 13 | @implementation NSDictionary (MTLMappingAdditions) 14 | 15 | + (NSDictionary *)mtl_identityPropertyMapWithModel:(Class)modelClass { 16 | NSCParameterAssert([modelClass isSubclassOfClass:MTLModel.class]); 17 | 18 | NSArray *propertyKeys = [modelClass propertyKeys].allObjects; 19 | 20 | return [NSDictionary dictionaryWithObjects:propertyKeys forKeys:propertyKeys]; 21 | } 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /JsonReciprocity/Model/PersonModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // Person.h 3 | // JVReciprocity 4 | // 5 | // Created by liu on 15-5-7. 6 | // Copyright (c) 2015年 liu. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "HouseModel.h" 11 | #import "JsonReciprocity.h" 12 | 13 | @interface PersonModel : NSObject 14 | 15 | @property (nonatomic, assign) NSInteger id; 16 | @property (nonatomic, copy) NSString *name; 17 | @property (nonatomic, assign) CGFloat score; 18 | @property (nonatomic, strong) NSDate *registerDate; 19 | @property (nonatomic, assign) NSTimeInterval lastLoginTime; 20 | @property (nonatomic, strong) NSArray *cars; 21 | @property (nonatomic, strong) HouseModel *house; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /Pods/Mantle/Mantle/NSError+MTLModelException.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSError+MTLModelException.h 3 | // Mantle 4 | // 5 | // Created by Robert Böhnke on 7/6/13. 6 | // Copyright (c) 2013 GitHub. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSError (MTLModelException) 12 | 13 | /// Creates a new error for an exception that occurred during updating an 14 | /// MTLModel. 15 | /// 16 | /// exception - The exception that was thrown while updating the model. 17 | /// This argument must not be nil. 18 | /// 19 | /// Returns an error that takes its localized description and failure reason 20 | /// from the exception. 21 | + (instancetype)mtl_modelErrorWithException:(NSException *)exception; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /JsonReciprocityTests/TestModels/IrregularTestModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // IrregularTestModel.h 3 | // JVReciprocity 4 | // 5 | // Created by liu on 15-5-7. 6 | // Copyright (c) 2015年 liu. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "NSObject+JsonReciprocity.h" 11 | 12 | @interface IrregularTestModel : NSObject 13 | 14 | @property (assign, nonatomic) NSInteger id; 15 | @property (assign, nonatomic) NSInteger userId; 16 | @property (assign, nonatomic) NSInteger carId; 17 | @property (strong, nonatomic) NSDate *exprideTime; 18 | @property (strong, nonatomic) NSDate *lastDate; 19 | @property (copy, nonatomic) NSString *car; 20 | @property (copy, nonatomic) NSString *camelCaseTest; 21 | @property (copy, nonatomic) NSString *upper_case; 22 | 23 | @end -------------------------------------------------------------------------------- /JsonReciprocityTests/TestModels/PersonJsonModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // PersonJsonModel.h 3 | // JVReciprocity 4 | // 5 | // Created by liu on 15-5-8. 6 | // Copyright (c) 2015年 liu. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "JSONModel.h" 11 | #import "HouseJsonModel.h" 12 | #import "CarJsonModel.h" 13 | 14 | @protocol CarJsonModel; 15 | 16 | @interface PersonJsonModel : JSONModel 17 | 18 | @property (nonatomic, assign) NSInteger id; 19 | @property (nonatomic, copy) NSString *name; 20 | @property (nonatomic, assign) CGFloat score; 21 | @property (nonatomic, strong) NSDate *registerDate; 22 | @property (nonatomic, assign) NSTimeInterval lastLoginTime; 23 | @property (nonatomic, strong) NSArray *cars; 24 | @property (nonatomic, strong) HouseJsonModel *house; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /JsonReciprocityTests/TestModels/PersonMTLModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // PersonMTLModel.h 3 | // JVReciprocity 4 | // 5 | // Created by liu on 15-5-8. 6 | // Copyright (c) 2015年 liu. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "CarMTLModel.h" 12 | #import "HouseMTLModel.h" 13 | 14 | //@protocol CarMTLModel; 15 | 16 | @interface PersonMTLModel : MTLModel 17 | 18 | @property (nonatomic, assign) NSInteger id; 19 | @property (nonatomic, copy) NSString *name; 20 | @property (nonatomic, assign) CGFloat score; 21 | @property (nonatomic, strong) NSDate *registerDate; 22 | @property (nonatomic, assign) NSTimeInterval lastLoginTime; 23 | @property (nonatomic, strong) NSArray *cars; 24 | @property (nonatomic, strong) HouseMTLModel *house; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Pods/MJExtension/MJExtensionExample/MJExtensionExample/MJExtension/MJConst.m: -------------------------------------------------------------------------------- 1 | #ifndef __MJConst__M__ 2 | #define __MJConst__M__ 3 | 4 | #import 5 | 6 | /** 7 | * 成员变量类型(属性类型) 8 | */ 9 | NSString *const MJTypeInt = @"i"; 10 | NSString *const MJTypeFloat = @"f"; 11 | NSString *const MJTypeDouble = @"d"; 12 | NSString *const MJTypeLong = @"q"; 13 | NSString *const MJTypeLongLong = @"q"; 14 | NSString *const MJTypeChar = @"c"; 15 | NSString *const MJTypeBOOL = @"c"; 16 | NSString *const MJTypePointer = @"*"; 17 | 18 | NSString *const MJTypeIvar = @"^{objc_ivar=}"; 19 | NSString *const MJTypeMethod = @"^{objc_method=}"; 20 | NSString *const MJTypeBlock = @"@?"; 21 | NSString *const MJTypeClass = @"#"; 22 | NSString *const MJTypeSEL = @":"; 23 | NSString *const MJTypeId = @"@"; 24 | 25 | #endif -------------------------------------------------------------------------------- /JsonReciprocityTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | liu.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /JsonReciprocity/Model/PersonModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // Person.m 3 | // JVReciprocity 4 | // 5 | // Created by liu on 15-5-7. 6 | // Copyright (c) 2015年 liu. All rights reserved. 7 | // 8 | 9 | #import "PersonModel.h" 10 | #import "CarModel.h" 11 | 12 | @implementation PersonModel 13 | 14 | + (NSDictionary *)classReferenceDictForArray { 15 | return @{@"cars": [CarModel class]}; 16 | } 17 | 18 | + (NSDictionary *)customReferenceDict { 19 | return @{ 20 | @"id": @"id", 21 | @"name": @"name", 22 | @"score": @"score", 23 | @"register_date": @"registerDate", 24 | @"last_login_time": @"lastLoginTime", 25 | @"cars": @"cars", 26 | @"house": @"house", 27 | }; 28 | } 29 | 30 | - (NSString *)description { 31 | return [NSString jsonStringFromObject:self isPretty:YES]; 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /JsonReciprocity/JsonReciprocity/JsonReciprocityManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // JsonReciprocityManager.m 3 | // DDBaseLib 4 | // 5 | // Created by liu on 15/11/18. 6 | // Copyright © 2015年 dingdone. All rights reserved. 7 | // 8 | 9 | #import "JsonReciprocityManager.h" 10 | 11 | @interface JsonReciprocityManager () 12 | 13 | @property (assign, nonatomic, readwrite) BOOL logEnable; 14 | 15 | @end 16 | 17 | @implementation JsonReciprocityManager 18 | 19 | + (void)setLogEnable:(BOOL)enable { 20 | [self instance].logEnable = enable; 21 | } 22 | 23 | + (BOOL)logEnable { 24 | return [self instance].logEnable; 25 | } 26 | 27 | + (JsonReciprocityManager *)instance { 28 | static JsonReciprocityManager *manager = nil; 29 | static dispatch_once_t onceToken; 30 | dispatch_once(&onceToken, ^{ 31 | manager = [[JsonReciprocityManager alloc] init]; 32 | }); 33 | return manager; 34 | } 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /JsonReciprocity.podspec: -------------------------------------------------------------------------------- 1 | 2 | Pod::Spec.new do |s| 3 | 4 | s.name = "JsonReciprocity" 5 | s.version = "1.0.3" 6 | s.summary = "A lightweight framework for converting between Json String and Json Object." 7 | s.description = <<-DESC 8 | A lightweight and fastest framework for converting between Json String and Json Object. This is a category that don't need to extends any other class. Convenient、Flexible、Easy to Use. 9 | DESC 10 | 11 | s.homepage = "https://github.com/javenl/JsonReciprocity" 12 | 13 | s.license = { :type => "MIT", :file => "LICENSE" } 14 | 15 | s.author = { "Javen_liu" => "412775083@qq.com" } 16 | 17 | s.platform = :ios, "6.0" 18 | s.source = { :git => "https://github.com/javenl/JsonReciprocity.git", :tag => "#{s.version}" } 19 | s.source_files = "JsonReciprocity/JsonReciprocity/*.{h,m}" 20 | s.requires_arc = true 21 | 22 | end 23 | -------------------------------------------------------------------------------- /JsonReciprocity/JsonReciprocity/JsonDeserialization.h: -------------------------------------------------------------------------------- 1 | // 2 | // Header.h 3 | // JVReciprocity 4 | // 5 | // Created by liu on 15/7/8. 6 | // Copyright (c) 2015年 liu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSString (JsonDeserialization) 12 | 13 | - (id)toJsonObject; 14 | 15 | - (NSArray *)toJsonArray; 16 | 17 | - (NSMutableArray *)toJsonMutableArray; 18 | 19 | - (NSDictionary *)toJsonDictionary; 20 | 21 | - (NSMutableDictionary *)toJsonMutableDictionary; 22 | 23 | @end 24 | 25 | @interface NSDictionary (JsonDeserialization) 26 | 27 | + (NSDictionary *)dictionaryFromJsonString:(NSString *)jsonString; 28 | 29 | + (NSMutableDictionary *)mutableDictionaryFromJsonString:(NSString *)jsonString; 30 | 31 | @end 32 | 33 | @interface NSArray (JsonDeserialization) 34 | 35 | + (NSArray *)arrayFromJsonString:(NSString *)jsonString; 36 | 37 | + (NSMutableArray *)mutableArrayFromJsonString:(NSString *)jsonString; 38 | 39 | @end 40 | 41 | -------------------------------------------------------------------------------- /Pods/Mantle/Mantle/Mantle.h: -------------------------------------------------------------------------------- 1 | // 2 | // Mantle.h 3 | // Mantle 4 | // 5 | // Created by Justin Spahr-Summers on 2012-09-04. 6 | // Copyright (c) 2012 GitHub. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for Mantle. 12 | FOUNDATION_EXPORT double MantleVersionNumber; 13 | 14 | //! Project version string for Mantle. 15 | FOUNDATION_EXPORT const unsigned char MantleVersionString[]; 16 | 17 | #import 18 | #import 19 | #import 20 | #import 21 | #import 22 | #import 23 | #import 24 | #import 25 | #import 26 | #import 27 | #import 28 | -------------------------------------------------------------------------------- /Pods/MJExtension/MJExtensionExample/MJExtensionExample/MJExtension/MJType.h: -------------------------------------------------------------------------------- 1 | // 2 | // MJType.h 3 | // MJExtension 4 | // 5 | // Created by mj on 14-1-15. 6 | // Copyright (c) 2014年 小码哥. All rights reserved. 7 | // 包装一种类型 8 | 9 | #import 10 | /** 11 | * 包装一种类型 12 | */ 13 | @interface MJType : NSObject 14 | /** 类型标识符 */ 15 | @property (nonatomic, copy) NSString *code; 16 | 17 | /** 是否为id类型 */ 18 | @property (nonatomic, readonly, getter=isIdType) BOOL idType; 19 | 20 | /** 是否为基本数字类型:int、float等 */ 21 | @property (nonatomic, readonly, getter=isNumberType) BOOL numberType; 22 | 23 | /** 对象类型(如果是基本数据类型,此值为nil) */ 24 | @property (nonatomic, readonly) Class typeClass; 25 | 26 | /** 类型是否来自于Foundation框架,比如NSString、NSArray */ 27 | @property (nonatomic, readonly, getter = isFromFoundation) BOOL fromFoundation; 28 | /** 类型是否不支持KVC */ 29 | @property (nonatomic, readonly, getter = isKVCDisabled) BOOL KVCDisabled; 30 | 31 | /** 32 | * 获得缓存的类型对象 33 | */ 34 | + (instancetype)cachedTypeWithCode:(NSString *)code; 35 | @end -------------------------------------------------------------------------------- /Pods/Mantle/Mantle/NSArray+MTLManipulationAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray+MTLManipulationAdditions.h 3 | // Mantle 4 | // 5 | // Created by Josh Abernathy on 9/19/12. 6 | // Copyright (c) 2012 GitHub. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSArray (MTLManipulationAdditions) 12 | 13 | /// The first object in the array or nil if the array is empty. 14 | /// Forwards to `firstObject` which has been first declared in iOS7, but works with iOS4/10.6. 15 | @property (nonatomic, readonly, strong) id mtl_firstObject; 16 | 17 | /// Returns a new array without all instances of the given object. 18 | - (NSArray *)mtl_arrayByRemovingObject:(id)object; 19 | 20 | /// Returns a new array without the first object. If the array is empty, it 21 | /// returns the empty array. 22 | - (NSArray *)mtl_arrayByRemovingFirstObject; 23 | 24 | /// Returns a new array without the last object. If the array is empty, it 25 | /// returns the empty array. 26 | - (NSArray *)mtl_arrayByRemovingLastObject; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-JsonReciprocityTests/Pods-JsonReciprocityTests.debug.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/JSONKit-NoWarning" "${PODS_ROOT}/Headers/Public/JSONModel" "${PODS_ROOT}/Headers/Public/MGBenchmark" "${PODS_ROOT}/Headers/Public/MJExtension" "${PODS_ROOT}/Headers/Public/Mantle" 3 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/JSONKit-NoWarning" -isystem "${PODS_ROOT}/Headers/Public/JSONModel" -isystem "${PODS_ROOT}/Headers/Public/MGBenchmark" -isystem "${PODS_ROOT}/Headers/Public/MJExtension" -isystem "${PODS_ROOT}/Headers/Public/Mantle" 4 | OTHER_LDFLAGS = $(inherited) -ObjC -l"Pods-JsonReciprocityTests-JSONKit-NoWarning" -l"Pods-JsonReciprocityTests-JSONModel" -l"Pods-JsonReciprocityTests-MGBenchmark" -l"Pods-JsonReciprocityTests-MJExtension" -l"Pods-JsonReciprocityTests-Mantle" -framework "Foundation" 5 | OTHER_LIBTOOLFLAGS = $(OTHER_LDFLAGS) 6 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-JsonReciprocityTests/Pods-JsonReciprocityTests.release.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/JSONKit-NoWarning" "${PODS_ROOT}/Headers/Public/JSONModel" "${PODS_ROOT}/Headers/Public/MGBenchmark" "${PODS_ROOT}/Headers/Public/MJExtension" "${PODS_ROOT}/Headers/Public/Mantle" 3 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/JSONKit-NoWarning" -isystem "${PODS_ROOT}/Headers/Public/JSONModel" -isystem "${PODS_ROOT}/Headers/Public/MGBenchmark" -isystem "${PODS_ROOT}/Headers/Public/MJExtension" -isystem "${PODS_ROOT}/Headers/Public/Mantle" 4 | OTHER_LDFLAGS = $(inherited) -ObjC -l"Pods-JsonReciprocityTests-JSONKit-NoWarning" -l"Pods-JsonReciprocityTests-JSONModel" -l"Pods-JsonReciprocityTests-MGBenchmark" -l"Pods-JsonReciprocityTests-MJExtension" -l"Pods-JsonReciprocityTests-Mantle" -framework "Foundation" 5 | OTHER_LIBTOOLFLAGS = $(OTHER_LDFLAGS) 6 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /JsonReciprocityTests/JsonReciprocityTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // JsonReciprocityTests.m 3 | // JsonReciprocityTests 4 | // 5 | // Created by liu on 15/7/9. 6 | // Copyright (c) 2015年 liu. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface JsonReciprocityTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation JsonReciprocityTests 17 | 18 | - (void)setUp { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown { 24 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /Pods/MJExtension/MJExtensionExample/MJExtensionExample/MJExtension/NSObject+MJCoding.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+MJCoding.h 3 | // MJExtension 4 | // 5 | // Created by mj on 14-1-15. 6 | // Copyright (c) 2014年 小码哥. All rights reserved. 7 | // 8 | 9 | #import 10 | /** 11 | * Codeing协议 12 | */ 13 | @protocol MJCoding 14 | @optional 15 | /** 16 | * 这个数组中的属性名才会进行归档 17 | */ 18 | + (NSArray *)allowedCodingPropertyNames; 19 | /** 20 | * 这个数组中的属性名将会被忽略:不进行归档 21 | */ 22 | + (NSArray *)ignoredCodingPropertyNames; 23 | @end 24 | 25 | @interface NSObject (MJCoding) 26 | /** 27 | * 解码(从文件中解析对象) 28 | */ 29 | - (void)decode:(NSCoder *)decoder; 30 | /** 31 | * 编码(将对象写入文件中) 32 | */ 33 | - (void)encode:(NSCoder *)encoder; 34 | @end 35 | 36 | /** 37 | 归档的实现 38 | */ 39 | #define MJCodingImplementation \ 40 | - (id)initWithCoder:(NSCoder *)decoder \ 41 | { \ 42 | if (self = [super init]) { \ 43 | [self decode:decoder]; \ 44 | } \ 45 | return self; \ 46 | } \ 47 | \ 48 | - (void)encodeWithCoder:(NSCoder *)encoder \ 49 | { \ 50 | [self encode:encoder]; \ 51 | } -------------------------------------------------------------------------------- /Pods/Mantle/Mantle/NSArray+MTLManipulationAdditions.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray+MTLManipulationAdditions.m 3 | // Mantle 4 | // 5 | // Created by Josh Abernathy on 9/19/12. 6 | // Copyright (c) 2012 GitHub. All rights reserved. 7 | // 8 | 9 | #import "NSArray+MTLManipulationAdditions.h" 10 | 11 | @interface NSArray (MTLDeclarations) 12 | 13 | // This declaration is needed so Mantle can be compiled with SDK 6 / 10.8. 14 | - (id)firstObject; 15 | 16 | @end 17 | 18 | @implementation NSArray (MTLManipulationAdditions) 19 | 20 | - (id)mtl_firstObject { 21 | return self.firstObject; 22 | } 23 | 24 | - (instancetype)mtl_arrayByRemovingObject:(id)object { 25 | NSMutableArray *result = [self mutableCopy]; 26 | [result removeObject:object]; 27 | return result; 28 | } 29 | 30 | - (instancetype)mtl_arrayByRemovingFirstObject { 31 | if (self.count == 0) return self; 32 | 33 | return [self subarrayWithRange:NSMakeRange(1, self.count - 1)]; 34 | } 35 | 36 | - (instancetype)mtl_arrayByRemovingLastObject { 37 | if (self.count == 0) return self; 38 | 39 | return [self subarrayWithRange:NSMakeRange(0, self.count - 1)]; 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /Pods/Mantle/Mantle/NSDictionary+MTLJSONKeyPath.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSDictionary+MTLJSONKeyPath.h 3 | // Mantle 4 | // 5 | // Created by Robert Böhnke on 19/03/14. 6 | // Copyright (c) 2014 GitHub. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSDictionary (MTLJSONKeyPath) 12 | 13 | /// Looks up the value of a key path in the receiver. 14 | /// 15 | /// JSONKeyPath - The key path that should be resolved. Every element along this 16 | /// key path needs to be an instance of NSDictionary for the 17 | /// resolving to be successful. 18 | /// success - If not NULL, this will be set to a boolean indicating whether 19 | /// the key path was resolved successfully. 20 | /// error - If not NULL, this may be set to an error that occurs during 21 | /// resolving the value. 22 | /// 23 | /// Returns the value for the key path which may be nil. Clients should inspect 24 | /// the success parameter to decide how to proceed with the result. 25 | - (id)mtl_valueForJSONKeyPath:(NSString *)JSONKeyPath success:(BOOL *)success error:(NSError **)error; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Javen_Liu 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /Pods/MGBenchmark/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2013 Mattes Groeger 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /JsonReciprocityTests/TestModels/PersonMTLModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // PersonMTLModel.m 3 | // JVReciprocity 4 | // 5 | // Created by liu on 15-5-8. 6 | // Copyright (c) 2015年 liu. All rights reserved. 7 | // 8 | 9 | #import "PersonMTLModel.h" 10 | 11 | @implementation PersonMTLModel 12 | 13 | + (NSDictionary *)JSONKeyPathsByPropertyKey { 14 | return @{ 15 | @"id": @"id", 16 | @"name": @"name", 17 | @"score": @"score", 18 | @"registerDate": @"register_date", 19 | @"lastLoginTime": @"last_login_time", 20 | @"cars": @"cars", 21 | @"house": @"house", 22 | }; 23 | } 24 | 25 | + (NSValueTransformer *)houseJSONTransformer { 26 | // return [MTLJSONAdapter dictionaryTransformerWithModelClass:HouseMTLModel.class]; 27 | return [NSValueTransformer mtl_JSONDictionaryTransformerWithModelClass:HouseMTLModel.class]; 28 | } 29 | 30 | + (NSValueTransformer *)carsJSONTransformer { 31 | // return [MTLJSONAdapter dictionaryTransformerWithModelClass:CarMTLModel.class]; 32 | return [NSValueTransformer mtl_JSONArrayTransformerWithModelClass:CarMTLModel.class]; 33 | } 34 | 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /Pods/MJExtension/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013-2014 MJExtension (https://github.com/CoderMJLee/MJExtension) 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /Pods/Mantle/Mantle/NSError+MTLModelException.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSError+MTLModelException.m 3 | // Mantle 4 | // 5 | // Created by Robert Böhnke on 7/6/13. 6 | // Copyright (c) 2013 GitHub. All rights reserved. 7 | // 8 | 9 | #import "MTLModel.h" 10 | 11 | #import "NSError+MTLModelException.h" 12 | 13 | // The domain for errors originating from MTLModel. 14 | static NSString * const MTLModelErrorDomain = @"MTLModelErrorDomain"; 15 | 16 | // An exception was thrown and caught. 17 | static const NSInteger MTLModelErrorExceptionThrown = 1; 18 | 19 | // Associated with the NSException that was caught. 20 | static NSString * const MTLModelThrownExceptionErrorKey = @"MTLModelThrownException"; 21 | 22 | @implementation NSError (MTLModelException) 23 | 24 | + (instancetype)mtl_modelErrorWithException:(NSException *)exception { 25 | NSParameterAssert(exception != nil); 26 | 27 | NSDictionary *userInfo = @{ 28 | NSLocalizedDescriptionKey: exception.description, 29 | NSLocalizedFailureReasonErrorKey: exception.reason, 30 | MTLModelThrownExceptionErrorKey: exception 31 | }; 32 | 33 | return [NSError errorWithDomain:MTLModelErrorDomain code:MTLModelErrorExceptionThrown userInfo:userInfo]; 34 | } 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /Pods/Mantle/Mantle/NSDictionary+MTLManipulationAdditions.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSDictionary+MTLManipulationAdditions.m 3 | // Mantle 4 | // 5 | // Created by Justin Spahr-Summers on 2012-09-24. 6 | // Copyright (c) 2012 GitHub. All rights reserved. 7 | // 8 | 9 | #import "NSDictionary+MTLManipulationAdditions.h" 10 | 11 | @implementation NSDictionary (MTLManipulationAdditions) 12 | 13 | - (NSDictionary *)mtl_dictionaryByAddingEntriesFromDictionary:(NSDictionary *)dictionary { 14 | NSMutableDictionary *result = [self mutableCopy]; 15 | [result addEntriesFromDictionary:dictionary]; 16 | return result; 17 | } 18 | 19 | - (NSDictionary *)mtl_dictionaryByRemovingValuesForKeys:(NSArray *)keys { 20 | NSMutableDictionary *result = [self mutableCopy]; 21 | [result removeObjectsForKeys:keys]; 22 | return result; 23 | } 24 | 25 | @end 26 | 27 | @implementation NSDictionary (MTLManipulationAdditions_Deprecated) 28 | 29 | #pragma clang diagnostic push 30 | #pragma clang diagnostic ignored "-Wdeprecated" 31 | 32 | - (NSDictionary *)mtl_dictionaryByRemovingEntriesWithKeys:(NSSet *)keys { 33 | return [self mtl_dictionaryByRemovingValuesForKeys:keys.allObjects]; 34 | } 35 | 36 | #pragma clang diagnostic pop 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /Pods/Mantle/Mantle/NSDictionary+MTLManipulationAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSDictionary+MTLManipulationAdditions.h 3 | // Mantle 4 | // 5 | // Created by Justin Spahr-Summers on 2012-09-24. 6 | // Copyright (c) 2012 GitHub. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSDictionary (MTLManipulationAdditions) 12 | 13 | /// Merges the keys and values from the given dictionary into the receiver. If 14 | /// both the receiver and `dictionary` have a given key, the value from 15 | /// `dictionary` is used. 16 | /// 17 | /// Returns a new dictionary containing the entries of the receiver combined with 18 | /// those of `dictionary`. 19 | - (NSDictionary *)mtl_dictionaryByAddingEntriesFromDictionary:(NSDictionary *)dictionary; 20 | 21 | /// Creates a new dictionary with all the entries for the given keys removed from 22 | /// the receiver. 23 | - (NSDictionary *)mtl_dictionaryByRemovingValuesForKeys:(NSArray *)keys; 24 | 25 | @end 26 | 27 | @interface NSDictionary (MTLManipulationAdditions_Deprecated) 28 | 29 | - (NSDictionary *)mtl_dictionaryByRemovingEntriesWithKeys:(NSSet *)keys __attribute__((deprecated("Replaced by -mtl_dictionaryByRemovingValuesForKeys:"))); 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /JsonReciprocityTests/TestModels/SimpleTypeTestModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // SimpleTypeTestModel.h 3 | // JVReciprocity 4 | // 5 | // Created by liu on 15-5-7. 6 | // Copyright (c) 2015年 liu. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface SimpleTypeTestModel : NSObject 13 | 14 | @property (assign, nonatomic) short shortNumber; 15 | @property (assign, nonatomic) int intNumber; 16 | @property (assign, nonatomic) long longNumber; 17 | @property (assign, nonatomic) NSInteger integerNumber; 18 | @property (copy, nonatomic) NSNumber *numberInt; 19 | 20 | @property (assign, nonatomic) float floatNumber; 21 | @property (assign, nonatomic) double doubleNumber; 22 | @property (assign, nonatomic) CGFloat cgfloatNumber; 23 | @property (copy, nonatomic) NSNumber *numberFloat; 24 | 25 | @property (assign, nonatomic) BOOL boolYES; 26 | @property (assign, nonatomic) BOOL boolNum; 27 | @property (copy, nonatomic) NSNumber *numberBool; 28 | 29 | @property (assign, nonatomic) NSTimeInterval timestamp; 30 | 31 | @property (strong, nonatomic) NSDate *date; 32 | 33 | @property (copy, nonatomic) NSString *string; 34 | 35 | @property (copy, nonatomic) NSURL *url; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /JsonReciprocity/Model/TestObject.m: -------------------------------------------------------------------------------- 1 | // 2 | // TestObject.m 3 | // JsonReciprocity 4 | // 5 | // Created by liu on 15/7/12. 6 | // Copyright (c) 2015年 liu. All rights reserved. 7 | // 8 | 9 | #import "TestObject.h" 10 | 11 | @implementation TestObject 12 | 13 | + (NSDictionary *)customReferenceDict { 14 | return @{@"content_detail" : @"str"}; 15 | } 16 | 17 | + (BOOL)isIgnorePropertyKey:(NSString *)key { 18 | if ([key isEqualToString:@"test"]) { 19 | return YES; 20 | } 21 | return NO; 22 | } 23 | 24 | - (id)customFormat:(NSString *)keyPath value:(id)value { 25 | if ([keyPath isEqualToString:@"date1"]) { 26 | NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; 27 | formatter.dateFormat = @"yyyy/MM/dd"; 28 | NSDate *date = [formatter dateFromString:value]; 29 | return date; 30 | } else if ([keyPath isEqualToString:@"date2"]) { 31 | NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; 32 | formatter.dateFormat = @"yyyy.MM.dd"; 33 | NSDate *date = [formatter dateFromString:value]; 34 | return date; 35 | } 36 | return value; 37 | } 38 | 39 | - (NSString *)description { 40 | return [self toJsonString]; 41 | } 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /Pods/MJExtension/MJExtensionExample/MJExtensionExample/MJExtension/MJFoundation.m: -------------------------------------------------------------------------------- 1 | // 2 | // MJFoundation.m 3 | // MJExtensionExample 4 | // 5 | // Created by MJ Lee on 14/7/16. 6 | // Copyright (c) 2014年 小码哥. All rights reserved. 7 | // 8 | 9 | #import "MJFoundation.h" 10 | #import "MJConst.h" 11 | #import 12 | 13 | static NSSet *_foundationClasses; 14 | 15 | @implementation MJFoundation 16 | 17 | + (void)load 18 | { 19 | _foundationClasses = [NSSet setWithObjects: 20 | [NSObject class], 21 | [NSURL class], 22 | [NSDate class], 23 | [NSNumber class], 24 | [NSDecimalNumber class], 25 | [NSData class], 26 | [NSMutableData class], 27 | [NSArray class], 28 | [NSMutableArray class], 29 | [NSDictionary class], 30 | [NSMutableDictionary class], 31 | [NSManagedObject class], 32 | [NSString class], 33 | [NSMutableString class], nil]; 34 | } 35 | 36 | + (BOOL)isClassFromFoundation:(Class)c 37 | { 38 | return [_foundationClasses containsObject:c]; 39 | } 40 | @end 41 | -------------------------------------------------------------------------------- /Pods/JSONModel/LICENSE_jsonmodel.txt: -------------------------------------------------------------------------------- 1 | JSONModel 2 | 3 | Copyright (c) 2012-2014 Marin Todorov, Underplot ltd. 4 | This code is distributed under the terms and conditions of the MIT license. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | this software and associated documentation files (the "Software"), to deal in the 8 | Software without restriction, including without limitation the rights to use, copy, 9 | modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 10 | and to permit persons to whom the Software is furnished to do so, subject to the 11 | following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 17 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 18 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 20 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 21 | OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | The MIT License in plain English: http://www.touch-code-magazine.com/JSONModel/MITLicense 24 | -------------------------------------------------------------------------------- /Pods/Mantle/Mantle/MTLReflection.h: -------------------------------------------------------------------------------- 1 | // 2 | // MTLReflection.h 3 | // Mantle 4 | // 5 | // Created by Justin Spahr-Summers on 2013-03-12. 6 | // Copyright (c) 2013 GitHub. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /// Creates a selector from a key and a constant string. 12 | /// 13 | /// key - The key to insert into the generated selector. This key should be in 14 | /// its natural case. 15 | /// suffix - A string to append to the key as part of the selector. 16 | /// 17 | /// Returns a selector, or NULL if the input strings cannot form a valid 18 | /// selector. 19 | SEL MTLSelectorWithKeyPattern(NSString *key, const char *suffix) __attribute__((pure, nonnull(1, 2))); 20 | 21 | /// Creates a selector from a key and a constant prefix and suffix. 22 | /// 23 | /// prefix - A string to prepend to the key as part of the selector. 24 | /// key - The key to insert into the generated selector. This key should be in 25 | /// its natural case, and will have its first letter capitalized when 26 | /// inserted. 27 | /// suffix - A string to append to the key as part of the selector. 28 | /// 29 | /// Returns a selector, or NULL if the input strings cannot form a valid 30 | /// selector. 31 | SEL MTLSelectorWithCapitalizedKeyPattern(const char *prefix, NSString *key, const char *suffix) __attribute__((pure, nonnull(1, 2, 3))); 32 | -------------------------------------------------------------------------------- /JsonReciprocityTests/IrregularTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // IrregularTest.m 3 | // JVReciprocity 4 | // 5 | // Created by liu on 15-5-7. 6 | // Copyright (c) 2015年 liu. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "IrregularTestModel.h" 11 | #import "NSObject+JsonReciprocity.h" 12 | #import "JsonReciprocity.h" 13 | 14 | @interface IrregularTests : XCTestCase 15 | 16 | @end 17 | 18 | @implementation IrregularTests 19 | 20 | - (void)testIrregular { 21 | NSString *path = [[NSBundle mainBundle] pathForResource:@"irregular_key" ofType:@"json"]; 22 | NSString *json = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; 23 | XCTAssertNotNil(json); 24 | 25 | NSDictionary *jsonDict = [json toJsonDictionary]; 26 | IrregularTestModel *model = [IrregularTestModel objectFromJsonDict:jsonDict]; 27 | 28 | XCTAssertEqual(model.id, 111); 29 | XCTAssertEqual(model.userId, 4096); 30 | XCTAssertEqual(model.carId, 1234); 31 | XCTAssertEqualObjects(model.exprideTime, [NSDate dateWithTimeIntervalSince1970:1430647083]); 32 | XCTAssertEqualObjects(model.lastDate, [NSDate dateWithTimeIntervalSince1970:1430647083]); 33 | XCTAssertEqualObjects(model.car, @"car"); 34 | XCTAssertEqualObjects(model.camelCaseTest, @"this is string"); 35 | XCTAssertEqualObjects(model.upper_case, @"upper"); 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /JsonReciprocityTests/JsonSerializationTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // JsonSerializationTest.m 3 | // JVReciprocity 4 | // 5 | // Created by liu on 15-5-8. 6 | // Copyright (c) 2015年 liu. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import 12 | #import 13 | #import 14 | #import "JsonReciprocity.h" 15 | 16 | @interface JsonSerializationTests : XCTestCase 17 | 18 | @end 19 | 20 | @implementation JsonSerializationTests 21 | 22 | 23 | - (void)testPerformanceExample { 24 | 25 | NSString *path = [[NSBundle mainBundle] pathForResource:@"multi_complex" ofType:@"json"]; 26 | NSString *json = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; 27 | XCTAssertNotNil(json); 28 | 29 | 30 | MGBenchmarkSession *session = [MGBenchmark start:@"demo"]; 31 | 32 | NSInteger times = 100; 33 | 34 | [session step:@"start"]; 35 | for (int i = 0; i < times; i++) { 36 | NSDictionary *dict1 = [json toJsonDictionary]; 37 | } 38 | 39 | [session step:@"JsonReciprocity"]; 40 | 41 | for (int i = 0; i < times; i++) { 42 | NSDictionary *dict2 = [json objectFromJSONString]; 43 | } 44 | [session step:@"JsonKit"]; 45 | [session total]; 46 | [MGBenchmark finish:@"demo"]; 47 | 48 | 49 | 50 | } 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /JsonReciprocity/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /JsonReciprocity/JsonReciprocity/NSObject+JsonReciprocity.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+Exchange.h 3 | // 4 | // Created by liu on 14-12-30. 5 | // 6 | // 7 | 8 | #import 9 | 10 | @protocol JsonReciprocityDelegate 11 | 12 | @optional 13 | 14 | /** 15 | * 自定义映射值 16 | */ 17 | + (id)customFormat:(NSString *)keyPath value:(id)value; 18 | 19 | /** 20 | * 是否需要忽略某些字段,默认为 NO 21 | */ 22 | + (BOOL)isIgnorePropertyKey:(NSString *)key; 23 | 24 | /** 25 | * 自定义映射字典 26 | */ 27 | + (NSDictionary *)customReferenceDict; 28 | 29 | /** 30 | * 如果映射的类里面包含了数组,则可以指定该数组里元素继续被映射成什么类的对象 31 | */ 32 | + (NSDictionary *)classReferenceDictForArray; 33 | 34 | /** 35 | * 自动把下划线转驼峰,默认为 YES 36 | */ 37 | + (BOOL)autoUpperCaseToCamelCase; 38 | 39 | @end 40 | 41 | @interface NSObject (JsonReciprocity) 42 | 43 | /** 44 | * Object -> NSDictionary 45 | */ 46 | - (NSDictionary *)toJsonDictionary; 47 | 48 | - (NSDictionary *)toJsonDictionaryIgnoreNullKey:(BOOL)isIgnoreNullKey; 49 | 50 | /** 51 | * NSDictionary -> Object 52 | */ 53 | + (id)objectFromJsonDict:(NSDictionary *)dict; 54 | 55 | /** 56 | * JsonArray -> ObjectArray 57 | */ 58 | + (NSMutableArray *)objectArrayFromJsonArray:(NSArray *)jsonArray; 59 | 60 | /** 61 | * Dictionary With Key->Property Name, Value->Class Name 62 | */ 63 | + (NSDictionary *)propertysWithTypes; 64 | 65 | /** 66 | * NSArray With All Property Name 67 | */ 68 | + (NSArray *)propertys; 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /Pods/MJExtension/MJExtensionExample/MJExtensionExample/MJExtension/MJProperty.h: -------------------------------------------------------------------------------- 1 | // 2 | // MJProperty.h 3 | // MJExtensionExample 4 | // 5 | // Created by MJ Lee on 15/4/17. 6 | // Copyright (c) 2015年 小码哥. All rights reserved. 7 | // 包装一个成员属性 8 | 9 | #import 10 | #import 11 | @class MJType; 12 | 13 | /** 14 | * 包装一个成员 15 | */ 16 | @interface MJProperty : NSObject 17 | /** 成员属性 */ 18 | @property (nonatomic, assign) objc_property_t property; 19 | /** 成员属性名 */ 20 | @property (nonatomic, readonly) NSString *name; 21 | 22 | /** 成员变量的类型 */ 23 | @property (nonatomic, readonly) MJType *type; 24 | /** 成员来源于哪个类(可能是父类) */ 25 | @property (nonatomic, assign) Class srcClass; 26 | 27 | /**** 同一个成员变量 - 父类和子类的行为可能不一致(key、keys、objectClassInArray) ****/ 28 | /** 对应着字典中的key */ 29 | - (void)setKey:(NSString *)key forClass:(Class)c; 30 | - (NSString *)keyFromClass:(Class)c; 31 | 32 | /** 对应着字典中的多级key */ 33 | - (NSArray *)keysFromClass:(Class)c; 34 | 35 | /** 模型数组中的模型类型 */ 36 | - (void)setObjectClassInArray:(Class)objectClass forClass:(Class)c; 37 | - (Class)objectClassInArrayFromClass:(Class)c; 38 | /**** 同一个成员变量 - 父类和子类的行为可能不一致(key、keys、objectClassInArray) ****/ 39 | 40 | /** 41 | * 设置成员变量的值 42 | */ 43 | - (void)setValue:(id)value forObject:(id)object; 44 | /** 45 | * 得到成员变量的值 46 | */ 47 | - (id)valueFromObject:(id)object; 48 | 49 | /** 50 | * 初始化 51 | */ 52 | + (instancetype)cachedPropertyWithProperty:(objc_property_t)property; 53 | @end 54 | -------------------------------------------------------------------------------- /JsonReciprocity/JsonReciprocity/JsonSerialization.m: -------------------------------------------------------------------------------- 1 | // 2 | // JsonSerialization.m 3 | // 4 | // Created by liu on 15-2-11. 5 | // Copyright (c) 2015年 liu. All rights reserved. 6 | // 7 | 8 | #import "NSObject+JsonReciprocity.h" 9 | #import "JsonSerialization.h" 10 | #import "JsonDeserialization.h" 11 | 12 | 13 | @implementation NSObject (JsonSerialization) 14 | 15 | - (NSString *)toJsonString { 16 | return [NSString jsonStringFromObject:self isPretty:NO]; 17 | } 18 | 19 | - (NSString *)toPrettyJsonString { 20 | return [NSString jsonStringFromObject:self isPretty:YES]; 21 | } 22 | 23 | @end 24 | 25 | @implementation NSString (JsonSerialization) 26 | 27 | + (NSString *)jsonStringFromObject:(id)object { 28 | return [self jsonStringFromObject:object isPretty:NO]; 29 | } 30 | 31 | + (NSString *)jsonStringFromObject:(id)object isPretty:(BOOL)isPretty { 32 | id obj = object; 33 | if (![obj isKindOfClass:[NSArray class]] && ![obj isKindOfClass:[NSDictionary class]]) { 34 | obj = [obj toJsonDictionary]; 35 | } 36 | if (![NSJSONSerialization isValidJSONObject:obj]) { 37 | return nil; 38 | } 39 | NSError *error = nil; 40 | NSJSONWritingOptions opt = isPretty ? NSJSONWritingPrettyPrinted : 0; 41 | NSData *data = [NSJSONSerialization dataWithJSONObject:obj options:opt error:&error]; 42 | if (error) { 43 | return nil; 44 | } else { 45 | return [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; 46 | } 47 | } 48 | 49 | @end -------------------------------------------------------------------------------- /Pods/Mantle/Mantle/NSValueTransformer+MTLInversionAdditions.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSValueTransformer+MTLInversionAdditions.m 3 | // Mantle 4 | // 5 | // Created by Justin Spahr-Summers on 2013-05-18. 6 | // Copyright (c) 2013 GitHub. All rights reserved. 7 | // 8 | 9 | #import "NSValueTransformer+MTLInversionAdditions.h" 10 | #import "MTLTransformerErrorHandling.h" 11 | #import "MTLValueTransformer.h" 12 | 13 | @implementation NSValueTransformer (MTLInversionAdditions) 14 | 15 | - (NSValueTransformer *)mtl_invertedTransformer { 16 | NSParameterAssert(self.class.allowsReverseTransformation); 17 | 18 | if ([self conformsToProtocol:@protocol(MTLTransformerErrorHandling)]) { 19 | NSParameterAssert([self respondsToSelector:@selector(reverseTransformedValue:success:error:)]); 20 | 21 | id errorHandlingSelf = (id)self; 22 | 23 | return [MTLValueTransformer transformerUsingForwardBlock:^(id value, BOOL *success, NSError **error) { 24 | return [errorHandlingSelf reverseTransformedValue:value success:success error:error]; 25 | } reverseBlock:^(id value, BOOL *success, NSError **error) { 26 | return [errorHandlingSelf transformedValue:value success:success error:error]; 27 | }]; 28 | } else { 29 | return [MTLValueTransformer transformerUsingForwardBlock:^(id value, BOOL *success, NSError **error) { 30 | return [self reverseTransformedValue:value]; 31 | } reverseBlock:^(id value, BOOL *success, NSError **error) { 32 | return [self transformedValue:value]; 33 | }]; 34 | } 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /JsonReciprocityTests/CustomTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // CustomTests.m 3 | // JsonReciprocity 4 | // 5 | // Created by liu on 15/8/26. 6 | // Copyright (c) 2015年 liu. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "JsonReciprocity.h" 12 | #import "CustomObject.h" 13 | 14 | 15 | @interface CustomTests : XCTestCase 16 | 17 | @end 18 | 19 | @implementation CustomTests 20 | 21 | - (void)setUp { 22 | [super setUp]; 23 | // Put setup code here. This method is called before the invocation of each test method in the class. 24 | } 25 | 26 | - (void)tearDown { 27 | // Put teardown code here. This method is called after the invocation of each test method in the class. 28 | [super tearDown]; 29 | } 30 | 31 | - (void)testExample { 32 | // This is an example of a functional test case. 33 | // XCTAssert(YES, @"Pass"); 34 | 35 | NSString *str = @"{\"code\":0,\"message\":\"\",\"data\":null}"; 36 | 37 | CustomObject *object = [CustomObject objectFromJsonDict:[str toJsonDictionary]]; 38 | NSLog(@"object %@", [object toPrettyJsonString]); 39 | NSLog(@"properties %@", [CustomObject propertys]); 40 | [object setValue:@"adsf" forKey:@"test"]; 41 | // object.test = @"ser"; 42 | NSLog(@"object %@", [object toPrettyJsonString]); 43 | } 44 | 45 | - (void)testPerformanceExample { 46 | // This is an example of a performance test case. 47 | [self measureBlock:^{ 48 | // Put the code you want to measure the time of here. 49 | }]; 50 | } 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /JsonReciprocity/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /Pods/Mantle/Mantle/NSDictionary+MTLJSONKeyPath.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSDictionary+MTLJSONKeyPath.m 3 | // Mantle 4 | // 5 | // Created by Robert Böhnke on 19/03/14. 6 | // Copyright (c) 2014 GitHub. All rights reserved. 7 | // 8 | 9 | #import "NSDictionary+MTLJSONKeyPath.h" 10 | 11 | #import "MTLJSONAdapter.h" 12 | 13 | @implementation NSDictionary (MTLJSONKeyPath) 14 | 15 | - (id)mtl_valueForJSONKeyPath:(NSString *)JSONKeyPath success:(BOOL *)success error:(NSError **)error { 16 | NSArray *components = [JSONKeyPath componentsSeparatedByString:@"."]; 17 | 18 | id result = self; 19 | for (NSString *component in components) { 20 | // Check the result before resolving the key path component to not 21 | // affect the last value of the path. 22 | if (result == nil || result == NSNull.null) break; 23 | 24 | if (![result isKindOfClass:NSDictionary.class]) { 25 | if (error != NULL) { 26 | NSDictionary *userInfo = @{ 27 | NSLocalizedDescriptionKey: NSLocalizedString(@"Invalid JSON dictionary", @""), 28 | NSLocalizedFailureReasonErrorKey: [NSString stringWithFormat:NSLocalizedString(@"JSON key path %1$@ could not resolved because an incompatible JSON dictionary was supplied: \"%2$@\"", @""), JSONKeyPath, self] 29 | }; 30 | 31 | *error = [NSError errorWithDomain:MTLJSONAdapterErrorDomain code:MTLJSONAdapterErrorInvalidJSONDictionary userInfo:userInfo]; 32 | } 33 | 34 | if (success != NULL) *success = NO; 35 | 36 | return nil; 37 | } 38 | 39 | result = result[component]; 40 | } 41 | 42 | if (success != NULL) *success = YES; 43 | 44 | return result; 45 | } 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-JsonReciprocityTests/Pods-JsonReciprocityTests-environment.h: -------------------------------------------------------------------------------- 1 | 2 | // To check if a library is compiled with CocoaPods you 3 | // can use the `COCOAPODS` macro definition which is 4 | // defined in the xcconfigs so it is available in 5 | // headers also when they are imported in the client 6 | // project. 7 | 8 | 9 | // JSONKit-NoWarning 10 | #define COCOAPODS_POD_AVAILABLE_JSONKit_NoWarning 11 | #define COCOAPODS_VERSION_MAJOR_JSONKit_NoWarning 1 12 | #define COCOAPODS_VERSION_MINOR_JSONKit_NoWarning 2 13 | #define COCOAPODS_VERSION_PATCH_JSONKit_NoWarning 0 14 | 15 | // JSONModel 16 | #define COCOAPODS_POD_AVAILABLE_JSONModel 17 | #define COCOAPODS_VERSION_MAJOR_JSONModel 1 18 | #define COCOAPODS_VERSION_MINOR_JSONModel 0 19 | #define COCOAPODS_VERSION_PATCH_JSONModel 2 20 | 21 | // MGBenchmark 22 | #define COCOAPODS_POD_AVAILABLE_MGBenchmark 23 | #define COCOAPODS_VERSION_MAJOR_MGBenchmark 0 24 | #define COCOAPODS_VERSION_MINOR_MGBenchmark 3 25 | #define COCOAPODS_VERSION_PATCH_MGBenchmark 0 26 | 27 | // MJExtension 28 | #define COCOAPODS_POD_AVAILABLE_MJExtension 29 | #define COCOAPODS_VERSION_MAJOR_MJExtension 2 30 | #define COCOAPODS_VERSION_MINOR_MJExtension 0 31 | #define COCOAPODS_VERSION_PATCH_MJExtension 4 32 | 33 | // Mantle 34 | #define COCOAPODS_POD_AVAILABLE_Mantle 35 | #define COCOAPODS_VERSION_MAJOR_Mantle 2 36 | #define COCOAPODS_VERSION_MINOR_Mantle 0 37 | #define COCOAPODS_VERSION_PATCH_Mantle 2 38 | 39 | // Mantle/extobjc 40 | #define COCOAPODS_POD_AVAILABLE_Mantle_extobjc 41 | #define COCOAPODS_VERSION_MAJOR_Mantle_extobjc 2 42 | #define COCOAPODS_VERSION_MINOR_Mantle_extobjc 0 43 | #define COCOAPODS_VERSION_PATCH_Mantle_extobjc 2 44 | 45 | -------------------------------------------------------------------------------- /Pods/MGBenchmark/MGBenchmark/Output/MGConsoleUtil.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Mattes Groeger 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #import 24 | #import 25 | 26 | 27 | @interface MGConsoleUtil : NSObject 28 | 29 | + (NSString *)formatTime:(NSTimeInterval)time1 format:(NSString *)format multiplier:(CGFloat)multiplier; 30 | 31 | + (void)logWithFormat:(NSString *)format andReplacement:(NSDictionary *)replacement; 32 | 33 | + (NSString *)string:(NSString *)string withKeyValueReplacement:(NSDictionary *)replacement; 34 | 35 | @end -------------------------------------------------------------------------------- /JsonReciprocity/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /JsonReciprocityTests/JsonFile/complex.json: -------------------------------------------------------------------------------- 1 | { 2 | "code":200, 3 | "total":1, 4 | "page":1, 5 | "msg":"success", 6 | "data":[{ 7 | "id": 1420194, 8 | "name" : "Jack", 9 | "score" : 88.33, 10 | "register_date" : 1428647083, 11 | "last_login_time" : 1430642742, 12 | "cars":[{ 13 | "brand":"benz", 14 | "num":"A14212" 15 | },{ 16 | "brand":"audi", 17 | "num":"B83143" 18 | }], 19 | "house": { 20 | "address": "China GuangZhou", 21 | "area": 95.6, 22 | "tags":[ 23 | "nice", 24 | "comfort" 25 | ]} 26 | },{ 27 | "id": 1230794, 28 | "name" : "Tom", 29 | "score" : 67.24, 30 | "register_date" : 1421647083, 31 | "last_login_time" : 1430847083, 32 | "cars":[{ 33 | "brand":"toyota", 34 | "num":"C03914" 35 | },{ 36 | "brand":"honda", 37 | "num":"D35813" 38 | }], 39 | "house": { 40 | "address": "China Hangzhou", 41 | "area": 88.2, 42 | "tags":[ 43 | "quiet", 44 | "good" 45 | ]} 46 | },{ 47 | "id": 2914834, 48 | "name" : "Sammi", 49 | "score" : 92.43, 50 | "register_date" : 1430647083, 51 | "last_login_time" : 1430947083, 52 | "cars":[{ 53 | "brand":"porsche", 54 | "num":"E59832" 55 | },{ 56 | "brand":"BMW", 57 | "num":"F93057" 58 | }], 59 | "house": { 60 | "address": "China Shenzhen", 61 | "area": 103.3, 62 | "tags":[ 63 | "convenience", 64 | "luxury" 65 | ]} 66 | }] 67 | } -------------------------------------------------------------------------------- /Pods/JSONModel/JSONModel/JSONModelCategories/NSArray+JSONModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray+JSONModel.m 3 | // 4 | // @version 1.0.2 5 | // @author Marin Todorov, http://www.touch-code-magazine.com 6 | // 7 | 8 | // Copyright (c) 2012-2014 Marin Todorov, Underplot ltd. 9 | // This code is distributed under the terms and conditions of the MIT license. 10 | // 11 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 14 | // 15 | // The MIT License in plain English: http://www.touch-code-magazine.com/JSONModel/MITLicense 16 | 17 | 18 | #import "NSArray+JSONModel.h" 19 | 20 | @implementation NSArray(JSONModel) 21 | 22 | - (id)modelWithIndexValue:(id)indexValue 23 | { 24 | NSAssert(NO, @"call modelWithIndexValue: on a ConvertOnDemand property, which is defined like that: @property (strong, nonatomic) NSArray* list;"); 25 | return nil; 26 | } 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /Pods/MGBenchmark/MGBenchmark/Output/MGBenchmarkTarget.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Mattes Groeger 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #import 24 | 25 | @class MGBenchmarkSession; 26 | 27 | @protocol MGBenchmarkTarget 28 | 29 | @optional 30 | 31 | /** 32 | * Gets called for in-between steps in a benchmark session. The time since 33 | * the last step (if any) or since the session start is passed in. 34 | */ 35 | - (void)passedTime:(NSTimeInterval)passedTime forStep:(NSString *)stepName inSession:(MGBenchmarkSession*)session; 36 | 37 | /** 38 | * This method is called when the total time since session start was 39 | * measured. It gets passed in as `passedTime`. 40 | */ 41 | - (void)totalTime:(NSTimeInterval)passedTime inSession:(MGBenchmarkSession*)session; 42 | 43 | @end -------------------------------------------------------------------------------- /Pods/JSONModel/JSONModel/JSONModelLib.h: -------------------------------------------------------------------------------- 1 | // 2 | // JSONModelLib.h 3 | // 4 | // @version 1.0.2 5 | // @author Marin Todorov, http://www.touch-code-magazine.com 6 | // 7 | 8 | // Copyright (c) 2012-2014 Marin Todorov, Underplot ltd. 9 | // This code is distributed under the terms and conditions of the MIT license. 10 | // 11 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 14 | // 15 | // The MIT License in plain English: http://www.touch-code-magazine.com/JSONModel/MITLicense 16 | 17 | #import 18 | 19 | //JSONModel transformations 20 | #import "JSONValueTransformer.h" 21 | #import "JSONKeyMapper.h" 22 | 23 | //basic JSONModel classes 24 | #import "JSONModelError.h" 25 | #import "JSONModelClassProperty.h" 26 | #import "JSONModel.h" 27 | 28 | //network classes 29 | #import "JSONHTTPClient.h" 30 | #import "JSONModel+networking.h" 31 | #import "JSONAPI.h" 32 | 33 | //models array 34 | #import "NSArray+JSONModel.h" 35 | #import "JSONModelArray.h" -------------------------------------------------------------------------------- /Pods/MJExtension/MJExtensionExample/MJExtensionExample/MJExtension/NSObject+MJCoding.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+MJCoding.m 3 | // MJExtension 4 | // 5 | // Created by mj on 14-1-15. 6 | // Copyright (c) 2014年 小码哥. All rights reserved. 7 | // 8 | 9 | #import "NSObject+MJCoding.h" 10 | #import "NSObject+MJProperty.h" 11 | #import "MJProperty.h" 12 | 13 | @implementation NSObject (MJCoding) 14 | 15 | - (void)encode:(NSCoder *)encoder 16 | { 17 | Class class = [self class]; 18 | 19 | NSArray *allowedCodingPropertyNames = [class totalAllowedCodingPropertyNames]; 20 | NSArray *ignoredCodingPropertyNames = [class totalIgnoredCodingPropertyNames]; 21 | 22 | [class enumeratePropertiesWithBlock:^(MJProperty *property, BOOL *stop) { 23 | if (allowedCodingPropertyNames.count && ![allowedCodingPropertyNames containsObject:property.name]) return; 24 | // 检测是否被忽略 25 | if ([ignoredCodingPropertyNames containsObject:property.name]) return; 26 | 27 | id value = [property valueFromObject:self]; 28 | if (value == nil) return; 29 | [encoder encodeObject:value forKey:property.name]; 30 | }]; 31 | } 32 | 33 | - (void)decode:(NSCoder *)decoder 34 | { 35 | Class class = [self class]; 36 | 37 | NSArray *allowedCodingPropertyNames = [class totalAllowedCodingPropertyNames]; 38 | NSArray *ignoredCodingPropertyNames = [class totalIgnoredCodingPropertyNames]; 39 | 40 | [class enumeratePropertiesWithBlock:^(MJProperty *property, BOOL *stop) { 41 | if (allowedCodingPropertyNames.count && ![allowedCodingPropertyNames containsObject:property.name]) return; 42 | // 检测是否被忽略 43 | if ([ignoredCodingPropertyNames containsObject:property.name]) return; 44 | 45 | id value = [decoder decodeObjectForKey:property.name]; 46 | if (value == nil) return; 47 | [property setValue:value forObject:self]; 48 | }]; 49 | } 50 | @end 51 | -------------------------------------------------------------------------------- /Pods/MJExtension/MJExtensionExample/MJExtensionExample/MJExtension/MJType.m: -------------------------------------------------------------------------------- 1 | // 2 | // MJType.m 3 | // MJExtension 4 | // 5 | // Created by mj on 14-1-15. 6 | // Copyright (c) 2014年 小码哥. All rights reserved. 7 | // 8 | 9 | #import "MJType.h" 10 | #import "MJExtension.h" 11 | #import "MJFoundation.h" 12 | #import "MJConst.h" 13 | 14 | @implementation MJType 15 | 16 | static NSMutableDictionary *_cachedTypes; 17 | + (void)load 18 | { 19 | _cachedTypes = [NSMutableDictionary dictionary]; 20 | } 21 | 22 | + (instancetype)cachedTypeWithCode:(NSString *)code 23 | { 24 | MJAssertParamNotNil2(code, nil); 25 | 26 | MJType *type = _cachedTypes[code]; 27 | if (type == nil) { 28 | type = [[self alloc] init]; 29 | type.code = code; 30 | _cachedTypes[code] = type; 31 | } 32 | return type; 33 | } 34 | 35 | - (void)setCode:(NSString *)code 36 | { 37 | _code = code; 38 | 39 | MJAssertParamNotNil(code); 40 | 41 | if ([code isEqualToString:MJTypeId]) { 42 | _idType = YES; 43 | } else if (code.length == 0) { 44 | _KVCDisabled = YES; 45 | } else if (code.length > 3 && [code hasPrefix:@"@\""]) { 46 | // 去掉@"和",截取中间的类型名称 47 | _code = [code substringWithRange:NSMakeRange(2, code.length - 3)]; 48 | _typeClass = NSClassFromString(_code); 49 | _fromFoundation = [MJFoundation isClassFromFoundation:_typeClass]; 50 | _numberType = (_typeClass == [NSNumber class] || [_typeClass isSubclassOfClass:[NSNumber class]]); 51 | } else if ([code isEqualToString:MJTypeSEL] || 52 | [code isEqualToString:MJTypeIvar] || 53 | [code isEqualToString:MJTypeMethod]) { 54 | _KVCDisabled = YES; 55 | } 56 | 57 | // 是否为数字类型 58 | NSString *lowerCode = _code.lowercaseString; 59 | NSArray *numberTypes = @[MJTypeInt, MJTypeFloat, MJTypeDouble, MJTypeLong, MJTypeChar]; 60 | if ([numberTypes containsObject:lowerCode]) { 61 | _numberType = YES; 62 | } 63 | } 64 | @end 65 | -------------------------------------------------------------------------------- /Pods/MJExtension/MJExtensionExample/MJExtensionExample/MJExtension/MJConst.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __MJConst__H__ 3 | #define __MJConst__H__ 4 | 5 | #import 6 | 7 | // 过期 8 | #define MJDeprecated(instead) NS_DEPRECATED(2_0, 2_0, 2_0, 2_0, instead) 9 | 10 | #ifdef DEBUG // 调试状态 11 | // 打开LOG功能 12 | #define MJLog(...) NSLog(__VA_ARGS__) 13 | #else // 发布状态 14 | // 关闭LOG功能 15 | #define MJLog(...) 16 | #endif 17 | 18 | // 构建错误 19 | #define MJBuildError(error, msg) \ 20 | if (error) *error = [NSError errorWithDomain:msg code:250 userInfo:nil]; 21 | 22 | /** 23 | * 断言 24 | * @param condition 条件 25 | * @param returnValue 返回值 26 | */ 27 | #define MJAssertError(condition, returnValue, error, msg) \ 28 | if ((condition) == NO) { \ 29 | MJBuildError(error, msg); \ 30 | return returnValue;\ 31 | } 32 | 33 | #define MJAssert2(condition, returnValue) \ 34 | if ((condition) == NO) return returnValue; 35 | 36 | /** 37 | * 断言 38 | * @param condition 条件 39 | */ 40 | #define MJAssert(condition) MJAssert2(condition, ) 41 | 42 | /** 43 | * 断言 44 | * @param param 参数 45 | * @param returnValue 返回值 46 | */ 47 | #define MJAssertParamNotNil2(param, returnValue) \ 48 | MJAssert2((param) != nil, returnValue) 49 | 50 | /** 51 | * 断言 52 | * @param param 参数 53 | */ 54 | #define MJAssertParamNotNil(param) MJAssertParamNotNil2(param, ) 55 | 56 | /** 57 | * 打印所有的属性 58 | */ 59 | #define MJLogAllIvars \ 60 | -(NSString *)description \ 61 | { \ 62 | return [self keyValues].description; \ 63 | } 64 | 65 | /** 66 | * 类型(属性类型) 67 | */ 68 | extern NSString *const MJTypeInt; 69 | extern NSString *const MJTypeFloat; 70 | extern NSString *const MJTypeDouble; 71 | extern NSString *const MJTypeLong; 72 | extern NSString *const MJTypeLongLong; 73 | extern NSString *const MJTypeChar; 74 | extern NSString *const MJTypeBOOL; 75 | extern NSString *const MJTypePointer; 76 | 77 | extern NSString *const MJTypeIvar; 78 | extern NSString *const MJTypeMethod; 79 | extern NSString *const MJTypeBlock; 80 | extern NSString *const MJTypeClass; 81 | extern NSString *const MJTypeSEL; 82 | extern NSString *const MJTypeId; 83 | 84 | #endif -------------------------------------------------------------------------------- /Pods/MGBenchmark/MGBenchmark/Output/MGConsoleUtil.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Mattes Groeger 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #import 24 | #import "MGConsoleUtil.h" 25 | 26 | 27 | @implementation MGConsoleUtil 28 | 29 | + (NSString *)formatTime:(NSTimeInterval)time format:(NSString *)format multiplier:(CGFloat)multiplier 30 | { 31 | return [NSString stringWithFormat:format, time * multiplier]; 32 | } 33 | 34 | + (void)logWithFormat:(NSString *)format andReplacement:(NSDictionary *)replacement 35 | { 36 | NSLog(@"%@", [self string:format withKeyValueReplacement:replacement]); 37 | } 38 | 39 | + (NSString *)string:(NSString *)string withKeyValueReplacement:(NSDictionary *)replacement 40 | { 41 | for (NSString *key in [replacement allKeys]) 42 | { 43 | id value = [replacement objectForKey:key]; 44 | 45 | string = [string 46 | stringByReplacingOccurrencesOfString:[NSString stringWithFormat:@"${%@}", key] 47 | withString:[NSString stringWithFormat:@"%@", value]]; 48 | } 49 | 50 | return string; 51 | } 52 | 53 | @end -------------------------------------------------------------------------------- /JsonReciprocity/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // JsonReciprocity 4 | // 5 | // Created by liu on 15/7/9. 6 | // Copyright (c) 2015年 liu. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /Pods/Mantle/Mantle/MTLReflection.m: -------------------------------------------------------------------------------- 1 | // 2 | // MTLReflection.m 3 | // Mantle 4 | // 5 | // Created by Justin Spahr-Summers on 2013-03-12. 6 | // Copyright (c) 2013 GitHub. All rights reserved. 7 | // 8 | 9 | #import "MTLReflection.h" 10 | #import 11 | 12 | SEL MTLSelectorWithKeyPattern(NSString *key, const char *suffix) { 13 | NSUInteger keyLength = [key maximumLengthOfBytesUsingEncoding:NSUTF8StringEncoding]; 14 | NSUInteger suffixLength = strlen(suffix); 15 | 16 | char selector[keyLength + suffixLength + 1]; 17 | 18 | BOOL success = [key getBytes:selector maxLength:keyLength usedLength:&keyLength encoding:NSUTF8StringEncoding options:0 range:NSMakeRange(0, key.length) remainingRange:NULL]; 19 | if (!success) return NULL; 20 | 21 | memcpy(selector + keyLength, suffix, suffixLength); 22 | selector[keyLength + suffixLength] = '\0'; 23 | 24 | return sel_registerName(selector); 25 | } 26 | 27 | SEL MTLSelectorWithCapitalizedKeyPattern(const char *prefix, NSString *key, const char *suffix) { 28 | NSUInteger prefixLength = strlen(prefix); 29 | NSUInteger suffixLength = strlen(suffix); 30 | 31 | NSString *initial = [key substringToIndex:1].uppercaseString; 32 | NSUInteger initialLength = [initial maximumLengthOfBytesUsingEncoding:NSUTF8StringEncoding]; 33 | 34 | NSString *rest = [key substringFromIndex:1]; 35 | NSUInteger restLength = [rest maximumLengthOfBytesUsingEncoding:NSUTF8StringEncoding]; 36 | 37 | char selector[prefixLength + initialLength + restLength + suffixLength + 1]; 38 | memcpy(selector, prefix, prefixLength); 39 | 40 | BOOL success = [initial getBytes:selector + prefixLength maxLength:initialLength usedLength:&initialLength encoding:NSUTF8StringEncoding options:0 range:NSMakeRange(0, initial.length) remainingRange:NULL]; 41 | if (!success) return NULL; 42 | 43 | success = [rest getBytes:selector + prefixLength + initialLength maxLength:restLength usedLength:&restLength encoding:NSUTF8StringEncoding options:0 range:NSMakeRange(0, rest.length) remainingRange:NULL]; 44 | if (!success) return NULL; 45 | 46 | memcpy(selector + prefixLength + initialLength + restLength, suffix, suffixLength); 47 | selector[prefixLength + initialLength + restLength + suffixLength] = '\0'; 48 | 49 | return sel_registerName(selector); 50 | } 51 | -------------------------------------------------------------------------------- /Pods/JSONModel/JSONModel/JSONModelCategories/NSArray+JSONModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray+JSONModel.h 3 | // 4 | // @version 1.0.2 5 | // @author Marin Todorov, http://www.touch-code-magazine.com 6 | // 7 | 8 | // Copyright (c) 2012-2014 Marin Todorov, Underplot ltd. 9 | // This code is distributed under the terms and conditions of the MIT license. 10 | // 11 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 14 | // 15 | // The MIT License in plain English: http://www.touch-code-magazine.com/JSONModel/MITLicense 16 | 17 | 18 | #import 19 | #import "JSONModel.h" 20 | 21 | /** 22 | * Exposes invisible JSONModelArray methods 23 | */ 24 | @interface NSArray(JSONModel) 25 | 26 | /** 27 | * Looks up the array's contents and tries to find a JSONModel object 28 | * with matching index property value to the indexValue param. 29 | * 30 | * Will return nil if no matching model is found. Will return nil if there's no index property 31 | * defined on the models found in the array (will sample the first object, assuming the array 32 | * contains homogenous collection of objects) 33 | * 34 | * @param indexValue the id value to search for 35 | * @return the found model or nil 36 | * @exception NSException throws exception if you call this method on an instance, which is not actually a JSONModelArray 37 | */ 38 | - (id)modelWithIndexValue:(id)indexValue; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /Pods/MGBenchmark/MGBenchmark/Output/MGConsoleSummaryOutput.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Mattes Groeger 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #import 24 | #import "MGConsoleOutput.h" 25 | 26 | @interface MGBenchmarkStepData : NSObject 27 | 28 | @property (nonatomic, strong) NSString *stepName; 29 | @property (nonatomic) NSTimeInterval stepTime; 30 | @property (nonatomic) NSUInteger stepCount; 31 | 32 | @end 33 | 34 | @interface MGConsoleSummaryOutput : MGConsoleOutput 35 | { 36 | NSMutableArray *_stepData; 37 | NSTimeInterval _totalStepTime; 38 | } 39 | 40 | /** 41 | * Set this to yes, if you still want to get direct logs for each steps. Usually 42 | * this is not necessary anymore because you get them later as a sorted list. 43 | */ 44 | @property (nonatomic) BOOL logStepsInstantly; 45 | 46 | /** 47 | * You can define a custom output string for the total time by using the 48 | * following placeholders: 49 | * 50 | * ${sessionName} 51 | * ${stepTime} 52 | * ${stepName} 53 | * ${stepPercent} 54 | * ${stepNumber} 55 | * 56 | * Example: 57 | * consoleOutput.totalFormat = @"<< BENCHMARK ${stepTime} (${stepPercent}%) ${stepName} >>"; 58 | */ 59 | @property (nonatomic, strong) NSString *summaryFormat; 60 | 61 | @end -------------------------------------------------------------------------------- /JsonReciprocity/JsonReciprocity/JsonDeserializstion.m: -------------------------------------------------------------------------------- 1 | // 2 | // JsonDeserializstion.m 3 | // JVReciprocity 4 | // 5 | // Created by liu on 15/7/8. 6 | // Copyright (c) 2015年 liu. All rights reserved. 7 | // 8 | 9 | #import "JsonDeserialization.h" 10 | 11 | @implementation NSString (JsonDeserialization) 12 | 13 | -(id)toJsonMutableObject { 14 | NSData* data = [self dataUsingEncoding:NSUTF8StringEncoding]; 15 | NSError* error = nil; 16 | id result = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:&error]; 17 | if (error) { 18 | return nil; 19 | } else { 20 | return result; 21 | } 22 | } 23 | 24 | -(id)toJsonObject { 25 | NSData* data = [self dataUsingEncoding:NSUTF8StringEncoding]; 26 | NSError* error = nil; 27 | id result = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:&error]; 28 | if (error) { 29 | return nil; 30 | } else { 31 | return result; 32 | } 33 | } 34 | 35 | - (NSMutableArray *)toJsonMutableArray { 36 | id result = [self toJsonMutableObject]; 37 | return [result isKindOfClass:[NSMutableArray class]] ? result : nil; 38 | } 39 | 40 | - (NSArray *)toJsonArray { 41 | id result = [self toJsonObject]; 42 | return [result isKindOfClass:[NSArray class]] ? result : nil; 43 | } 44 | 45 | - (NSDictionary *)toJsonMutableDictionary { 46 | id result = [self toJsonMutableObject]; 47 | return [result isKindOfClass:[NSMutableDictionary class]] ? result : nil; 48 | } 49 | 50 | - (NSDictionary *)toJsonDictionary { 51 | id result = [self toJsonObject]; 52 | return [result isKindOfClass:[NSDictionary class]] ? result : nil; 53 | } 54 | 55 | @end 56 | 57 | @implementation NSDictionary(JsonDeserialization) 58 | 59 | + (NSDictionary *)dictionaryFromJsonString:(NSString *)jsonString { 60 | return [jsonString toJsonDictionary]; 61 | } 62 | 63 | + (NSMutableDictionary *)mutableDictionaryFromJsonString:(NSString *)jsonString { 64 | return [jsonString toJsonMutableDictionary]; 65 | } 66 | 67 | @end 68 | 69 | @implementation NSArray(JsonDeserialization) 70 | 71 | + (NSArray *)arrayFromJsonString:(NSString *)jsonString { 72 | return [jsonString toJsonArray]; 73 | } 74 | 75 | + (NSMutableArray *)mutableArrayFromJsonString:(NSString *)jsonString { 76 | return [jsonString toJsonMutableArray]; 77 | } 78 | 79 | @end 80 | 81 | -------------------------------------------------------------------------------- /Pods/Mantle/Mantle/MTLValueTransformer.h: -------------------------------------------------------------------------------- 1 | // 2 | // MTLValueTransformer.h 3 | // Mantle 4 | // 5 | // Created by Justin Spahr-Summers on 2012-09-11. 6 | // Copyright (c) 2012 GitHub. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "MTLTransformerErrorHandling.h" 12 | 13 | /// A block that represents a transformation. 14 | /// 15 | /// value - The value to transform. 16 | /// success - The block must set this parameter to indicate whether the 17 | /// transformation was successful. 18 | /// MTLValueTransformer will always call this block with *success 19 | /// initialized to YES. 20 | /// error - If not NULL, this may be set to an error that occurs during 21 | /// transforming the value. 22 | /// 23 | /// Returns the result of the transformation, which may be nil. 24 | typedef id (^MTLValueTransformerBlock)(id value, BOOL *success, NSError **error); 25 | 26 | /// 27 | /// A value transformer supporting block-based transformation. 28 | /// 29 | @interface MTLValueTransformer : NSValueTransformer 30 | 31 | /// Returns a transformer which transforms values using the given block. Reverse 32 | /// transformations will not be allowed. 33 | + (instancetype)transformerUsingForwardBlock:(MTLValueTransformerBlock)transformation; 34 | 35 | /// Returns a transformer which transforms values using the given block, for 36 | /// forward or reverse transformations. 37 | + (instancetype)transformerUsingReversibleBlock:(MTLValueTransformerBlock)transformation; 38 | 39 | /// Returns a transformer which transforms values using the given blocks. 40 | + (instancetype)transformerUsingForwardBlock:(MTLValueTransformerBlock)forwardTransformation reverseBlock:(MTLValueTransformerBlock)reverseTransformation; 41 | 42 | @end 43 | 44 | @interface MTLValueTransformer (Deprecated) 45 | 46 | + (NSValueTransformer *)transformerWithBlock:(id (^)(id))transformationBlock __attribute__((deprecated("Replaced by +transformerUsingForwardBlock:"))); 47 | 48 | + (NSValueTransformer *)reversibleTransformerWithBlock:(id (^)(id))transformationBlock __attribute__((deprecated("Replaced by +transformerUsingReversibleBlock:"))); 49 | 50 | + (NSValueTransformer *)reversibleTransformerWithForwardBlock:(id (^)(id))forwardBlock reverseBlock:(id (^)(id))reverseBlock __attribute__((deprecated("Replaced by +transformerUsingForwardBlock:reverseBlock:"))); 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /Pods/Mantle/LICENSE.md: -------------------------------------------------------------------------------- 1 | **Copyright (c) GitHub, Inc.** 2 | **All rights reserved.** 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 5 | 6 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 7 | 8 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 9 | 10 | --- 11 | 12 | **This project uses portions of code from the Proton framework.** 13 | **Proton is copyright (c) 2012, Bitswift, Inc.** 14 | **All rights reserved.** 15 | 16 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 17 | 18 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 19 | * Neither the name of the Bitswift, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 | -------------------------------------------------------------------------------- /Pods/MGBenchmark/MGBenchmark/MGBenchmarkSession.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Mattes Groeger 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #import 24 | 25 | // Macro version. When DEBUG is not set, methods are ignored 26 | #define MGBenchStep_1(__SESSION__) [[MGBenchmark session:__SESSION__] step:[NSString stringWithFormat:@"%@ %@", [self class], NSStringFromSelector(_cmd)]] 27 | #define MGBenchStep_2(__SESSION__, __STEP__) [[MGBenchmark session:__SESSION__] step:__STEP__] 28 | #define MGBenchStep_X(x,A,B,FUNC, ...) FUNC 29 | 30 | #ifdef DEBUG 31 | #define MGBenchStep(...) MGBenchStep_X(,##__VA_ARGS__,\ 32 | MGBenchStep_2(__VA_ARGS__),\ 33 | MGBenchStep_1(__VA_ARGS__)\ 34 | ) 35 | #define MGBenchTotal(__SESSION__) [[MGBenchmark session:__SESSION__] total] 36 | #else 37 | #define MGBenchStep(...) do {} while (0) 38 | #define MGBenchTotal(__SESSION__) do {} while (0) 39 | #endif 40 | 41 | @protocol MGBenchmarkTarget; 42 | 43 | @interface MGBenchmarkSession : NSObject 44 | { 45 | NSDate *_startTime; 46 | NSDate *_lastInterim; 47 | } 48 | 49 | @property (nonatomic) NSString *name; 50 | @property (nonatomic) id target; 51 | @property (nonatomic, readonly) NSUInteger stepCount; 52 | @property (nonatomic, readonly) NSTimeInterval averageTime; 53 | 54 | - (id)initWithName:(NSString *)name andTarget:(id )target; 55 | 56 | - (NSTimeInterval)step:(NSString *)null; 57 | 58 | - (NSTimeInterval)total; 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /Pods/MGBenchmark/MGBenchmark/MGBenchmark.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Mattes Groeger 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #import 24 | 25 | // Macro version. When DEBUG is not set, method is ignored 26 | // It also runs [MGBenchmarkSession total] for log output prior to finishing 27 | #ifdef DEBUG 28 | #define MGBenchStart(__SESSION__) [MGBenchmark start:__SESSION__] 29 | #define MGBenchEnd(__SESSION__) [[MGBenchmark session:__SESSION__] total];[MGBenchmark finish:__SESSION__] 30 | #else 31 | #define MGBenchStart(__SESSION__) do {} while (0) 32 | #define MGBenchEnd(__SESSION__) do {} while (0) 33 | #endif 34 | 35 | @protocol MGBenchmarkTarget; 36 | @class MGBenchmarkSession; 37 | 38 | @interface MGBenchmark : NSObject 39 | 40 | /** 41 | * Set a default target. If nothing is provided it will log to the 42 | * console by default. 43 | */ 44 | + (void)setDefaultTarget:(id )target; 45 | 46 | /** 47 | * Starts a new session and assigns the `defaultTarget`. An instance 48 | * of the session is returned. 49 | */ 50 | + (MGBenchmarkSession *)start:(NSString *)sessionName; 51 | 52 | /** 53 | * Returns session by name. You need to start it first! 54 | */ 55 | + (MGBenchmarkSession *)session:(NSString *)sessionName; 56 | 57 | /** 58 | * Finishes a session by name. This allows for garbage collection 59 | * in case the session is otherwise not referenced anymore. 60 | */ 61 | + (void)finish:(NSString *)sessionName; 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /Pods/Mantle/Mantle/extobjc/EXTKeyPathCoding.h: -------------------------------------------------------------------------------- 1 | // 2 | // EXTKeyPathCoding.h 3 | // extobjc 4 | // 5 | // Created by Justin Spahr-Summers on 19.06.12. 6 | // Copyright (C) 2012 Justin Spahr-Summers. 7 | // Released under the MIT license. 8 | // 9 | 10 | #import 11 | #import "metamacros.h" 12 | 13 | /** 14 | * \@keypath allows compile-time verification of key paths. Given a real object 15 | * receiver and key path: 16 | * 17 | * @code 18 | 19 | NSString *UTF8StringPath = @keypath(str.lowercaseString.UTF8String); 20 | // => @"lowercaseString.UTF8String" 21 | 22 | NSString *versionPath = @keypath(NSObject, version); 23 | // => @"version" 24 | 25 | NSString *lowercaseStringPath = @keypath(NSString.new, lowercaseString); 26 | // => @"lowercaseString" 27 | 28 | * @endcode 29 | * 30 | * ... the macro returns an \c NSString containing all but the first path 31 | * component or argument (e.g., @"lowercaseString.UTF8String", @"version"). 32 | * 33 | * In addition to simply creating a key path, this macro ensures that the key 34 | * path is valid at compile-time (causing a syntax error if not), and supports 35 | * refactoring, such that changing the name of the property will also update any 36 | * uses of \@keypath. 37 | */ 38 | #define keypath(...) \ 39 | metamacro_if_eq(1, metamacro_argcount(__VA_ARGS__))(keypath1(__VA_ARGS__))(keypath2(__VA_ARGS__)) 40 | 41 | #define keypath1(PATH) \ 42 | (((void)(NO && ((void)PATH, NO)), strchr(# PATH, '.') + 1)) 43 | 44 | #define keypath2(OBJ, PATH) \ 45 | (((void)(NO && ((void)OBJ.PATH, NO)), # PATH)) 46 | 47 | /** 48 | * \@collectionKeypath allows compile-time verification of key paths across collections NSArray/NSSet etc. Given a real object 49 | * receiver, collection object receiver and related keypaths: 50 | * 51 | * @code 52 | 53 | NSString *employessFirstNamePath = @collectionKeypath(department.employees, Employee.new, firstName) 54 | // => @"employees.firstName" 55 | 56 | NSString *employessFirstNamePath = @collectionKeypath(Department.new, employees, Employee.new, firstName) 57 | // => @"employees.firstName" 58 | 59 | * @endcode 60 | * 61 | */ 62 | #define collectionKeypath(...) \ 63 | metamacro_if_eq(3, metamacro_argcount(__VA_ARGS__))(collectionKeypath3(__VA_ARGS__))(collectionKeypath4(__VA_ARGS__)) 64 | 65 | #define collectionKeypath3(PATH, COLLECTION_OBJECT, COLLECTION_PATH) ([[NSString stringWithFormat:@"%s.%s",keypath(PATH), keypath(COLLECTION_OBJECT, COLLECTION_PATH)] UTF8String]) 66 | 67 | #define collectionKeypath4(OBJ, PATH, COLLECTION_OBJECT, COLLECTION_PATH) ([[NSString stringWithFormat:@"%s.%s",keypath(OBJ, PATH), keypath(COLLECTION_OBJECT, COLLECTION_PATH)] UTF8String]) 68 | 69 | -------------------------------------------------------------------------------- /Pods/MGBenchmark/MGBenchmark/MGBenchmark.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Mattes Groeger 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #import "MGBenchmark.h" 24 | #import "MGBenchmarkTarget.h" 25 | #import "MGBenchmarkSession.h" 26 | #import "MGConsoleOutput.h" 27 | 28 | 29 | static NSMutableDictionary *sessions; 30 | static id defaultTarget; 31 | static dispatch_queue_t benchmarkQueue; 32 | 33 | @implementation MGBenchmark 34 | 35 | + (void)initialize 36 | { 37 | sessions = [NSMutableDictionary dictionary]; 38 | defaultTarget = [[MGConsoleOutput alloc] init]; 39 | benchmarkQueue = dispatch_queue_create("de.mattesgroeger.benchmark", DISPATCH_QUEUE_SERIAL); 40 | } 41 | 42 | + (void)setDefaultTarget:(id )target 43 | { 44 | dispatch_sync(benchmarkQueue, ^ 45 | { 46 | defaultTarget = target; 47 | }); 48 | } 49 | 50 | + (MGBenchmarkSession *)start:(NSString *)sessionName 51 | { 52 | __block MGBenchmarkSession *session = [[MGBenchmarkSession alloc] initWithName:sessionName andTarget:defaultTarget]; 53 | 54 | dispatch_sync(benchmarkQueue, ^ 55 | { 56 | sessions[sessionName] = session; 57 | }); 58 | 59 | return session; 60 | } 61 | 62 | + (MGBenchmarkSession *)session:(NSString *)sessionName 63 | { 64 | __block MGBenchmarkSession *session = nil; 65 | 66 | dispatch_sync(benchmarkQueue, ^ 67 | { 68 | session = sessions[sessionName]; 69 | }); 70 | 71 | return session; 72 | } 73 | 74 | + (void)finish:(NSString *)sessionName 75 | { 76 | dispatch_sync(benchmarkQueue, ^ 77 | { 78 | [sessions removeObjectForKey:sessionName]; 79 | }); 80 | } 81 | 82 | @end -------------------------------------------------------------------------------- /JsonReciprocityTests/SimpleTypeTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // SimpleTypeTest.m 3 | // JVReciprocity 4 | // 5 | // Created by liu on 15-5-7. 6 | // Copyright (c) 2015年 liu. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "SimpleTypeTestModel.h" 11 | #import "NSObject+JsonReciprocity.h" 12 | #import "JsonReciprocity.h" 13 | #import "TestObject.h" 14 | 15 | @interface SimpleTypeTests : XCTestCase 16 | 17 | @end 18 | 19 | @implementation SimpleTypeTests 20 | 21 | 22 | - (void)testProperty { 23 | // Class cls = TestObject.superclass;; 24 | // while (cls) { 25 | // cls = cls.superclass; 26 | // NSLog(@"%@", cls); 27 | // } 28 | 29 | // TestObject *object = [[TestObject alloc] init]; 30 | NSLog(@"%@", [TestObject propertys]); 31 | NSLog(@"%@", [TestObject propertysWithTypes]); 32 | } 33 | 34 | - (void)testObject { 35 | NSString *jsonString = @"{\ 36 | \"date1\" : \"2015/07/11\",\ 37 | \"date2\" : \"2015.05.29\",\ 38 | \"content_detail\" : \"this is a detail\",\ 39 | \"test\" : \"Hello world\"\ 40 | }"; 41 | TestObject *object = [TestObject objectFromJsonDict:[jsonString toJsonDictionary]]; 42 | NSLog(@"jsonString: %@", jsonString); 43 | NSLog(@"jsonObject: %@", object); 44 | } 45 | 46 | - (void)testSimpleType { 47 | NSString *path = [[NSBundle mainBundle] pathForResource:@"simple_type" ofType:@"json"]; 48 | NSString *json = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; 49 | XCTAssertNotNil(json); 50 | 51 | 52 | NSDictionary *jsonDict = [json toJsonDictionary]; 53 | SimpleTypeTestModel *model = [SimpleTypeTestModel objectFromJsonDict:jsonDict]; 54 | 55 | XCTAssertEqual(model.shortNumber, 121); 56 | XCTAssertEqual(model.intNumber,12); 57 | XCTAssertEqual(model.longNumber, 12124); 58 | XCTAssertEqual(model.integerNumber, 12124); 59 | XCTAssertEqual([model.numberInt integerValue], 12124); 60 | 61 | XCTAssertEqual(model.floatNumber, 12.12f); 62 | XCTAssertEqual(model.doubleNumber, 121231312.124); 63 | XCTAssertEqual(model.cgfloatNumber, 121231312.124); 64 | XCTAssertEqual([model.numberFloat doubleValue], 121231312.124); 65 | 66 | XCTAssertEqual(model.boolYES, true); 67 | XCTAssertEqual(model.boolNum, true); 68 | XCTAssertEqual([model.numberBool boolValue], false); 69 | 70 | XCTAssertEqual(model.timestamp, 1430647083); 71 | 72 | XCTAssertEqualObjects(model.date, [NSDate dateWithTimeIntervalSince1970:1430647083]); 73 | 74 | XCTAssertEqualObjects(model.string, @"this is string."); 75 | XCTAssertEqualObjects(model.url.absoluteString, @"http://www.baidu.com"); 76 | } 77 | 78 | @end 79 | -------------------------------------------------------------------------------- /Pods/MGBenchmark/MGBenchmark/MGBenchmarkSession.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Mattes Groeger 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #import "MGBenchmarkSession.h" 24 | #import "MGBenchmarkTarget.h" 25 | 26 | @implementation MGBenchmarkSession 27 | 28 | - (id)init 29 | { 30 | return [self initWithName:nil andTarget:nil]; 31 | } 32 | 33 | - (id)initWithName:(NSString *)name andTarget:(id )target 34 | { 35 | self = [super init]; 36 | 37 | if (self) 38 | { 39 | _lastInterim = _startTime = [NSDate date]; 40 | _name = name; 41 | _target = target; 42 | } 43 | 44 | return self; 45 | } 46 | 47 | - (NSTimeInterval)averageTime 48 | { 49 | if (_stepCount == 0) 50 | return 0; 51 | 52 | return [_lastInterim timeIntervalSinceDate:_startTime] / _stepCount; 53 | } 54 | 55 | - (NSTimeInterval)step:(NSString *)step 56 | { 57 | NSTimeInterval timePassed = [self timePassedSince:_lastInterim]; 58 | _lastInterim = [NSDate date]; 59 | _stepCount++; 60 | 61 | if (_target && [_target respondsToSelector:@selector(passedTime:forStep:inSession:)]) 62 | [_target passedTime:timePassed forStep:step inSession:self]; 63 | 64 | return timePassed; 65 | } 66 | 67 | - (NSTimeInterval)total 68 | { 69 | NSTimeInterval timePassed = [self timePassedSince:_startTime]; 70 | 71 | if (_target && [_target respondsToSelector:@selector(totalTime:inSession:)]) 72 | [_target totalTime:timePassed inSession:self]; 73 | 74 | return timePassed; 75 | } 76 | 77 | - (NSTimeInterval)timePassedSince:(NSDate *)date 78 | { 79 | return [[NSDate date] timeIntervalSinceDate:date]; 80 | } 81 | 82 | @end 83 | -------------------------------------------------------------------------------- /Pods/MGBenchmark/MGBenchmark/Output/MGConsoleOutput.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Mattes Groeger 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #import "MGConsoleOutput.h" 24 | #import "MGBenchmarkSession.h" 25 | #import "MGConsoleUtil.h" 26 | 27 | @implementation MGConsoleOutput 28 | 29 | - (id)init 30 | { 31 | self = [super init]; 32 | 33 | if (self) 34 | { 35 | _stepFormat = @"<< BENCHMARK [${sessionName}/${stepName}] ${passedTime} (step ${stepCount}) >>"; 36 | _totalFormat = @"<< BENCHMARK [${sessionName}/total] ${passedTime} (${stepCount} steps, average ${averageTime}) >>"; 37 | _timeFormat = @"%.5fs"; 38 | _timeMultiplier = 1; 39 | } 40 | 41 | return self; 42 | } 43 | 44 | - (void)passedTime:(NSTimeInterval)passedTime forStep:(NSString *)stepName inSession:(MGBenchmarkSession*)session 45 | { 46 | [MGConsoleUtil logWithFormat:_stepFormat andReplacement:@{ 47 | @"sessionName": session.name, 48 | @"stepName": stepName, 49 | @"passedTime": [MGConsoleUtil formatTime:passedTime format:_timeFormat multiplier:_timeMultiplier], 50 | @"stepCount": @(session.stepCount) 51 | }]; 52 | } 53 | 54 | - (void)totalTime:(NSTimeInterval)passedTime inSession:(MGBenchmarkSession*)session 55 | { 56 | [MGConsoleUtil logWithFormat:_totalFormat andReplacement:@{ 57 | @"sessionName": session.name, 58 | @"passedTime": [MGConsoleUtil formatTime:passedTime format:_timeFormat multiplier:_timeMultiplier], 59 | @"stepCount": @(session.stepCount), 60 | @"averageTime": [MGConsoleUtil formatTime:session.averageTime format:_timeFormat multiplier:_timeMultiplier] 61 | }]; 62 | } 63 | 64 | @end -------------------------------------------------------------------------------- /Pods/MGBenchmark/MGBenchmark/Output/MGConsoleOutput.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Mattes Groeger 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #import 24 | #import 25 | #import "MGBenchmarkTarget.h" 26 | 27 | @class MGBenchmarkSession; 28 | 29 | @interface MGConsoleOutput : NSObject 30 | { 31 | } 32 | 33 | /** 34 | * You can define a custom output string for each step by using the following 35 | * placeholders: 36 | * 37 | * ${sessionName} 38 | * ${stepName} 39 | * ${passedTime} 40 | * ${stepCount} 41 | * 42 | * Example: 43 | * consoleOutput.stepFormat = @"<< BENCHMARK [${sessionName}/${stepName}] ${passedTime} (step ${stepCount}) >>"; 44 | */ 45 | @property (strong) NSString *stepFormat; 46 | 47 | /** 48 | * You can define a custom output string for the total time by using the 49 | * following placeholders: 50 | * 51 | * ${sessionName} 52 | * ${passedTime} 53 | * ${stepCount} 54 | * ${averageTime} 55 | * 56 | * Example: 57 | * consoleOutput.totalFormat = @"<< BENCHMARK [${sessionName}/total] ${passedTime} (${stepCount} steps, average ${averageTime}) >>"; 58 | */ 59 | @property (nonatomic, strong) NSString *totalFormat; 60 | 61 | /** 62 | * You can define a custom time format using the `stringWithFormat` notation 63 | * for float values. By default it will use @"%.5fs", resulting in "1.34245s" 64 | * for example. 65 | */ 66 | @property (nonatomic, strong) NSString *timeFormat; 67 | 68 | /** 69 | * In case you want to output the time in MS or Minutes rather then seconds, 70 | * use the multiplier (e.g. 1000 for MS). 71 | */ 72 | @property (nonatomic) CGFloat timeMultiplier; 73 | 74 | @end -------------------------------------------------------------------------------- /Pods/Mantle/Mantle/MTLTransformerErrorHandling.h: -------------------------------------------------------------------------------- 1 | // 2 | // MTLTransformerErrorHandling.h 3 | // Mantle 4 | // 5 | // Created by Robert Böhnke on 10/6/13. 6 | // Copyright (c) 2013 GitHub. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /// The domain for errors originating from the MTLTransformerErrorHandling 12 | /// protocol. 13 | /// 14 | /// Transformers conforming to this protocol are expected to use this error 15 | /// domain if the transformation fails. 16 | extern NSString * const MTLTransformerErrorHandlingErrorDomain; 17 | 18 | /// Used to indicate that the input value was illegal. 19 | /// 20 | /// Transformers conforming to this protocol are expected to use this error code 21 | /// if the transformation fails due to an invalid input value. 22 | extern const NSInteger MTLTransformerErrorHandlingErrorInvalidInput; 23 | 24 | /// Associated with the invalid input value. 25 | /// 26 | /// Transformers conforming to this protocol are expected to associate this key 27 | /// with the invalid input in the userInfo dictionary. 28 | extern NSString * const MTLTransformerErrorHandlingInputValueErrorKey; 29 | 30 | /// This protocol can be implemented by NSValueTransformer subclasses to 31 | /// communicate errors that occur during transformation. 32 | @protocol MTLTransformerErrorHandling 33 | @required 34 | 35 | /// Transforms a value, returning any error that occurred during transformation. 36 | /// 37 | /// value - The value to transform. 38 | /// success - If not NULL, this will be set to a boolean indicating whether the 39 | /// transformation was successful. 40 | /// error - If not NULL, this may be set to an error that occurs during 41 | /// transforming the value. 42 | /// 43 | /// Returns the result of the transformation which may be nil. Clients should 44 | /// inspect the success parameter to decide how to proceed with the result. 45 | - (id)transformedValue:(id)value success:(BOOL *)success error:(NSError **)error; 46 | 47 | @optional 48 | 49 | /// Reverse-transforms a value, returning any error that occurred during 50 | /// transformation. 51 | /// 52 | /// Transformers conforming to this protocol are expected to implemented this 53 | /// method if they support reverse transformation. 54 | /// 55 | /// value - The value to transform. 56 | /// success - If not NULL, this will be set to a boolean indicating whether the 57 | /// transformation was successful. 58 | /// error - If not NULL, this may be set to an error that occurs during 59 | /// transforming the value. 60 | /// 61 | /// Returns the result of the reverse transformation which may be nil. Clients 62 | /// should inspect the success parameter to decide how to proceed with the 63 | /// result. 64 | - (id)reverseTransformedValue:(id)value success:(BOOL *)success error:(NSError **)error; 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /Pods/JSONModel/JSONModel/JSONModel/JSONModelClassProperty.m: -------------------------------------------------------------------------------- 1 | // 2 | // JSONModelClassProperty.m 3 | // 4 | // @version 1.0.2 5 | // @author Marin Todorov, http://www.touch-code-magazine.com 6 | // 7 | 8 | // Copyright (c) 2012-2014 Marin Todorov, Underplot ltd. 9 | // This code is distributed under the terms and conditions of the MIT license. 10 | // 11 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 14 | // 15 | // The MIT License in plain English: http://www.touch-code-magazine.com/JSONModel/MITLicense 16 | 17 | #import "JSONModelClassProperty.h" 18 | 19 | @implementation JSONModelClassProperty 20 | 21 | -(NSString*)description 22 | { 23 | //build the properties string for the current class property 24 | NSMutableArray* properties = [NSMutableArray arrayWithCapacity:8]; 25 | 26 | if (self.isIndex) [properties addObject:@"Index"]; 27 | if (self.isOptional) [properties addObject:@"Optional"]; 28 | if (self.isMutable) [properties addObject:@"Mutable"]; 29 | if (self.convertsOnDemand) [properties addObject:@"ConvertOnDemand"]; 30 | if (self.isStandardJSONType) [properties addObject:@"Standard JSON type"]; 31 | if (self.customSetter) [properties addObject:[NSString stringWithFormat: @"Setter = %@", NSStringFromSelector(self.customSetter)]]; 32 | if (self.customGetter) [properties addObject:[NSString stringWithFormat: @"Getter = %@", NSStringFromSelector(self.customGetter)]]; 33 | 34 | NSString* propertiesString = @""; 35 | if (properties.count>0) { 36 | propertiesString = [NSString stringWithFormat:@"(%@)", [properties componentsJoinedByString:@", "]]; 37 | } 38 | 39 | //return the name, type and additional properties 40 | return [NSString stringWithFormat:@"@property %@%@ %@ %@", 41 | self.type?[NSString stringWithFormat:@"%@*",self.type]:(self.structName?self.structName:@"primitive"), 42 | self.protocol?[NSString stringWithFormat:@"<%@>", self.protocol]:@"", 43 | self.name, 44 | propertiesString 45 | ]; 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /JsonReciprocityTests/ObjectSerializationTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // ObjectSerialization.m 3 | // JVReciprocity 4 | // 5 | // Created by liu on 15-5-8. 6 | // Copyright (c) 2015年 liu. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "JsonReciprocity.h" 12 | #import "PersonModel.h" 13 | #import 14 | #import 15 | #import "PersonJsonModel.h" 16 | #import "NSObject+JsonReciprocity.h" 17 | #import "PersonMTLModel.h" 18 | #import 19 | #import 20 | #import 21 | 22 | @interface ObjectSerializationTests : XCTestCase 23 | 24 | @end 25 | 26 | @implementation ObjectSerializationTests 27 | 28 | - (void)testPerformanceExample { 29 | NSString *path = [[NSBundle mainBundle] pathForResource:@"multi_complex" ofType:@"json"]; 30 | NSString *json = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; 31 | XCTAssertNotNil(json); 32 | 33 | NSDictionary *jsonDict = [json toJsonDictionary]; 34 | 35 | MGBenchmarkSession *session = [MGBenchmark start:@"demo"]; 36 | 37 | NSInteger testTimes = 50; 38 | 39 | //JSONModel 40 | for (int i = 0; i < testTimes; i++) { 41 | NSArray *personJsonModels = [PersonJsonModel arrayOfModelsFromDictionaries:jsonDict[@"data"]]; 42 | } 43 | 44 | [session step:@"JsonModel"]; 45 | 46 | //Mantel 47 | for (int i = 0; i < testTimes; i++) { 48 | NSArray *personMTLModels = [MTLJSONAdapter modelsOfClass:[PersonMTLModel class] fromJSONArray:jsonDict[@"data"] error:nil]; 49 | // PersonMTLModel *person = personMTLModels[0]; 50 | // NSLog(@"person.house.address %@", person.house.address); 51 | // CarMTLModel *car = person.cars[0]; 52 | // NSLog(@"car %@", car.brand); 53 | } 54 | [session step:@"Mantel"]; 55 | 56 | //MJExtension 57 | [PersonModel setupObjectClassInArray:^NSDictionary *{ 58 | return @{ 59 | @"cars" : @"CarModel", 60 | }; 61 | }]; 62 | 63 | [PersonModel setupReplacedKeyFromPropertyName:^NSDictionary *{ 64 | return @{ 65 | @"id": @"id", 66 | @"name": @"name", 67 | @"score": @"score", 68 | @"registerDate": @"register_date", 69 | @"lastLoginTime": @"last_login_time", 70 | @"cars": @"cars", 71 | @"house": @"house", 72 | }; 73 | }]; 74 | 75 | // [session step:@"MJ"]; 76 | 77 | for (int i = 0; i < testTimes; i++) { 78 | NSArray *personModels = [PersonModel objectArrayWithKeyValuesArray:jsonDict[@"data"]]; 79 | } 80 | 81 | [session step:@"MJExtension"]; 82 | 83 | for (int i = 0; i < testTimes; i++) { 84 | NSArray *personModels = [PersonModel objectArrayFromJsonArray:jsonDict[@"data"]]; 85 | } 86 | 87 | [session step:@"JsonReciprocity"]; 88 | 89 | [session total]; 90 | [MGBenchmark finish:@"demo"]; 91 | 92 | } 93 | 94 | @end 95 | -------------------------------------------------------------------------------- /JsonReciprocityTests/ExchangeEachTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // JVReciprocityTests.m 3 | // JVReciprocityTests 4 | // 5 | // Created by liu on 15-3-5. 6 | // Copyright (c) 2015年 liu. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "NSObject+JsonReciprocity.h" 12 | #import "JsonSerialization.h" 13 | #import "PersonModel.h" 14 | 15 | @interface ExchangeEachTests : XCTestCase 16 | 17 | @end 18 | 19 | @implementation ExchangeEachTests 20 | 21 | - (void)setUp { 22 | [super setUp]; 23 | // Put setup code here. This method is called before the invocation of each test method in the class. 24 | } 25 | 26 | - (void)tearDown { 27 | // Put teardown code here. This method is called after the invocation of each test method in the class. 28 | [super tearDown]; 29 | } 30 | 31 | 32 | - (void)testExchange { 33 | PersonModel *jack = [PersonModel new]; 34 | jack.id = 1420194; 35 | jack.name = @"jack"; 36 | jack.score = 88.33; 37 | jack.registerDate = [NSDate dateWithTimeIntervalSince1970:1421647083]; 38 | jack.lastLoginTime = 1430947083; 39 | 40 | PersonModel *tom = [PersonModel new]; 41 | tom.id = 1420781; 42 | tom.name = @"Tom"; 43 | tom.score = 67.24; 44 | tom.registerDate = [NSDate dateWithTimeIntervalSince1970:1421632461]; 45 | tom.lastLoginTime = 1430945653; 46 | 47 | PersonModel *sam = [PersonModel new]; 48 | sam.id = 1419853; 49 | sam.name = @"Sam"; 50 | sam.score = 92.43; 51 | sam.registerDate = [NSDate dateWithTimeIntervalSince1970:1421659382]; 52 | sam.lastLoginTime = 1430974902; 53 | 54 | NSArray *srcPersons = @[jack, tom, sam]; 55 | // NSString *jsonString = [srcPersons toJsonString]; 56 | // NSLog(@"%@", jsonString); 57 | 58 | NSArray *jsonArray = @[]; 59 | for (PersonModel *person in srcPersons) { 60 | NSDictionary *personDict = [person toJsonDictionary]; 61 | XCTAssertEqual(personDict[@"id"], @(person.id)); 62 | XCTAssertEqual(personDict[@"name"], person.name); 63 | // NSLog(@"score %@, score %@", personDict[@"score"], @(person.score)); 64 | XCTAssertEqual([personDict[@"score"] doubleValue], person.score); 65 | XCTAssertEqual([personDict[@"registerDate"] doubleValue], person.registerDate.timeIntervalSince1970); 66 | jsonArray = [jsonArray arrayByAddingObject:personDict]; 67 | } 68 | 69 | NSLog(@"jsonString %@", [jsonArray toJsonString]); 70 | 71 | NSArray *desPersons = [PersonModel objectArrayFromJsonArray:jsonArray]; 72 | XCTAssertEqual(desPersons.count, 3); 73 | for (int i = 0; i < desPersons.count; i++) { 74 | PersonModel *srcPerson = srcPersons[i]; 75 | PersonModel *desPerson = desPersons[i]; 76 | XCTAssertEqual(srcPerson.id, desPerson.id); 77 | XCTAssertEqual(srcPerson.name, desPerson.name); 78 | XCTAssertEqual(srcPerson.score, desPerson.score); 79 | XCTAssertEqual(srcPerson.registerDate, desPerson.registerDate); 80 | XCTAssertEqual(srcPerson.lastLoginTime, desPerson.lastLoginTime); 81 | } 82 | 83 | } 84 | 85 | @end -------------------------------------------------------------------------------- /Pods/JSONModel/JSONModel/JSONModel/JSONModelArray.h: -------------------------------------------------------------------------------- 1 | // 2 | // JSONModelArray.h 3 | // 4 | // @version 0.8.0 5 | // @author Marin Todorov, http://www.touch-code-magazine.com 6 | // 7 | 8 | // Copyright (c) 2012-2014 Marin Todorov, Underplot ltd. 9 | // This code is distributed under the terms and conditions of the MIT license. 10 | // 11 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 14 | // 15 | // The MIT License in plain English: http://www.touch-code-magazine.com/JSONModel/MITLicense 16 | 17 | #import 18 | 19 | /** 20 | * **Don't make instances of JSONModelArray yourself, except you know what you are doing.** 21 | * 22 | * You get automatically JSONModelArray instances, when you declare a convert on demand property, like so: 23 | * 24 | * @property (strong, nonatomic) NSArray<JSONModel, ConvertOnDemand>* list; 25 | * 26 | * The class stores its contents as they come from JSON, and upon the first request 27 | * of each of the objects stored in the array, it'll be converted to the target model class. 28 | * Thus saving time upon the very first model creation. 29 | */ 30 | @interface JSONModelArray : NSObject 31 | 32 | /** 33 | * Don't make instances of JSONModelArray yourself, except you know what you are doing. 34 | * 35 | * @param array an array of NSDictionary objects 36 | * @param cls the JSONModel sub-class you'd like the NSDictionaries to be converted to on demand 37 | */ 38 | - (id)initWithArray:(NSArray *)array modelClass:(Class)cls; 39 | 40 | - (id)objectAtIndex:(NSUInteger)index; 41 | - (id)objectAtIndexedSubscript:(NSUInteger)index; 42 | - (void)forwardInvocation:(NSInvocation *)anInvocation; 43 | - (NSUInteger)count; 44 | - (id)firstObject; 45 | - (id)lastObject; 46 | 47 | /** 48 | * Looks up the array's contents and tries to find a JSONModel object 49 | * with matching index property value to the indexValue param. 50 | * 51 | * Will return nil if no matching model is found. Will return nil if there's no index property 52 | * defined on the models found in the array (will sample the first object, assuming the array 53 | * contains homogenous collection of objects) 54 | * 55 | * @param indexValue the id value to search for 56 | * @return the found model or nil 57 | */ 58 | - (id)modelWithIndexValue:(id)indexValue; 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /Pods/MGBenchmark/MGBenchmark/Output/MGConsoleSummaryOutput.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Mattes Groeger 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #import "MGConsoleSummaryOutput.h" 24 | #import "MGBenchmarkSession.h" 25 | #import "MGConsoleUtil.h" 26 | 27 | 28 | @implementation MGBenchmarkStepData 29 | 30 | @end 31 | 32 | @implementation MGConsoleSummaryOutput 33 | 34 | - (id)init 35 | { 36 | self = [super init]; 37 | 38 | if (self) 39 | { 40 | _stepData = [NSMutableArray array]; 41 | _totalStepTime = 0; 42 | _logStepsInstantly = NO; 43 | _summaryFormat = @"<< BENCHMARK ${stepTime} (${stepPercent}%) ${stepName} >>"; 44 | } 45 | 46 | return self; 47 | } 48 | 49 | - (void)passedTime:(NSTimeInterval)passedTime forStep:(NSString *)stepName inSession:(MGBenchmarkSession *)session 50 | { 51 | if (_logStepsInstantly) 52 | [super passedTime:passedTime forStep:stepName inSession:session]; 53 | 54 | MGBenchmarkStepData *data = [[MGBenchmarkStepData alloc] init]; 55 | data.stepCount = session.stepCount; 56 | data.stepTime = passedTime; 57 | data.stepName = stepName; 58 | 59 | [_stepData addObject:data]; 60 | 61 | _totalStepTime += passedTime; 62 | } 63 | 64 | - (void)totalTime:(NSTimeInterval)passedTime inSession:(MGBenchmarkSession *)session 65 | { 66 | [super totalTime:passedTime inSession:session]; 67 | 68 | NSArray *sortedSteps = [_stepData sortedArrayUsingComparator:^NSComparisonResult(id a, id b) 69 | { 70 | NSTimeInterval first = [(MGBenchmarkStepData *) a stepTime]; 71 | NSTimeInterval second = [(MGBenchmarkStepData *) b stepTime]; 72 | return [@(second) compare:@(first)]; 73 | }]; 74 | 75 | for (MGBenchmarkStepData *data in sortedSteps) 76 | { 77 | [MGConsoleUtil logWithFormat:_summaryFormat andReplacement:@{ 78 | @"sessionName": session.name, 79 | @"stepTime": [MGConsoleUtil formatTime:data.stepTime format:self.timeFormat multiplier:self.timeMultiplier], 80 | @"stepPercent": [NSString stringWithFormat:@"%.1f", data.stepTime / _totalStepTime * 100], 81 | @"stepName": data.stepName, 82 | @"stepNumber": @(data.stepCount) 83 | }]; 84 | } 85 | } 86 | 87 | @end -------------------------------------------------------------------------------- /Pods/MJExtension/MJExtensionExample/MJExtensionExample/MJExtension/NSObject+MJProperty.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+MJProperty.h 3 | // MJExtensionExample 4 | // 5 | // Created by MJ Lee on 15/4/17. 6 | // Copyright (c) 2015年 小码哥. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class MJProperty; 12 | 13 | /** 14 | * 遍历所有类的block(父类) 15 | */ 16 | typedef void (^MJClassesBlock)(Class c, BOOL *stop); 17 | 18 | /** 19 | * 遍历成员变量用的block 20 | * 21 | * @param property 成员的包装对象 22 | * @param stop YES代表停止遍历,NO代表继续遍历 23 | */ 24 | typedef void (^MJPropertiesBlock)(MJProperty *property, BOOL *stop); 25 | 26 | /** 将属性名换为其他key去字典中取值 */ 27 | typedef NSDictionary * (^ReplacedKeyFromPropertyName)(); 28 | /** 数组中需要转换的模型类 */ 29 | typedef NSDictionary * (^ObjectClassInArray)(); 30 | 31 | 32 | /** 这个数组中的属性名才会进行字典和模型的转换 */ 33 | typedef NSArray * (^AllowedPropertyNames)(); 34 | /** 这个数组中的属性名才会进行归档 */ 35 | typedef NSArray * (^AllowedCodingPropertyNames)(); 36 | 37 | /** 这个数组中的属性名将会被忽略:不进行字典和模型的转换 */ 38 | typedef NSArray * (^IgnoredPropertyNames)(); 39 | /** 这个数组中的属性名将会被忽略:不进行归档 */ 40 | typedef NSArray * (^IgnoredCodingPropertyNames)(); 41 | 42 | @interface NSObject (MJProperty) 43 | 44 | /** 45 | * 遍历所有的成员 46 | */ 47 | + (void)enumeratePropertiesWithBlock:(MJPropertiesBlock)block; 48 | 49 | /** 50 | * 遍历所有的类 51 | */ 52 | + (void)enumerateClassesWithBlock:(MJClassesBlock)block; 53 | 54 | /** 55 | * 配置模型属性 56 | * 57 | * @param replacedKeyFromPropertyName 将属性名换为其他key去字典中取值 58 | * @param objectClassInArray 数组中需要转换的模型类 59 | */ 60 | + (void)setupReplacedKeyFromPropertyName:(ReplacedKeyFromPropertyName)replacedKeyFromPropertyName objectClassInArray:(ObjectClassInArray)objectClassInArray; 61 | 62 | /** 63 | * 配置模型属性 64 | * 65 | * @param replacedKeyFromPropertyName 将属性名换为其他key去字典中取值 66 | */ 67 | + (void)setupReplacedKeyFromPropertyName:(ReplacedKeyFromPropertyName)replacedKeyFromPropertyName; 68 | 69 | /** 70 | * 配置模型属性 71 | * 72 | * @param objectClassInArray 数组中需要转换的模型类 73 | */ 74 | + (void)setupObjectClassInArray:(ObjectClassInArray)objectClassInArray; 75 | 76 | /** 77 | * 配置模型属性 78 | * 79 | * @param allowedPropertyNames 这个数组中的属性名才会进行字典和模型的转换 80 | */ 81 | + (void)setupAllowedPropertyNames:(AllowedPropertyNames)allowedPropertyNames; 82 | 83 | /** 84 | * 这个数组中的属性名才会进行字典和模型的转换 85 | */ 86 | + (NSArray *)totalAllowedPropertyNames; 87 | 88 | /** 89 | * 配置模型属性 90 | * 91 | * @param allowedCodingPropertyNames 这个数组中的属性名才会进行归档 92 | */ 93 | + (void)setupAllowedCodingPropertyNames:(AllowedCodingPropertyNames)allowedCodingPropertyNames; 94 | 95 | /** 96 | * 这个数组中的属性名才会进行字典和模型的转换 97 | */ 98 | + (NSArray *)totalAllowedCodingPropertyNames; 99 | 100 | /** 101 | * 配置模型属性 102 | * 103 | * @param ignoredPropertyNames 这个数组中的属性名将会被忽略:不进行字典和模型的转换 104 | */ 105 | + (void)setupIgnoredPropertyNames:(IgnoredPropertyNames)ignoredPropertyNames; 106 | 107 | /** 108 | * 这个数组中的属性名将会被忽略:不进行字典和模型的转换 109 | */ 110 | + (NSArray *)totalIgnoredPropertyNames; 111 | 112 | /** 113 | * 配置模型属性 114 | * 115 | * @param ignoredCodingPropertyNames 这个数组中的属性名将会被忽略:不进行归档 116 | */ 117 | + (void)setupIgnoredCodingPropertyNames:(IgnoredCodingPropertyNames)ignoredCodingPropertyNames; 118 | 119 | /** 120 | * 这个数组中的属性名将会被忽略:不进行归档 121 | */ 122 | + (NSArray *)totalIgnoredCodingPropertyNames; 123 | @end -------------------------------------------------------------------------------- /Pods/MJExtension/MJExtensionExample/MJExtensionExample/MJExtension/MJProperty.m: -------------------------------------------------------------------------------- 1 | // 2 | // MJProperty.m 3 | // MJExtensionExample 4 | // 5 | // Created by MJ Lee on 15/4/17. 6 | // Copyright (c) 2015年 小码哥. All rights reserved. 7 | // 8 | 9 | #import "MJProperty.h" 10 | #import "MJType.h" 11 | #import "MJFoundation.h" 12 | #import "MJConst.h" 13 | 14 | @interface MJProperty() 15 | @property (strong, nonatomic) NSMutableDictionary *keyDict; 16 | @property (strong, nonatomic) NSMutableDictionary *keysDict; 17 | @property (strong, nonatomic) NSMutableDictionary *objectClassInArrayDict; 18 | @end 19 | 20 | @implementation MJProperty 21 | 22 | - (NSMutableDictionary *)keyDict 23 | { 24 | if (!_keyDict) { 25 | self.keyDict = [NSMutableDictionary dictionary]; 26 | } 27 | return _keyDict; 28 | } 29 | 30 | - (NSMutableDictionary *)keysDict 31 | { 32 | if (!_keysDict) { 33 | self.keysDict = [NSMutableDictionary dictionary]; 34 | } 35 | return _keysDict; 36 | } 37 | 38 | - (NSMutableDictionary *)objectClassInArrayDict 39 | { 40 | if (!_objectClassInArrayDict) { 41 | self.objectClassInArrayDict = [NSMutableDictionary dictionary]; 42 | } 43 | return _objectClassInArrayDict; 44 | } 45 | 46 | + (instancetype)cachedPropertyWithProperty:(objc_property_t)property 47 | { 48 | MJProperty *propertyObj = objc_getAssociatedObject(self, property); 49 | if (propertyObj == nil) { 50 | propertyObj = [[self alloc] init]; 51 | propertyObj.property = property; 52 | objc_setAssociatedObject(self, property, propertyObj, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 53 | } 54 | return propertyObj; 55 | } 56 | 57 | - (void)setProperty:(objc_property_t)property 58 | { 59 | _property = property; 60 | 61 | MJAssertParamNotNil(property); 62 | 63 | // 1.属性名 64 | _name = @(property_getName(property)); 65 | 66 | // 2.成员类型 67 | NSString *attrs = @(property_getAttributes(property)); 68 | NSUInteger loc = 1; 69 | NSUInteger len = [attrs rangeOfString:@","].location - loc; 70 | _type = [MJType cachedTypeWithCode:[attrs substringWithRange:NSMakeRange(loc, len)]]; 71 | } 72 | 73 | /** 74 | * 获得成员变量的值 75 | */ 76 | - (id)valueFromObject:(id)object 77 | { 78 | if (_type.KVCDisabled) return [NSNull null]; 79 | return [object valueForKey:_name]; 80 | } 81 | 82 | /** 83 | * 设置成员变量的值 84 | */ 85 | - (void)setValue:(id)value forObject:(id)object 86 | { 87 | if (_type.KVCDisabled || value == nil) return; 88 | [object setValue:value forKey:_name]; 89 | } 90 | 91 | /** 对应着字典中的key */ 92 | - (void)setKey:(NSString *)key forClass:(Class)c 93 | { 94 | if (!key) return; 95 | self.keyDict[NSStringFromClass(c)] = key; 96 | // 如果有多级映射 97 | [self setKeys:[key componentsSeparatedByString:@"."] forClass:c]; 98 | } 99 | - (NSString *)keyFromClass:(Class)c 100 | { 101 | return self.keyDict[NSStringFromClass(c)]; 102 | } 103 | 104 | /** 对应着字典中的多级key */ 105 | - (void)setKeys:(NSArray *)keys forClass:(Class)c 106 | { 107 | if (!keys) return; 108 | self.keysDict[NSStringFromClass(c)] = keys; 109 | } 110 | - (NSArray *)keysFromClass:(Class)c 111 | { 112 | return self.keysDict[NSStringFromClass(c)]; 113 | } 114 | 115 | /** 模型数组中的模型类型 */ 116 | - (void)setObjectClassInArray:(Class)objectClass forClass:(Class)c 117 | { 118 | if (!objectClass) return; 119 | self.objectClassInArrayDict[NSStringFromClass(c)] = objectClass; 120 | } 121 | - (Class)objectClassInArrayFromClass:(Class)c 122 | { 123 | return self.objectClassInArrayDict[NSStringFromClass(c)]; 124 | } 125 | @end 126 | -------------------------------------------------------------------------------- /Pods/Mantle/Mantle/extobjc/EXTRuntimeExtensions.h: -------------------------------------------------------------------------------- 1 | // 2 | // EXTRuntimeExtensions.h 3 | // extobjc 4 | // 5 | // Created by Justin Spahr-Summers on 2011-03-05. 6 | // Copyright (C) 2012 Justin Spahr-Summers. 7 | // Released under the MIT license. 8 | // 9 | 10 | #import 11 | 12 | /** 13 | * Describes the memory management policy of a property. 14 | */ 15 | typedef enum { 16 | /** 17 | * The value is assigned. 18 | */ 19 | mtl_propertyMemoryManagementPolicyAssign = 0, 20 | 21 | /** 22 | * The value is retained. 23 | */ 24 | mtl_propertyMemoryManagementPolicyRetain, 25 | 26 | /** 27 | * The value is copied. 28 | */ 29 | mtl_propertyMemoryManagementPolicyCopy 30 | } mtl_propertyMemoryManagementPolicy; 31 | 32 | /** 33 | * Describes the attributes and type information of a property. 34 | */ 35 | typedef struct { 36 | /** 37 | * Whether this property was declared with the \c readonly attribute. 38 | */ 39 | BOOL readonly; 40 | 41 | /** 42 | * Whether this property was declared with the \c nonatomic attribute. 43 | */ 44 | BOOL nonatomic; 45 | 46 | /** 47 | * Whether the property is a weak reference. 48 | */ 49 | BOOL weak; 50 | 51 | /** 52 | * Whether the property is eligible for garbage collection. 53 | */ 54 | BOOL canBeCollected; 55 | 56 | /** 57 | * Whether this property is defined with \c \@dynamic. 58 | */ 59 | BOOL dynamic; 60 | 61 | /** 62 | * The memory management policy for this property. This will always be 63 | * #mtl_propertyMemoryManagementPolicyAssign if #readonly is \c YES. 64 | */ 65 | mtl_propertyMemoryManagementPolicy memoryManagementPolicy; 66 | 67 | /** 68 | * The selector for the getter of this property. This will reflect any 69 | * custom \c getter= attribute provided in the property declaration, or the 70 | * inferred getter name otherwise. 71 | */ 72 | SEL getter; 73 | 74 | /** 75 | * The selector for the setter of this property. This will reflect any 76 | * custom \c setter= attribute provided in the property declaration, or the 77 | * inferred setter name otherwise. 78 | * 79 | * @note If #readonly is \c YES, this value will represent what the setter 80 | * \e would be, if the property were writable. 81 | */ 82 | SEL setter; 83 | 84 | /** 85 | * The backing instance variable for this property, or \c NULL if \c 86 | * \c @synthesize was not used, and therefore no instance variable exists. This 87 | * would also be the case if the property is implemented dynamically. 88 | */ 89 | const char *ivar; 90 | 91 | /** 92 | * If this property is defined as being an instance of a specific class, 93 | * this will be the class object representing it. 94 | * 95 | * This will be \c nil if the property was defined as type \c id, if the 96 | * property is not of an object type, or if the class could not be found at 97 | * runtime. 98 | */ 99 | Class objectClass; 100 | 101 | /** 102 | * The type encoding for the value of this property. This is the type as it 103 | * would be returned by the \c \@encode() directive. 104 | */ 105 | char type[]; 106 | } mtl_propertyAttributes; 107 | 108 | /** 109 | * Returns a pointer to a structure containing information about \a property. 110 | * You must \c free() the returned pointer. Returns \c NULL if there is an error 111 | * obtaining information from \a property. 112 | */ 113 | mtl_propertyAttributes *mtl_copyPropertyAttributes (objc_property_t property); 114 | -------------------------------------------------------------------------------- /Pods/JSONModel/JSONModel/JSONModel/JSONModelClassProperty.h: -------------------------------------------------------------------------------- 1 | // 2 | // JSONModelClassProperty.h 3 | // 4 | // @version 1.0.2 5 | // @author Marin Todorov, http://www.touch-code-magazine.com 6 | // 7 | 8 | // Copyright (c) 2012-2014 Marin Todorov, Underplot ltd. 9 | // This code is distributed under the terms and conditions of the MIT license. 10 | // 11 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 14 | // 15 | // The MIT License in plain English: http://www.touch-code-magazine.com/JSONModel/MITLicense 16 | 17 | #import 18 | 19 | enum kCustomizationTypes { 20 | kNotInspected = 0, 21 | kCustom, 22 | kNo 23 | }; 24 | 25 | typedef enum kCustomizationTypes PropertySetterType; 26 | typedef enum kCustomizationTypes PropertyGetterType; 27 | 28 | /** 29 | * **You do not need to instantiate this class yourself.** This class is used internally by JSONModel 30 | * to inspect the declared properties of your model class. 31 | * 32 | * Class to contain the information, representing a class property 33 | * It features the property's name, type, whether it's a required property, 34 | * and (optionally) the class protocol 35 | */ 36 | @interface JSONModelClassProperty : NSObject 37 | 38 | /** The name of the declared property (not the ivar name) */ 39 | @property (copy, nonatomic) NSString* name; 40 | 41 | /** A property class type */ 42 | @property (assign, nonatomic) Class type; 43 | 44 | /** Struct name if a struct */ 45 | @property (strong, nonatomic) NSString* structName; 46 | 47 | /** The name of the protocol the property conforms to (or nil) */ 48 | @property (copy, nonatomic) NSString* protocol; 49 | 50 | /** If YES, it can be missing in the input data, and the input would be still valid */ 51 | @property (assign, nonatomic) BOOL isOptional; 52 | 53 | /** If YES - don't call any transformers on this property's value */ 54 | @property (assign, nonatomic) BOOL isStandardJSONType; 55 | 56 | /** If YES - create a mutable object for the value of the property */ 57 | @property (assign, nonatomic) BOOL isMutable; 58 | 59 | /** If YES - create models on demand for the array members */ 60 | @property (assign, nonatomic) BOOL convertsOnDemand; 61 | 62 | /** If YES - the value of this property determines equality to other models */ 63 | @property (assign, nonatomic) BOOL isIndex; 64 | 65 | /** The status of property getter introspection in a model */ 66 | @property (assign, nonatomic) PropertyGetterType getterType; 67 | 68 | /** a custom getter for this property, found in the owning model */ 69 | @property (assign, nonatomic) SEL customGetter; 70 | 71 | /** The status of property setter introspection in a model */ 72 | @property (assign, nonatomic) PropertySetterType setterType; 73 | 74 | /** a custom setter for this property, found in the owning model */ 75 | @property (assign, nonatomic) SEL customSetter; 76 | 77 | @end 78 | -------------------------------------------------------------------------------- /JsonReciprocity/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Pods/Mantle/Mantle/extobjc/EXTScope.h: -------------------------------------------------------------------------------- 1 | // 2 | // EXTScope.h 3 | // extobjc 4 | // 5 | // Created by Justin Spahr-Summers on 2011-05-04. 6 | // Copyright (C) 2012 Justin Spahr-Summers. 7 | // Released under the MIT license. 8 | // 9 | 10 | #import "metamacros.h" 11 | 12 | /** 13 | * \@onExit defines some code to be executed when the current scope exits. The 14 | * code must be enclosed in braces and terminated with a semicolon, and will be 15 | * executed regardless of how the scope is exited, including from exceptions, 16 | * \c goto, \c return, \c break, and \c continue. 17 | * 18 | * Provided code will go into a block to be executed later. Keep this in mind as 19 | * it pertains to memory management, restrictions on assignment, etc. Because 20 | * the code is used within a block, \c return is a legal (though perhaps 21 | * confusing) way to exit the cleanup block early. 22 | * 23 | * Multiple \@onExit statements in the same scope are executed in reverse 24 | * lexical order. This helps when pairing resource acquisition with \@onExit 25 | * statements, as it guarantees teardown in the opposite order of acquisition. 26 | * 27 | * @note This statement cannot be used within scopes defined without braces 28 | * (like a one line \c if). In practice, this is not an issue, since \@onExit is 29 | * a useless construct in such a case anyways. 30 | */ 31 | #define onExit \ 32 | try {} @finally {} \ 33 | __strong mtl_cleanupBlock_t metamacro_concat(mtl_exitBlock_, __LINE__) __attribute__((cleanup(mtl_executeCleanupBlock), unused)) = ^ 34 | 35 | /** 36 | * Creates \c __weak shadow variables for each of the variables provided as 37 | * arguments, which can later be made strong again with #strongify. 38 | * 39 | * This is typically used to weakly reference variables in a block, but then 40 | * ensure that the variables stay alive during the actual execution of the block 41 | * (if they were live upon entry). 42 | * 43 | * See #strongify for an example of usage. 44 | */ 45 | #define weakify(...) \ 46 | try {} @finally {} \ 47 | metamacro_foreach_cxt(mtl_weakify_,, __weak, __VA_ARGS__) 48 | 49 | /** 50 | * Like #weakify, but uses \c __unsafe_unretained instead, for targets or 51 | * classes that do not support weak references. 52 | */ 53 | #define unsafeify(...) \ 54 | try {} @finally {} \ 55 | metamacro_foreach_cxt(mtl_weakify_,, __unsafe_unretained, __VA_ARGS__) 56 | 57 | /** 58 | * Strongly references each of the variables provided as arguments, which must 59 | * have previously been passed to #weakify. 60 | * 61 | * The strong references created will shadow the original variable names, such 62 | * that the original names can be used without issue (and a significantly 63 | * reduced risk of retain cycles) in the current scope. 64 | * 65 | * @code 66 | 67 | id foo = [[NSObject alloc] init]; 68 | id bar = [[NSObject alloc] init]; 69 | 70 | @weakify(foo, bar); 71 | 72 | // this block will not keep 'foo' or 'bar' alive 73 | BOOL (^matchesFooOrBar)(id) = ^ BOOL (id obj){ 74 | // but now, upon entry, 'foo' and 'bar' will stay alive until the block has 75 | // finished executing 76 | @strongify(foo, bar); 77 | 78 | return [foo isEqual:obj] || [bar isEqual:obj]; 79 | }; 80 | 81 | * @endcode 82 | */ 83 | #define strongify(...) \ 84 | try {} @finally {} \ 85 | _Pragma("clang diagnostic push") \ 86 | _Pragma("clang diagnostic ignored \"-Wshadow\"") \ 87 | metamacro_foreach(mtl_strongify_,, __VA_ARGS__) \ 88 | _Pragma("clang diagnostic pop") 89 | 90 | /*** implementation details follow ***/ 91 | typedef void (^mtl_cleanupBlock_t)(); 92 | 93 | void mtl_executeCleanupBlock (__strong mtl_cleanupBlock_t *block); 94 | 95 | #define mtl_weakify_(INDEX, CONTEXT, VAR) \ 96 | CONTEXT __typeof__(VAR) metamacro_concat(VAR, _weak_) = (VAR); 97 | 98 | #define mtl_strongify_(INDEX, VAR) \ 99 | __strong __typeof__(VAR) VAR = metamacro_concat(VAR, _weak_); 100 | -------------------------------------------------------------------------------- /Pods/Mantle/Mantle/NSValueTransformer+MTLPredefinedTransformerAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSValueTransformer+MTLPredefinedTransformerAdditions.h 3 | // Mantle 4 | // 5 | // Created by Justin Spahr-Summers on 2012-09-27. 6 | // Copyright (c) 2012 GitHub. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "MTLTransformerErrorHandling.h" 12 | 13 | /// The name for a value transformer that converts strings into URLs and back. 14 | extern NSString * const MTLURLValueTransformerName; 15 | 16 | /// Ensure an NSNumber is backed by __NSCFBoolean/CFBooleanRef 17 | /// 18 | /// NSJSONSerialization, and likely other serialization libraries, ordinarily 19 | /// serialize NSNumbers as numbers, and thus booleans would be serialized as 20 | /// 0/1. The exception is when the NSNumber is backed by __NSCFBoolean, which, 21 | /// though very much an implementation detail, is detected and serialized as a 22 | /// proper boolean. 23 | extern NSString * const MTLBooleanValueTransformerName; 24 | 25 | @interface NSValueTransformer (MTLPredefinedTransformerAdditions) 26 | 27 | /// An optionally reversible transformer which applies the given transformer to 28 | /// each element of an array. 29 | /// 30 | /// transformer - The transformer to apply to each element. If the transformer 31 | /// is reversible, the transformer returned by this method will be 32 | /// reversible. This argument must not be nil. 33 | /// 34 | /// Returns a transformer which applies a transformation to each element of an 35 | /// array. 36 | + (NSValueTransformer *)mtl_arrayMappingTransformerWithTransformer:(NSValueTransformer *)transformer; 37 | 38 | /// A reversible value transformer to transform between the keys and objects of a 39 | /// dictionary. 40 | /// 41 | /// dictionary - The dictionary whose keys and values should be 42 | /// transformed between. This argument must not be nil. 43 | /// defaultValue - The result to fall back to, in case no key matching the 44 | /// input value was found during a forward transformation. 45 | /// reverseDefaultValue - The result to fall back to, in case no value matching 46 | /// the input value was found during a reverse 47 | /// transformation. 48 | /// 49 | /// Can for example be used for transforming between enum values and their string 50 | /// representation. 51 | /// 52 | /// NSValueTransformer *valueTransformer = [NSValueTransformer mtl_valueMappingTransformerWithDictionary:@{ 53 | /// @"foo": @(EnumDataTypeFoo), 54 | /// @"bar": @(EnumDataTypeBar), 55 | /// } defaultValue: @(EnumDataTypeUndefined) reverseDefaultValue: @"undefined"]; 56 | /// 57 | /// Returns a transformer which will map from keys to objects for forward 58 | /// transformations, and from objects to keys for reverse transformations. 59 | + (NSValueTransformer *)mtl_valueMappingTransformerWithDictionary:(NSDictionary *)dictionary defaultValue:(id)defaultValue reverseDefaultValue:(id)reverseDefaultValue; 60 | 61 | /// Returns a value transformer created by calling 62 | /// `+mtl_valueMappingTransformerWithDictionary:defaultValue:reverseDefaultValue:` 63 | /// with a default value of `nil` and a reverse default value of `nil`. 64 | + (NSValueTransformer *)mtl_valueMappingTransformerWithDictionary:(NSDictionary *)dictionary; 65 | 66 | /// A value transformer that errors if the transformed value are not of the given 67 | /// class. 68 | /// 69 | /// class - The expected class. This argument must not be nil. 70 | /// 71 | /// Returns a transformer which will return an error if the transformed in value 72 | /// is not a member of class. Otherwise, the value is simply passed through. 73 | + (NSValueTransformer *)mtl_validatingTransformerForClass:(Class)modelClass; 74 | 75 | + (NSValueTransformer *)mtl_JSONDictionaryTransformerWithModelClass:(Class)modelClass __attribute__((deprecated("Replaced by +[MTLJSONAdapter dictionaryTransformerWithModelClass:]"))); 76 | 77 | + (NSValueTransformer *)mtl_JSONArrayTransformerWithModelClass:(Class)modelClass __attribute__((deprecated("Replaced by +[MTLJSONAdapter arrayTransformerWithModelClass:]"))); 78 | 79 | @end 80 | -------------------------------------------------------------------------------- /JsonReciprocityTests/ComplexStructureTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // ComplexStructure Test.m 3 | // JVReciprocity 4 | // 5 | // Created by liu on 15-5-7. 6 | // Copyright (c) 2015年 liu. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "NSObject+JsonReciprocity.h" 11 | #import "JsonReciprocity.h" 12 | #import "PersonModel.h" 13 | #import "HouseModel.h" 14 | #import "CarModel.h" 15 | 16 | @interface ComplexStructureTests : XCTestCase 17 | 18 | @end 19 | 20 | @implementation ComplexStructureTests 21 | 22 | - (void)testExchange { 23 | NSString *path = [[NSBundle mainBundle] pathForResource:@"complex" ofType:@"json"]; 24 | NSString *json = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; 25 | XCTAssertNotNil(json); 26 | 27 | NSDictionary *jsonDict = [json toJsonDictionary]; 28 | XCTAssertEqual([jsonDict[@"page"] integerValue], 1); 29 | XCTAssertEqual([jsonDict[@"total"] integerValue], 1); 30 | XCTAssertEqual([jsonDict[@"code"] integerValue], 200); 31 | XCTAssertEqualObjects(jsonDict[@"msg"], @"success"); 32 | 33 | NSArray *persons = [PersonModel objectArrayFromJsonArray:jsonDict[@"data"]]; 34 | XCTAssertEqual(persons.count, 3); 35 | 36 | PersonModel *jack = persons[0]; 37 | XCTAssertEqual(jack.id, 1420194); 38 | XCTAssertEqualObjects(jack.name, @"Jack"); 39 | XCTAssertEqual(jack.score, 88.33); 40 | XCTAssertEqualObjects(jack.registerDate, [NSDate dateWithTimeIntervalSince1970:1428647083]); 41 | XCTAssertEqual(jack.lastLoginTime, 1430642742); 42 | 43 | XCTAssertEqual(jack.cars.count, 2); 44 | CarModel *jackCar0 = jack.cars[0]; 45 | XCTAssertEqualObjects(jackCar0.brand, @"benz"); 46 | XCTAssertEqualObjects(jackCar0.num, @"A14212"); 47 | 48 | CarModel *jackCar1 = jack.cars[1]; 49 | XCTAssertEqualObjects(jackCar1.brand, @"audi"); 50 | XCTAssertEqualObjects(jackCar1.num, @"B83143"); 51 | 52 | XCTAssertEqualObjects(jack.house.address, @"China GuangZhou"); 53 | XCTAssertEqual(jack.house.area, 95.6); 54 | 55 | XCTAssertEqual(jack.house.tags.count, 2); 56 | XCTAssertEqualObjects(jack.house.tags[0], @"nice"); 57 | XCTAssertEqualObjects(jack.house.tags[1], @"comfort"); 58 | 59 | 60 | PersonModel *tom = persons[1]; 61 | XCTAssertEqual(tom.id, 1230794); 62 | XCTAssertEqualObjects(tom.name, @"Tom"); 63 | XCTAssertEqual(tom.score, 67.24); 64 | XCTAssertEqualObjects(tom.registerDate, [NSDate dateWithTimeIntervalSince1970:1421647083]); 65 | XCTAssertEqual(tom.lastLoginTime, 1430847083); 66 | 67 | XCTAssertEqual(tom.cars.count, 2); 68 | CarModel *tomCar0 = tom.cars[0]; 69 | XCTAssertEqualObjects(tomCar0.brand, @"toyota"); 70 | XCTAssertEqualObjects(tomCar0.num, @"C03914"); 71 | 72 | CarModel *tomCar1 = tom.cars[1]; 73 | XCTAssertEqualObjects(tomCar1.brand, @"honda"); 74 | XCTAssertEqualObjects(tomCar1.num, @"D35813"); 75 | 76 | XCTAssertEqualObjects(tom.house.address, @"China Hangzhou"); 77 | XCTAssertEqual(tom.house.area, 88.2); 78 | 79 | XCTAssertEqual(tom.house.tags.count, 2); 80 | XCTAssertEqualObjects(tom.house.tags[0], @"quiet"); 81 | XCTAssertEqualObjects(tom.house.tags[1], @"good"); 82 | 83 | 84 | PersonModel *sammi = persons[2]; 85 | XCTAssertEqual(sammi.id, 2914834); 86 | XCTAssertEqualObjects(sammi.name, @"Sammi"); 87 | XCTAssertEqual(sammi.score, 92.43); 88 | XCTAssertEqualObjects(sammi.registerDate, [NSDate dateWithTimeIntervalSince1970:1430647083]); 89 | XCTAssertEqual(sammi.lastLoginTime, 1430947083); 90 | 91 | XCTAssertEqual(sammi.cars.count, 2); 92 | CarModel *sammiCar0 = sammi.cars[0]; 93 | XCTAssertEqualObjects(sammiCar0.brand, @"porsche"); 94 | XCTAssertEqualObjects(sammiCar0.num, @"E59832"); 95 | 96 | CarModel *sammiCar1 = sammi.cars[1]; 97 | XCTAssertEqualObjects(sammiCar1.brand, @"BMW"); 98 | XCTAssertEqualObjects(sammiCar1.num, @"F93057"); 99 | 100 | XCTAssertEqualObjects(sammi.house.address, @"China Shenzhen"); 101 | XCTAssertEqual(sammi.house.area, 103.3); 102 | 103 | XCTAssertEqual(sammi.house.tags.count, 2); 104 | XCTAssertEqualObjects(sammi.house.tags[0], @"convenience"); 105 | XCTAssertEqualObjects(sammi.house.tags[1], @"luxury"); 106 | 107 | } 108 | 109 | @end 110 | -------------------------------------------------------------------------------- /Pods/JSONModel/JSONModel/JSONModelNetworking/JSONModel+networking.m: -------------------------------------------------------------------------------- 1 | // 2 | // JSONModel+networking.m 3 | // 4 | // @version 1.0.2 5 | // @author Marin Todorov, http://www.touch-code-magazine.com 6 | // 7 | 8 | // Copyright (c) 2012-2014 Marin Todorov, Underplot ltd. 9 | // This code is distributed under the terms and conditions of the MIT license. 10 | // 11 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 14 | // 15 | // The MIT License in plain English: http://www.touch-code-magazine.com/JSONModel/MITLicense 16 | 17 | #import "JSONModel+networking.h" 18 | #import "JSONHTTPClient.h" 19 | 20 | BOOL _isLoading; 21 | 22 | @implementation JSONModel(Networking) 23 | 24 | @dynamic isLoading; 25 | 26 | -(BOOL)isLoading 27 | { 28 | return _isLoading; 29 | } 30 | 31 | -(void)setIsLoading:(BOOL)isLoading 32 | { 33 | _isLoading = isLoading; 34 | } 35 | 36 | -(instancetype)initFromURLWithString:(NSString *)urlString completion:(JSONModelBlock)completeBlock 37 | { 38 | id placeholder = [super init]; 39 | __block id blockSelf = self; 40 | 41 | if (placeholder) { 42 | //initialization 43 | self.isLoading = YES; 44 | 45 | [JSONHTTPClient getJSONFromURLWithString:urlString 46 | completion:^(NSDictionary *json, JSONModelError* e) { 47 | 48 | JSONModelError* initError = nil; 49 | blockSelf = [self initWithDictionary:json error:&initError]; 50 | 51 | if (completeBlock) { 52 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_MSEC), dispatch_get_main_queue(), ^{ 53 | completeBlock(blockSelf, e?e:initError ); 54 | }); 55 | } 56 | 57 | self.isLoading = NO; 58 | 59 | }]; 60 | } 61 | return placeholder; 62 | } 63 | 64 | + (void)getModelFromURLWithString:(NSString*)urlString completion:(JSONModelBlock)completeBlock 65 | { 66 | [JSONHTTPClient getJSONFromURLWithString:urlString 67 | completion:^(NSDictionary* jsonDict, JSONModelError* err) 68 | { 69 | JSONModel* model = nil; 70 | 71 | if(err == nil) 72 | { 73 | model = [[self alloc] initWithDictionary:jsonDict error:&err]; 74 | } 75 | 76 | if(completeBlock != nil) 77 | { 78 | dispatch_async(dispatch_get_main_queue(), ^ 79 | { 80 | completeBlock(model, err); 81 | }); 82 | } 83 | }]; 84 | } 85 | 86 | + (void)postModel:(JSONModel*)post toURLWithString:(NSString*)urlString completion:(JSONModelBlock)completeBlock 87 | { 88 | [JSONHTTPClient postJSONFromURLWithString:urlString 89 | bodyString:[post toJSONString] 90 | completion:^(NSDictionary* jsonDict, JSONModelError* err) 91 | { 92 | JSONModel* model = nil; 93 | 94 | if(err == nil) 95 | { 96 | model = [[self alloc] initWithDictionary:jsonDict error:&err]; 97 | } 98 | 99 | if(completeBlock != nil) 100 | { 101 | dispatch_async(dispatch_get_main_queue(), ^ 102 | { 103 | completeBlock(model, err); 104 | }); 105 | } 106 | }]; 107 | } 108 | 109 | @end 110 | --------------------------------------------------------------------------------