├── .gitattributes ├── .gitignore ├── .travis.yml ├── Example ├── JSONNeverDieExample.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcuserdata │ │ │ ├── JohnLui.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ │ │ └── leqicheng.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ ├── JohnLui.xcuserdatad │ │ ├── xcdebugger │ │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ │ ├── JSONNeverDieExample.xcscheme │ │ │ └── xcschememanagement.plist │ │ └── leqicheng.xcuserdatad │ │ └── xcschemes │ │ ├── JSONNeverDieExample.xcscheme │ │ └── xcschememanagement.plist └── JSONNeverDieExample │ ├── AppDelegate.swift │ ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ ├── Model.json │ ├── Model.swift │ └── ViewController.swift ├── JSONNeverDie.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── xcuserdata │ │ ├── JohnLui.xcuserdatad │ │ └── UserInterfaceState.xcuserstate │ │ └── leqicheng.xcuserdatad │ │ └── UserInterfaceState.xcuserstate ├── xcshareddata │ └── xcschemes │ │ └── JSONNeverDie.xcscheme └── xcuserdata │ ├── JohnLui.xcuserdatad │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ │ ├── JSONNeverDieTests.xcscheme │ │ └── xcschememanagement.plist │ └── leqicheng.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── JSONNeverDie ├── Info.plist └── JSONNeverDie.h ├── JSONNeverDieTests ├── ArrayTests.swift ├── ArrayWithObjectsTests.swift ├── ArrayWithValuesTests.swift ├── BaseTests.swift ├── BoolTests.swift ├── DoubleTests.swift ├── Info.plist ├── IntTests.swift ├── JSONInitTests.swift ├── JSONNDModelTests.swift ├── JSONValueTests.swift ├── ParseJSONTests.swift ├── StringTests.swift ├── TestModel.swift └── test.json ├── LICENSE ├── README.md ├── Source ├── JSONND+ArrayLiteralConvertible.swift ├── JSONND+DictionaryLiteralConvertible.swift ├── JSONND.swift └── JSONNDModel.swift └── assets ├── logo.jpg └── types.png /.gitattributes: -------------------------------------------------------------------------------- 1 | *.h linguist-language=Swift 2 | *.m linguist-language=Swift 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | os: osx 2 | osx_image: xcode9 3 | language: objective-c 4 | script: xcodebuild test -project JSONNeverDie.xcodeproj -scheme JSONNeverDie -destination 'platform=iOS Simulator,name=iPhone 7,OS=latest' -------------------------------------------------------------------------------- /Example/JSONNeverDieExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | C86D3D341BBFD981007FBA24 /* Model.json in Resources */ = {isa = PBXBuildFile; fileRef = C86D3D331BBFD981007FBA24 /* Model.json */; }; 11 | C86D3D371BBFD993007FBA24 /* Model.swift in Sources */ = {isa = PBXBuildFile; fileRef = C86D3D361BBFD993007FBA24 /* Model.swift */; }; 12 | C89EB9DD1BB7EDB100207C75 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89EB9DC1BB7EDB100207C75 /* AppDelegate.swift */; }; 13 | C89EB9DF1BB7EDB100207C75 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89EB9DE1BB7EDB100207C75 /* ViewController.swift */; }; 14 | C89EB9E21BB7EDB100207C75 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C89EB9E01BB7EDB100207C75 /* Main.storyboard */; }; 15 | C89EB9E41BB7EDB100207C75 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C89EB9E31BB7EDB100207C75 /* Assets.xcassets */; }; 16 | C89EB9E71BB7EDB100207C75 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C89EB9E51BB7EDB100207C75 /* LaunchScreen.storyboard */; }; 17 | C8B70CDA1BB7EE2A00F83495 /* JSONNeverDie.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C89EB9F41BB7EE0F00207C75 /* JSONNeverDie.framework */; }; 18 | C8B70CDB1BB7EE2A00F83495 /* JSONNeverDie.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = C89EB9F41BB7EE0F00207C75 /* JSONNeverDie.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXContainerItemProxy section */ 22 | C89EB9F31BB7EE0F00207C75 /* PBXContainerItemProxy */ = { 23 | isa = PBXContainerItemProxy; 24 | containerPortal = C89EB9EE1BB7EE0F00207C75 /* JSONNeverDie.xcodeproj */; 25 | proxyType = 2; 26 | remoteGlobalIDString = C88A50991BB683890054E3A4; 27 | remoteInfo = JSONNeverDie; 28 | }; 29 | C89EB9F51BB7EE0F00207C75 /* PBXContainerItemProxy */ = { 30 | isa = PBXContainerItemProxy; 31 | containerPortal = C89EB9EE1BB7EE0F00207C75 /* JSONNeverDie.xcodeproj */; 32 | proxyType = 2; 33 | remoteGlobalIDString = C81DD4311BB7DB35007CE97E; 34 | remoteInfo = JSONNeverDieTests; 35 | }; 36 | C8B70CDC1BB7EE2A00F83495 /* PBXContainerItemProxy */ = { 37 | isa = PBXContainerItemProxy; 38 | containerPortal = C89EB9EE1BB7EE0F00207C75 /* JSONNeverDie.xcodeproj */; 39 | proxyType = 1; 40 | remoteGlobalIDString = C88A50981BB683890054E3A4; 41 | remoteInfo = JSONNeverDie; 42 | }; 43 | /* End PBXContainerItemProxy section */ 44 | 45 | /* Begin PBXCopyFilesBuildPhase section */ 46 | C8B70CDE1BB7EE2A00F83495 /* Embed Frameworks */ = { 47 | isa = PBXCopyFilesBuildPhase; 48 | buildActionMask = 2147483647; 49 | dstPath = ""; 50 | dstSubfolderSpec = 10; 51 | files = ( 52 | C8B70CDB1BB7EE2A00F83495 /* JSONNeverDie.framework in Embed Frameworks */, 53 | ); 54 | name = "Embed Frameworks"; 55 | runOnlyForDeploymentPostprocessing = 0; 56 | }; 57 | /* End PBXCopyFilesBuildPhase section */ 58 | 59 | /* Begin PBXFileReference section */ 60 | C86D3D331BBFD981007FBA24 /* Model.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = Model.json; sourceTree = ""; }; 61 | C86D3D361BBFD993007FBA24 /* Model.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Model.swift; sourceTree = ""; }; 62 | C89EB9D91BB7EDB100207C75 /* JSONNeverDieExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JSONNeverDieExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 63 | C89EB9DC1BB7EDB100207C75 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 64 | C89EB9DE1BB7EDB100207C75 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 65 | C89EB9E11BB7EDB100207C75 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 66 | C89EB9E31BB7EDB100207C75 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 67 | C89EB9E61BB7EDB100207C75 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 68 | C89EB9E81BB7EDB100207C75 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 69 | C89EB9EE1BB7EE0F00207C75 /* JSONNeverDie.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = JSONNeverDie.xcodeproj; path = ../JSONNeverDie.xcodeproj; sourceTree = ""; }; 70 | /* End PBXFileReference section */ 71 | 72 | /* Begin PBXFrameworksBuildPhase section */ 73 | C89EB9D61BB7EDB100207C75 /* Frameworks */ = { 74 | isa = PBXFrameworksBuildPhase; 75 | buildActionMask = 2147483647; 76 | files = ( 77 | C8B70CDA1BB7EE2A00F83495 /* JSONNeverDie.framework in Frameworks */, 78 | ); 79 | runOnlyForDeploymentPostprocessing = 0; 80 | }; 81 | /* End PBXFrameworksBuildPhase section */ 82 | 83 | /* Begin PBXGroup section */ 84 | C89EB9D01BB7EDB100207C75 = { 85 | isa = PBXGroup; 86 | children = ( 87 | C89EB9EE1BB7EE0F00207C75 /* JSONNeverDie.xcodeproj */, 88 | C89EB9DB1BB7EDB100207C75 /* JSONNeverDieExample */, 89 | C89EB9DA1BB7EDB100207C75 /* Products */, 90 | ); 91 | sourceTree = ""; 92 | }; 93 | C89EB9DA1BB7EDB100207C75 /* Products */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | C89EB9D91BB7EDB100207C75 /* JSONNeverDieExample.app */, 97 | ); 98 | name = Products; 99 | sourceTree = ""; 100 | }; 101 | C89EB9DB1BB7EDB100207C75 /* JSONNeverDieExample */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | C89EB9DC1BB7EDB100207C75 /* AppDelegate.swift */, 105 | C89EB9DE1BB7EDB100207C75 /* ViewController.swift */, 106 | C86D3D361BBFD993007FBA24 /* Model.swift */, 107 | C86D3D331BBFD981007FBA24 /* Model.json */, 108 | C89EB9E01BB7EDB100207C75 /* Main.storyboard */, 109 | C89EB9E31BB7EDB100207C75 /* Assets.xcassets */, 110 | C89EB9E51BB7EDB100207C75 /* LaunchScreen.storyboard */, 111 | C89EB9E81BB7EDB100207C75 /* Info.plist */, 112 | ); 113 | path = JSONNeverDieExample; 114 | sourceTree = ""; 115 | }; 116 | C89EB9EF1BB7EE0F00207C75 /* Products */ = { 117 | isa = PBXGroup; 118 | children = ( 119 | C89EB9F41BB7EE0F00207C75 /* JSONNeverDie.framework */, 120 | C89EB9F61BB7EE0F00207C75 /* JSONNeverDieTests.xctest */, 121 | ); 122 | name = Products; 123 | sourceTree = ""; 124 | }; 125 | /* End PBXGroup section */ 126 | 127 | /* Begin PBXNativeTarget section */ 128 | C89EB9D81BB7EDB100207C75 /* JSONNeverDieExample */ = { 129 | isa = PBXNativeTarget; 130 | buildConfigurationList = C89EB9EB1BB7EDB100207C75 /* Build configuration list for PBXNativeTarget "JSONNeverDieExample" */; 131 | buildPhases = ( 132 | C89EB9D51BB7EDB100207C75 /* Sources */, 133 | C89EB9D61BB7EDB100207C75 /* Frameworks */, 134 | C89EB9D71BB7EDB100207C75 /* Resources */, 135 | C8B70CDE1BB7EE2A00F83495 /* Embed Frameworks */, 136 | ); 137 | buildRules = ( 138 | ); 139 | dependencies = ( 140 | C8B70CDD1BB7EE2A00F83495 /* PBXTargetDependency */, 141 | ); 142 | name = JSONNeverDieExample; 143 | productName = JSONNeverDieExample; 144 | productReference = C89EB9D91BB7EDB100207C75 /* JSONNeverDieExample.app */; 145 | productType = "com.apple.product-type.application"; 146 | }; 147 | /* End PBXNativeTarget section */ 148 | 149 | /* Begin PBXProject section */ 150 | C89EB9D11BB7EDB100207C75 /* Project object */ = { 151 | isa = PBXProject; 152 | attributes = { 153 | LastUpgradeCheck = 0930; 154 | ORGANIZATIONNAME = JohnLui; 155 | TargetAttributes = { 156 | C89EB9D81BB7EDB100207C75 = { 157 | CreatedOnToolsVersion = 7.0; 158 | LastSwiftMigration = 0800; 159 | }; 160 | }; 161 | }; 162 | buildConfigurationList = C89EB9D41BB7EDB100207C75 /* Build configuration list for PBXProject "JSONNeverDieExample" */; 163 | compatibilityVersion = "Xcode 3.2"; 164 | developmentRegion = English; 165 | hasScannedForEncodings = 0; 166 | knownRegions = ( 167 | en, 168 | Base, 169 | ); 170 | mainGroup = C89EB9D01BB7EDB100207C75; 171 | productRefGroup = C89EB9DA1BB7EDB100207C75 /* Products */; 172 | projectDirPath = ""; 173 | projectReferences = ( 174 | { 175 | ProductGroup = C89EB9EF1BB7EE0F00207C75 /* Products */; 176 | ProjectRef = C89EB9EE1BB7EE0F00207C75 /* JSONNeverDie.xcodeproj */; 177 | }, 178 | ); 179 | projectRoot = ""; 180 | targets = ( 181 | C89EB9D81BB7EDB100207C75 /* JSONNeverDieExample */, 182 | ); 183 | }; 184 | /* End PBXProject section */ 185 | 186 | /* Begin PBXReferenceProxy section */ 187 | C89EB9F41BB7EE0F00207C75 /* JSONNeverDie.framework */ = { 188 | isa = PBXReferenceProxy; 189 | fileType = wrapper.framework; 190 | path = JSONNeverDie.framework; 191 | remoteRef = C89EB9F31BB7EE0F00207C75 /* PBXContainerItemProxy */; 192 | sourceTree = BUILT_PRODUCTS_DIR; 193 | }; 194 | C89EB9F61BB7EE0F00207C75 /* JSONNeverDieTests.xctest */ = { 195 | isa = PBXReferenceProxy; 196 | fileType = wrapper.cfbundle; 197 | path = JSONNeverDieTests.xctest; 198 | remoteRef = C89EB9F51BB7EE0F00207C75 /* PBXContainerItemProxy */; 199 | sourceTree = BUILT_PRODUCTS_DIR; 200 | }; 201 | /* End PBXReferenceProxy section */ 202 | 203 | /* Begin PBXResourcesBuildPhase section */ 204 | C89EB9D71BB7EDB100207C75 /* Resources */ = { 205 | isa = PBXResourcesBuildPhase; 206 | buildActionMask = 2147483647; 207 | files = ( 208 | C89EB9E71BB7EDB100207C75 /* LaunchScreen.storyboard in Resources */, 209 | C89EB9E41BB7EDB100207C75 /* Assets.xcassets in Resources */, 210 | C89EB9E21BB7EDB100207C75 /* Main.storyboard in Resources */, 211 | C86D3D341BBFD981007FBA24 /* Model.json in Resources */, 212 | ); 213 | runOnlyForDeploymentPostprocessing = 0; 214 | }; 215 | /* End PBXResourcesBuildPhase section */ 216 | 217 | /* Begin PBXSourcesBuildPhase section */ 218 | C89EB9D51BB7EDB100207C75 /* Sources */ = { 219 | isa = PBXSourcesBuildPhase; 220 | buildActionMask = 2147483647; 221 | files = ( 222 | C86D3D371BBFD993007FBA24 /* Model.swift in Sources */, 223 | C89EB9DF1BB7EDB100207C75 /* ViewController.swift in Sources */, 224 | C89EB9DD1BB7EDB100207C75 /* AppDelegate.swift in Sources */, 225 | ); 226 | runOnlyForDeploymentPostprocessing = 0; 227 | }; 228 | /* End PBXSourcesBuildPhase section */ 229 | 230 | /* Begin PBXTargetDependency section */ 231 | C8B70CDD1BB7EE2A00F83495 /* PBXTargetDependency */ = { 232 | isa = PBXTargetDependency; 233 | name = JSONNeverDie; 234 | targetProxy = C8B70CDC1BB7EE2A00F83495 /* PBXContainerItemProxy */; 235 | }; 236 | /* End PBXTargetDependency section */ 237 | 238 | /* Begin PBXVariantGroup section */ 239 | C89EB9E01BB7EDB100207C75 /* Main.storyboard */ = { 240 | isa = PBXVariantGroup; 241 | children = ( 242 | C89EB9E11BB7EDB100207C75 /* Base */, 243 | ); 244 | name = Main.storyboard; 245 | sourceTree = ""; 246 | }; 247 | C89EB9E51BB7EDB100207C75 /* LaunchScreen.storyboard */ = { 248 | isa = PBXVariantGroup; 249 | children = ( 250 | C89EB9E61BB7EDB100207C75 /* Base */, 251 | ); 252 | name = LaunchScreen.storyboard; 253 | sourceTree = ""; 254 | }; 255 | /* End PBXVariantGroup section */ 256 | 257 | /* Begin XCBuildConfiguration section */ 258 | C89EB9E91BB7EDB100207C75 /* Debug */ = { 259 | isa = XCBuildConfiguration; 260 | buildSettings = { 261 | ALWAYS_SEARCH_USER_PATHS = NO; 262 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 263 | CLANG_CXX_LIBRARY = "libc++"; 264 | CLANG_ENABLE_MODULES = YES; 265 | CLANG_ENABLE_OBJC_ARC = YES; 266 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 267 | CLANG_WARN_BOOL_CONVERSION = YES; 268 | CLANG_WARN_COMMA = YES; 269 | CLANG_WARN_CONSTANT_CONVERSION = YES; 270 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 271 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 272 | CLANG_WARN_EMPTY_BODY = YES; 273 | CLANG_WARN_ENUM_CONVERSION = YES; 274 | CLANG_WARN_INFINITE_RECURSION = YES; 275 | CLANG_WARN_INT_CONVERSION = YES; 276 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 277 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 278 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 279 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 280 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 281 | CLANG_WARN_STRICT_PROTOTYPES = YES; 282 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 283 | CLANG_WARN_UNREACHABLE_CODE = YES; 284 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 285 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 286 | COPY_PHASE_STRIP = NO; 287 | DEBUG_INFORMATION_FORMAT = dwarf; 288 | ENABLE_STRICT_OBJC_MSGSEND = YES; 289 | ENABLE_TESTABILITY = YES; 290 | GCC_C_LANGUAGE_STANDARD = gnu99; 291 | GCC_DYNAMIC_NO_PIC = NO; 292 | GCC_NO_COMMON_BLOCKS = YES; 293 | GCC_OPTIMIZATION_LEVEL = 0; 294 | GCC_PREPROCESSOR_DEFINITIONS = ( 295 | "DEBUG=1", 296 | "$(inherited)", 297 | ); 298 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 299 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 300 | GCC_WARN_UNDECLARED_SELECTOR = YES; 301 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 302 | GCC_WARN_UNUSED_FUNCTION = YES; 303 | GCC_WARN_UNUSED_VARIABLE = YES; 304 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 305 | MTL_ENABLE_DEBUG_INFO = YES; 306 | ONLY_ACTIVE_ARCH = YES; 307 | SDKROOT = iphoneos; 308 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 309 | SWIFT_VERSION = 4.0; 310 | TARGETED_DEVICE_FAMILY = "1,2"; 311 | }; 312 | name = Debug; 313 | }; 314 | C89EB9EA1BB7EDB100207C75 /* Release */ = { 315 | isa = XCBuildConfiguration; 316 | buildSettings = { 317 | ALWAYS_SEARCH_USER_PATHS = NO; 318 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 319 | CLANG_CXX_LIBRARY = "libc++"; 320 | CLANG_ENABLE_MODULES = YES; 321 | CLANG_ENABLE_OBJC_ARC = YES; 322 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 323 | CLANG_WARN_BOOL_CONVERSION = YES; 324 | CLANG_WARN_COMMA = YES; 325 | CLANG_WARN_CONSTANT_CONVERSION = YES; 326 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 327 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 328 | CLANG_WARN_EMPTY_BODY = YES; 329 | CLANG_WARN_ENUM_CONVERSION = YES; 330 | CLANG_WARN_INFINITE_RECURSION = YES; 331 | CLANG_WARN_INT_CONVERSION = YES; 332 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 333 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 334 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 335 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 336 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 337 | CLANG_WARN_STRICT_PROTOTYPES = YES; 338 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 339 | CLANG_WARN_UNREACHABLE_CODE = YES; 340 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 341 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 342 | COPY_PHASE_STRIP = NO; 343 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 344 | ENABLE_NS_ASSERTIONS = NO; 345 | ENABLE_STRICT_OBJC_MSGSEND = YES; 346 | GCC_C_LANGUAGE_STANDARD = gnu99; 347 | GCC_NO_COMMON_BLOCKS = YES; 348 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 349 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 350 | GCC_WARN_UNDECLARED_SELECTOR = YES; 351 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 352 | GCC_WARN_UNUSED_FUNCTION = YES; 353 | GCC_WARN_UNUSED_VARIABLE = YES; 354 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 355 | MTL_ENABLE_DEBUG_INFO = NO; 356 | SDKROOT = iphoneos; 357 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 358 | SWIFT_VERSION = 4.0; 359 | TARGETED_DEVICE_FAMILY = "1,2"; 360 | VALIDATE_PRODUCT = YES; 361 | }; 362 | name = Release; 363 | }; 364 | C89EB9EC1BB7EDB100207C75 /* Debug */ = { 365 | isa = XCBuildConfiguration; 366 | buildSettings = { 367 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 368 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 369 | CODE_SIGN_IDENTITY = "iPhone Developer"; 370 | INFOPLIST_FILE = JSONNeverDieExample/Info.plist; 371 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 372 | PRODUCT_BUNDLE_IDENTIFIER = com.lvwenhan.JSONNeverDieExample; 373 | PRODUCT_NAME = "$(TARGET_NAME)"; 374 | SWIFT_VERSION = 4.0; 375 | }; 376 | name = Debug; 377 | }; 378 | C89EB9ED1BB7EDB100207C75 /* Release */ = { 379 | isa = XCBuildConfiguration; 380 | buildSettings = { 381 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 382 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 383 | CODE_SIGN_IDENTITY = "iPhone Developer"; 384 | INFOPLIST_FILE = JSONNeverDieExample/Info.plist; 385 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 386 | PRODUCT_BUNDLE_IDENTIFIER = com.lvwenhan.JSONNeverDieExample; 387 | PRODUCT_NAME = "$(TARGET_NAME)"; 388 | SWIFT_VERSION = 4.0; 389 | }; 390 | name = Release; 391 | }; 392 | /* End XCBuildConfiguration section */ 393 | 394 | /* Begin XCConfigurationList section */ 395 | C89EB9D41BB7EDB100207C75 /* Build configuration list for PBXProject "JSONNeverDieExample" */ = { 396 | isa = XCConfigurationList; 397 | buildConfigurations = ( 398 | C89EB9E91BB7EDB100207C75 /* Debug */, 399 | C89EB9EA1BB7EDB100207C75 /* Release */, 400 | ); 401 | defaultConfigurationIsVisible = 0; 402 | defaultConfigurationName = Release; 403 | }; 404 | C89EB9EB1BB7EDB100207C75 /* Build configuration list for PBXNativeTarget "JSONNeverDieExample" */ = { 405 | isa = XCConfigurationList; 406 | buildConfigurations = ( 407 | C89EB9EC1BB7EDB100207C75 /* Debug */, 408 | C89EB9ED1BB7EDB100207C75 /* Release */, 409 | ); 410 | defaultConfigurationIsVisible = 0; 411 | defaultConfigurationName = Release; 412 | }; 413 | /* End XCConfigurationList section */ 414 | }; 415 | rootObject = C89EB9D11BB7EDB100207C75 /* Project object */; 416 | } 417 | -------------------------------------------------------------------------------- /Example/JSONNeverDieExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/JSONNeverDieExample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Example/JSONNeverDieExample.xcodeproj/project.xcworkspace/xcuserdata/JohnLui.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnlui/JSONNeverDie/606f3bb4c3a17d6248d73dda3a73e4d383141a18/Example/JSONNeverDieExample.xcodeproj/project.xcworkspace/xcuserdata/JohnLui.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Example/JSONNeverDieExample.xcodeproj/project.xcworkspace/xcuserdata/leqicheng.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnlui/JSONNeverDie/606f3bb4c3a17d6248d73dda3a73e4d383141a18/Example/JSONNeverDieExample.xcodeproj/project.xcworkspace/xcuserdata/leqicheng.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Example/JSONNeverDieExample.xcodeproj/xcuserdata/JohnLui.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /Example/JSONNeverDieExample.xcodeproj/xcuserdata/JohnLui.xcuserdatad/xcschemes/JSONNeverDieExample.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 69 | 70 | 71 | 72 | 73 | 74 | 80 | 82 | 88 | 89 | 90 | 91 | 93 | 94 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /Example/JSONNeverDieExample.xcodeproj/xcuserdata/JohnLui.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | JSONNeverDieExample.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | C89EB9D81BB7EDB100207C75 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Example/JSONNeverDieExample.xcodeproj/xcuserdata/leqicheng.xcuserdatad/xcschemes/JSONNeverDieExample.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /Example/JSONNeverDieExample.xcodeproj/xcuserdata/leqicheng.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | JSONNeverDieExample.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | C89EB9D81BB7EDB100207C75 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Example/JSONNeverDieExample/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // JSONNeverDieExample 4 | // 5 | // Created by 吕文翰 on 15/9/27. 6 | // Copyright © 2015年 JohnLui. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(_ application: UIApplication) { 23 | // 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. 24 | // 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. 25 | } 26 | 27 | func applicationDidEnterBackground(_ application: UIApplication) { 28 | // 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. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(_ application: UIApplication) { 33 | // 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. 34 | } 35 | 36 | func applicationDidBecomeActive(_ application: UIApplication) { 37 | // 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. 38 | } 39 | 40 | func applicationWillTerminate(_ application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /Example/JSONNeverDieExample/Assets.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 | } -------------------------------------------------------------------------------- /Example/JSONNeverDieExample/Base.lproj/LaunchScreen.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 | -------------------------------------------------------------------------------- /Example/JSONNeverDieExample/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /Example/JSONNeverDieExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSAppTransportSecurity 6 | 7 | NSAllowsArbitraryLoads 8 | 9 | 10 | CFBundleDevelopmentRegion 11 | en 12 | CFBundleExecutable 13 | $(EXECUTABLE_NAME) 14 | CFBundleIdentifier 15 | $(PRODUCT_BUNDLE_IDENTIFIER) 16 | CFBundleInfoDictionaryVersion 17 | 6.0 18 | CFBundleName 19 | $(PRODUCT_NAME) 20 | CFBundlePackageType 21 | APPL 22 | CFBundleShortVersionString 23 | 1.0 24 | CFBundleSignature 25 | ???? 26 | CFBundleVersion 27 | 1 28 | LSRequiresIPhoneOS 29 | 30 | UILaunchStoryboardName 31 | LaunchScreen 32 | UIMainStoryboardFile 33 | Main 34 | UIRequiredDeviceCapabilities 35 | 36 | armv7 37 | 38 | UISupportedInterfaceOrientations 39 | 40 | UIInterfaceOrientationPortrait 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | UISupportedInterfaceOrientations~ipad 45 | 46 | UIInterfaceOrientationPortrait 47 | UIInterfaceOrientationPortraitUpsideDown 48 | UIInterfaceOrientationLandscapeLeft 49 | UIInterfaceOrientationLandscapeRight 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /Example/JSONNeverDieExample/Model.json: -------------------------------------------------------------------------------- 1 | { 2 | "hey": { 3 | "man": { 4 | "hello": true 5 | } 6 | }, 7 | "string": "🐳", 8 | "array": [ 9 | {"key": 10000}, 10 | {"key": 10001}, 11 | {"key": 10002} 12 | ], 13 | "array_values": [ 14 | 20000, 20001, 20002 15 | ], 16 | "double": 0.01, 17 | "int": 10086 18 | } -------------------------------------------------------------------------------- /Example/JSONNeverDieExample/Model.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Model.swift 3 | // JSONNeverDieExample 4 | // 5 | // Created by 吕文翰 on 15/10/3. 6 | // Copyright © 2015年 JohnLui. All rights reserved. 7 | // 8 | 9 | import JSONNeverDie 10 | 11 | class Model: JSONNDModel { 12 | @objc var string = "" 13 | @objc var double = 0.0 14 | @objc var int = 0 15 | @objc var array_values = [Int]() 16 | @objc var array = [ModelOnlyOneKey]() 17 | @objc var hey: Hey! 18 | override init(JSONNDObject json: JSONND) { 19 | super.init(JSONNDObject: json) 20 | 21 | for i in json["array_values"].arrayValue { 22 | self.array_values.append(i.intValue) 23 | } 24 | for i in json["array"].arrayValue { 25 | self.array.append(ModelOnlyOneKey(JSONNDObject: i)) 26 | } 27 | self.hey = Hey(JSONNDObject: json["hey"]) 28 | } 29 | } 30 | class ModelOnlyOneKey: JSONNDModel { 31 | @objc var key = 0 32 | } 33 | class Hey: JSONNDModel { 34 | @objc var man: Man! 35 | override init(JSONNDObject json: JSONND) { 36 | super.init(JSONNDObject: json) 37 | 38 | self.man = Man(JSONNDObject: json["man"]) 39 | } 40 | } 41 | class Man: JSONNDModel { 42 | @objc var hello = false 43 | } 44 | -------------------------------------------------------------------------------- /Example/JSONNeverDieExample/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // JSONNeverDieExample 4 | // 5 | // Created by 吕文翰 on 15/9/27. 6 | // Copyright © 2015年 JohnLui. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import JSONNeverDie 11 | 12 | class People: JSONNDModel { 13 | @objc var name = "" 14 | } 15 | 16 | class ViewController: UIViewController { 17 | 18 | override func viewDidLoad() { 19 | super.viewDidLoad() 20 | let json = JSONND(string: "{\"name\": \"JohnLui\"}") 21 | let people = People(JSONNDObject: json) 22 | print(people.name) 23 | 24 | if let url = URL(string: "http://httpbin.org/get?hello=world"), 25 | let string = try? String(contentsOf: url, encoding: String.Encoding.utf8) { 26 | let json1 = JSONND(string: string) 27 | print(json1["args"]["hello"].stringValue) 28 | print(json1.RAW) 29 | } 30 | 31 | if let url = URL(string: "http://httpbin.org/get?hello=world"), 32 | let string = try? String(contentsOf: url, encoding: String.Encoding.utf8) { 33 | let json = JSONND(string: string) 34 | print("json string: \(json.RAWValue)") 35 | print("GOT string for key 'hello': ", json["args"]["hello"].stringValue) 36 | } 37 | 38 | // init from array 39 | let array = ["hello", 123, false] as [Any] 40 | let arrayJSON = JSONND(array: array as [AnyObject]) 41 | print(arrayJSON.array?.first?.string) 42 | print(arrayJSON.array?[1].int) 43 | print(arrayJSON.array?[2].bool) 44 | print(arrayJSON.RAW) 45 | 46 | // init from dictionary 47 | let dic = ["hello": "NeverDie", "json": 200] as [String : Any] 48 | let dicJSON = JSONND(dictionary: dic as [String : AnyObject]) 49 | print(dicJSON["hello"].string) 50 | print(dicJSON["json"].int) 51 | print(dicJSON.RAW) 52 | 53 | if let url = Bundle.main.url(forResource: "Model", withExtension: "json"), 54 | let string = try? String(contentsOf: url, encoding: String.Encoding.utf8) { 55 | let jsonForModel = JSONND(string: string) 56 | let model = Model(JSONNDObject: jsonForModel) 57 | print(model.string) 58 | print(model.double) 59 | print(model.int) 60 | print(model.array_values.first) 61 | print(model.array.first?.key) 62 | print(model.hey.man.hello) 63 | } 64 | 65 | self.testReflection() 66 | } 67 | 68 | func testReflection() { 69 | let json = JSONND(dictionary: ["name": "JohnLui" as AnyObject]) 70 | let people = People(JSONNDObject: json) 71 | print(people.name) // get "JohnLui" 72 | } 73 | 74 | override func didReceiveMemoryWarning() { 75 | super.didReceiveMemoryWarning() 76 | // Dispose of any resources that can be recreated. 77 | } 78 | 79 | 80 | } 81 | 82 | -------------------------------------------------------------------------------- /JSONNeverDie.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | C80546BE1BC55C9600BB6226 /* JSONND.swift in Sources */ = {isa = PBXBuildFile; fileRef = C80546BD1BC55C9600BB6226 /* JSONND.swift */; }; 11 | C80546C01BC55CD200BB6226 /* JSONND+DictionaryLiteralConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = C80546BF1BC55CD200BB6226 /* JSONND+DictionaryLiteralConvertible.swift */; }; 12 | C80546C21BC55CF400BB6226 /* JSONND+ArrayLiteralConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = C80546C11BC55CF400BB6226 /* JSONND+ArrayLiteralConvertible.swift */; }; 13 | C80546C41BC55DB600BB6226 /* JSONNDModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C80546C31BC55DB600BB6226 /* JSONNDModel.swift */; }; 14 | C81DD4361BB7DB35007CE97E /* JSONNeverDie.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C88A50991BB683890054E3A4 /* JSONNeverDie.framework */; }; 15 | C81DD43D1BB7DCA7007CE97E /* test.json in Resources */ = {isa = PBXBuildFile; fileRef = C81DD43C1BB7DCA7007CE97E /* test.json */; }; 16 | C8271AB91BC9873500F69FC2 /* ParseJSONTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8271AB81BC9873500F69FC2 /* ParseJSONTests.swift */; }; 17 | C8271ABB1BC987C800F69FC2 /* StringTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8271ABA1BC987C800F69FC2 /* StringTests.swift */; }; 18 | C8271ABD1BC9881000F69FC2 /* IntTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8271ABC1BC9881000F69FC2 /* IntTests.swift */; }; 19 | C8271AC11BC988D400F69FC2 /* BoolTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8271AC01BC988D400F69FC2 /* BoolTests.swift */; }; 20 | C8271AC31BC9894400F69FC2 /* JSONValueTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8271AC21BC9894400F69FC2 /* JSONValueTests.swift */; }; 21 | C8271AC51BC98A8B00F69FC2 /* ArrayWithObjectsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8271AC41BC98A8B00F69FC2 /* ArrayWithObjectsTests.swift */; }; 22 | C8271AC71BC98B9D00F69FC2 /* ArrayWithValuesTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8271AC61BC98B9D00F69FC2 /* ArrayWithValuesTests.swift */; }; 23 | C8271AC91BC98C4200F69FC2 /* JSONInitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8271AC81BC98C4200F69FC2 /* JSONInitTests.swift */; }; 24 | C8271ACC1BC9961B00F69FC2 /* ArrayTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8271ACB1BC9961B00F69FC2 /* ArrayTests.swift */; }; 25 | C863C5D11D33625C0070898C /* DoubleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C863C5D01D33625C0070898C /* DoubleTests.swift */; }; 26 | C86D3D2D1BBFBA63007FBA24 /* JSONNDModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C86D3D2C1BBFBA63007FBA24 /* JSONNDModelTests.swift */; }; 27 | C86D3D2F1BBFBB9B007FBA24 /* TestModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C86D3D2E1BBFBB9B007FBA24 /* TestModel.swift */; }; 28 | C88A509D1BB683890054E3A4 /* JSONNeverDie.h in Headers */ = {isa = PBXBuildFile; fileRef = C88A509C1BB683890054E3A4 /* JSONNeverDie.h */; settings = {ATTRIBUTES = (Public, ); }; }; 29 | C8BF46741BC9864E00786057 /* BaseTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8BF46731BC9864E00786057 /* BaseTests.swift */; }; 30 | /* End PBXBuildFile section */ 31 | 32 | /* Begin PBXContainerItemProxy section */ 33 | C81DD4371BB7DB35007CE97E /* PBXContainerItemProxy */ = { 34 | isa = PBXContainerItemProxy; 35 | containerPortal = C88A50901BB683890054E3A4 /* Project object */; 36 | proxyType = 1; 37 | remoteGlobalIDString = C88A50981BB683890054E3A4; 38 | remoteInfo = JSONNeverDie; 39 | }; 40 | /* End PBXContainerItemProxy section */ 41 | 42 | /* Begin PBXFileReference section */ 43 | C80546BD1BC55C9600BB6226 /* JSONND.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JSONND.swift; path = Source/JSONND.swift; sourceTree = SOURCE_ROOT; }; 44 | C80546BF1BC55CD200BB6226 /* JSONND+DictionaryLiteralConvertible.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "JSONND+DictionaryLiteralConvertible.swift"; path = "Source/JSONND+DictionaryLiteralConvertible.swift"; sourceTree = SOURCE_ROOT; }; 45 | C80546C11BC55CF400BB6226 /* JSONND+ArrayLiteralConvertible.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "JSONND+ArrayLiteralConvertible.swift"; path = "Source/JSONND+ArrayLiteralConvertible.swift"; sourceTree = SOURCE_ROOT; }; 46 | C80546C31BC55DB600BB6226 /* JSONNDModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JSONNDModel.swift; path = Source/JSONNDModel.swift; sourceTree = SOURCE_ROOT; }; 47 | C81DD4311BB7DB35007CE97E /* JSONNeverDieTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = JSONNeverDieTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 48 | C81DD4351BB7DB35007CE97E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 49 | C81DD43C1BB7DCA7007CE97E /* test.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = test.json; sourceTree = ""; }; 50 | C8271AB81BC9873500F69FC2 /* ParseJSONTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ParseJSONTests.swift; sourceTree = ""; }; 51 | C8271ABA1BC987C800F69FC2 /* StringTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StringTests.swift; sourceTree = ""; }; 52 | C8271ABC1BC9881000F69FC2 /* IntTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IntTests.swift; sourceTree = ""; }; 53 | C8271AC01BC988D400F69FC2 /* BoolTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BoolTests.swift; sourceTree = ""; }; 54 | C8271AC21BC9894400F69FC2 /* JSONValueTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JSONValueTests.swift; sourceTree = ""; }; 55 | C8271AC41BC98A8B00F69FC2 /* ArrayWithObjectsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArrayWithObjectsTests.swift; sourceTree = ""; }; 56 | C8271AC61BC98B9D00F69FC2 /* ArrayWithValuesTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArrayWithValuesTests.swift; sourceTree = ""; }; 57 | C8271AC81BC98C4200F69FC2 /* JSONInitTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JSONInitTests.swift; sourceTree = ""; }; 58 | C8271ACB1BC9961B00F69FC2 /* ArrayTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArrayTests.swift; sourceTree = ""; }; 59 | C863C5D01D33625C0070898C /* DoubleTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DoubleTests.swift; sourceTree = ""; }; 60 | C86D3D2C1BBFBA63007FBA24 /* JSONNDModelTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JSONNDModelTests.swift; sourceTree = ""; }; 61 | C86D3D2E1BBFBB9B007FBA24 /* TestModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestModel.swift; sourceTree = ""; }; 62 | C88A50991BB683890054E3A4 /* JSONNeverDie.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = JSONNeverDie.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 63 | C88A509C1BB683890054E3A4 /* JSONNeverDie.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JSONNeverDie.h; sourceTree = ""; }; 64 | C88A509E1BB683890054E3A4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 65 | C8BF46731BC9864E00786057 /* BaseTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BaseTests.swift; sourceTree = ""; }; 66 | /* End PBXFileReference section */ 67 | 68 | /* Begin PBXFrameworksBuildPhase section */ 69 | C81DD42E1BB7DB35007CE97E /* Frameworks */ = { 70 | isa = PBXFrameworksBuildPhase; 71 | buildActionMask = 2147483647; 72 | files = ( 73 | C81DD4361BB7DB35007CE97E /* JSONNeverDie.framework in Frameworks */, 74 | ); 75 | runOnlyForDeploymentPostprocessing = 0; 76 | }; 77 | C88A50951BB683890054E3A4 /* Frameworks */ = { 78 | isa = PBXFrameworksBuildPhase; 79 | buildActionMask = 2147483647; 80 | files = ( 81 | ); 82 | runOnlyForDeploymentPostprocessing = 0; 83 | }; 84 | /* End PBXFrameworksBuildPhase section */ 85 | 86 | /* Begin PBXGroup section */ 87 | C81DD4321BB7DB35007CE97E /* JSONNeverDieTests */ = { 88 | isa = PBXGroup; 89 | children = ( 90 | C8BF46731BC9864E00786057 /* BaseTests.swift */, 91 | C8271AB81BC9873500F69FC2 /* ParseJSONTests.swift */, 92 | C8271ABA1BC987C800F69FC2 /* StringTests.swift */, 93 | C8271ABC1BC9881000F69FC2 /* IntTests.swift */, 94 | C863C5D01D33625C0070898C /* DoubleTests.swift */, 95 | C8271AC01BC988D400F69FC2 /* BoolTests.swift */, 96 | C8271AC21BC9894400F69FC2 /* JSONValueTests.swift */, 97 | C8271ACB1BC9961B00F69FC2 /* ArrayTests.swift */, 98 | C8271AC41BC98A8B00F69FC2 /* ArrayWithObjectsTests.swift */, 99 | C8271AC61BC98B9D00F69FC2 /* ArrayWithValuesTests.swift */, 100 | C8271AC81BC98C4200F69FC2 /* JSONInitTests.swift */, 101 | C86D3D2C1BBFBA63007FBA24 /* JSONNDModelTests.swift */, 102 | C86D3D2E1BBFBB9B007FBA24 /* TestModel.swift */, 103 | C81DD43C1BB7DCA7007CE97E /* test.json */, 104 | C81DD4351BB7DB35007CE97E /* Info.plist */, 105 | ); 106 | path = JSONNeverDieTests; 107 | sourceTree = ""; 108 | }; 109 | C88A508F1BB683890054E3A4 = { 110 | isa = PBXGroup; 111 | children = ( 112 | C88A509B1BB683890054E3A4 /* JSONNeverDie */, 113 | C81DD4321BB7DB35007CE97E /* JSONNeverDieTests */, 114 | C88A509A1BB683890054E3A4 /* Products */, 115 | ); 116 | sourceTree = ""; 117 | }; 118 | C88A509A1BB683890054E3A4 /* Products */ = { 119 | isa = PBXGroup; 120 | children = ( 121 | C88A50991BB683890054E3A4 /* JSONNeverDie.framework */, 122 | C81DD4311BB7DB35007CE97E /* JSONNeverDieTests.xctest */, 123 | ); 124 | name = Products; 125 | sourceTree = ""; 126 | }; 127 | C88A509B1BB683890054E3A4 /* JSONNeverDie */ = { 128 | isa = PBXGroup; 129 | children = ( 130 | C88A509C1BB683890054E3A4 /* JSONNeverDie.h */, 131 | C80546BD1BC55C9600BB6226 /* JSONND.swift */, 132 | C80546BF1BC55CD200BB6226 /* JSONND+DictionaryLiteralConvertible.swift */, 133 | C80546C11BC55CF400BB6226 /* JSONND+ArrayLiteralConvertible.swift */, 134 | C80546C31BC55DB600BB6226 /* JSONNDModel.swift */, 135 | C88A509E1BB683890054E3A4 /* Info.plist */, 136 | ); 137 | path = JSONNeverDie; 138 | sourceTree = ""; 139 | }; 140 | /* End PBXGroup section */ 141 | 142 | /* Begin PBXHeadersBuildPhase section */ 143 | C88A50961BB683890054E3A4 /* Headers */ = { 144 | isa = PBXHeadersBuildPhase; 145 | buildActionMask = 2147483647; 146 | files = ( 147 | C88A509D1BB683890054E3A4 /* JSONNeverDie.h in Headers */, 148 | ); 149 | runOnlyForDeploymentPostprocessing = 0; 150 | }; 151 | /* End PBXHeadersBuildPhase section */ 152 | 153 | /* Begin PBXNativeTarget section */ 154 | C81DD4301BB7DB35007CE97E /* JSONNeverDieTests */ = { 155 | isa = PBXNativeTarget; 156 | buildConfigurationList = C81DD43B1BB7DB35007CE97E /* Build configuration list for PBXNativeTarget "JSONNeverDieTests" */; 157 | buildPhases = ( 158 | C81DD42D1BB7DB35007CE97E /* Sources */, 159 | C81DD42E1BB7DB35007CE97E /* Frameworks */, 160 | C81DD42F1BB7DB35007CE97E /* Resources */, 161 | ); 162 | buildRules = ( 163 | ); 164 | dependencies = ( 165 | C81DD4381BB7DB35007CE97E /* PBXTargetDependency */, 166 | ); 167 | name = JSONNeverDieTests; 168 | productName = JSONNeverDieTests; 169 | productReference = C81DD4311BB7DB35007CE97E /* JSONNeverDieTests.xctest */; 170 | productType = "com.apple.product-type.bundle.unit-test"; 171 | }; 172 | C88A50981BB683890054E3A4 /* JSONNeverDie */ = { 173 | isa = PBXNativeTarget; 174 | buildConfigurationList = C88A50A11BB683890054E3A4 /* Build configuration list for PBXNativeTarget "JSONNeverDie" */; 175 | buildPhases = ( 176 | C88A50941BB683890054E3A4 /* Sources */, 177 | C88A50951BB683890054E3A4 /* Frameworks */, 178 | C88A50961BB683890054E3A4 /* Headers */, 179 | C88A50971BB683890054E3A4 /* Resources */, 180 | ); 181 | buildRules = ( 182 | ); 183 | dependencies = ( 184 | ); 185 | name = JSONNeverDie; 186 | productName = JSONNeverDie; 187 | productReference = C88A50991BB683890054E3A4 /* JSONNeverDie.framework */; 188 | productType = "com.apple.product-type.framework"; 189 | }; 190 | /* End PBXNativeTarget section */ 191 | 192 | /* Begin PBXProject section */ 193 | C88A50901BB683890054E3A4 /* Project object */ = { 194 | isa = PBXProject; 195 | attributes = { 196 | LastSwiftUpdateCheck = 0700; 197 | LastUpgradeCheck = 0930; 198 | ORGANIZATIONNAME = JohnLui; 199 | TargetAttributes = { 200 | C81DD4301BB7DB35007CE97E = { 201 | CreatedOnToolsVersion = 7.0; 202 | DevelopmentTeam = FPBUD52ZYH; 203 | LastSwiftMigration = 0800; 204 | }; 205 | C88A50981BB683890054E3A4 = { 206 | CreatedOnToolsVersion = 7.0; 207 | LastSwiftMigration = 0800; 208 | }; 209 | }; 210 | }; 211 | buildConfigurationList = C88A50931BB683890054E3A4 /* Build configuration list for PBXProject "JSONNeverDie" */; 212 | compatibilityVersion = "Xcode 3.2"; 213 | developmentRegion = English; 214 | hasScannedForEncodings = 0; 215 | knownRegions = ( 216 | en, 217 | ); 218 | mainGroup = C88A508F1BB683890054E3A4; 219 | productRefGroup = C88A509A1BB683890054E3A4 /* Products */; 220 | projectDirPath = ""; 221 | projectRoot = ""; 222 | targets = ( 223 | C88A50981BB683890054E3A4 /* JSONNeverDie */, 224 | C81DD4301BB7DB35007CE97E /* JSONNeverDieTests */, 225 | ); 226 | }; 227 | /* End PBXProject section */ 228 | 229 | /* Begin PBXResourcesBuildPhase section */ 230 | C81DD42F1BB7DB35007CE97E /* Resources */ = { 231 | isa = PBXResourcesBuildPhase; 232 | buildActionMask = 2147483647; 233 | files = ( 234 | C81DD43D1BB7DCA7007CE97E /* test.json in Resources */, 235 | ); 236 | runOnlyForDeploymentPostprocessing = 0; 237 | }; 238 | C88A50971BB683890054E3A4 /* Resources */ = { 239 | isa = PBXResourcesBuildPhase; 240 | buildActionMask = 2147483647; 241 | files = ( 242 | ); 243 | runOnlyForDeploymentPostprocessing = 0; 244 | }; 245 | /* End PBXResourcesBuildPhase section */ 246 | 247 | /* Begin PBXSourcesBuildPhase section */ 248 | C81DD42D1BB7DB35007CE97E /* Sources */ = { 249 | isa = PBXSourcesBuildPhase; 250 | buildActionMask = 2147483647; 251 | files = ( 252 | C8BF46741BC9864E00786057 /* BaseTests.swift in Sources */, 253 | C8271AB91BC9873500F69FC2 /* ParseJSONTests.swift in Sources */, 254 | C8271ABD1BC9881000F69FC2 /* IntTests.swift in Sources */, 255 | C8271AC91BC98C4200F69FC2 /* JSONInitTests.swift in Sources */, 256 | C86D3D2F1BBFBB9B007FBA24 /* TestModel.swift in Sources */, 257 | C8271AC51BC98A8B00F69FC2 /* ArrayWithObjectsTests.swift in Sources */, 258 | C8271AC31BC9894400F69FC2 /* JSONValueTests.swift in Sources */, 259 | C8271ABB1BC987C800F69FC2 /* StringTests.swift in Sources */, 260 | C86D3D2D1BBFBA63007FBA24 /* JSONNDModelTests.swift in Sources */, 261 | C863C5D11D33625C0070898C /* DoubleTests.swift in Sources */, 262 | C8271AC11BC988D400F69FC2 /* BoolTests.swift in Sources */, 263 | C8271ACC1BC9961B00F69FC2 /* ArrayTests.swift in Sources */, 264 | C8271AC71BC98B9D00F69FC2 /* ArrayWithValuesTests.swift in Sources */, 265 | ); 266 | runOnlyForDeploymentPostprocessing = 0; 267 | }; 268 | C88A50941BB683890054E3A4 /* Sources */ = { 269 | isa = PBXSourcesBuildPhase; 270 | buildActionMask = 2147483647; 271 | files = ( 272 | C80546C21BC55CF400BB6226 /* JSONND+ArrayLiteralConvertible.swift in Sources */, 273 | C80546C41BC55DB600BB6226 /* JSONNDModel.swift in Sources */, 274 | C80546BE1BC55C9600BB6226 /* JSONND.swift in Sources */, 275 | C80546C01BC55CD200BB6226 /* JSONND+DictionaryLiteralConvertible.swift in Sources */, 276 | ); 277 | runOnlyForDeploymentPostprocessing = 0; 278 | }; 279 | /* End PBXSourcesBuildPhase section */ 280 | 281 | /* Begin PBXTargetDependency section */ 282 | C81DD4381BB7DB35007CE97E /* PBXTargetDependency */ = { 283 | isa = PBXTargetDependency; 284 | target = C88A50981BB683890054E3A4 /* JSONNeverDie */; 285 | targetProxy = C81DD4371BB7DB35007CE97E /* PBXContainerItemProxy */; 286 | }; 287 | /* End PBXTargetDependency section */ 288 | 289 | /* Begin XCBuildConfiguration section */ 290 | C81DD4391BB7DB35007CE97E /* Debug */ = { 291 | isa = XCBuildConfiguration; 292 | buildSettings = { 293 | INFOPLIST_FILE = JSONNeverDieTests/Info.plist; 294 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 295 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 296 | PRODUCT_BUNDLE_IDENTIFIER = com.lvwenhan.JSONNeverDieTests; 297 | PRODUCT_NAME = "$(TARGET_NAME)"; 298 | SWIFT_VERSION = 4.0; 299 | }; 300 | name = Debug; 301 | }; 302 | C81DD43A1BB7DB35007CE97E /* Release */ = { 303 | isa = XCBuildConfiguration; 304 | buildSettings = { 305 | INFOPLIST_FILE = JSONNeverDieTests/Info.plist; 306 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 307 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 308 | PRODUCT_BUNDLE_IDENTIFIER = com.lvwenhan.JSONNeverDieTests; 309 | PRODUCT_NAME = "$(TARGET_NAME)"; 310 | SWIFT_VERSION = 4.0; 311 | }; 312 | name = Release; 313 | }; 314 | C88A509F1BB683890054E3A4 /* Debug */ = { 315 | isa = XCBuildConfiguration; 316 | buildSettings = { 317 | ALWAYS_SEARCH_USER_PATHS = NO; 318 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 319 | CLANG_CXX_LIBRARY = "libc++"; 320 | CLANG_ENABLE_MODULES = YES; 321 | CLANG_ENABLE_OBJC_ARC = YES; 322 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 323 | CLANG_WARN_BOOL_CONVERSION = YES; 324 | CLANG_WARN_COMMA = YES; 325 | CLANG_WARN_CONSTANT_CONVERSION = YES; 326 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 327 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 328 | CLANG_WARN_EMPTY_BODY = YES; 329 | CLANG_WARN_ENUM_CONVERSION = YES; 330 | CLANG_WARN_INFINITE_RECURSION = YES; 331 | CLANG_WARN_INT_CONVERSION = YES; 332 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 333 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 334 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 335 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 336 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 337 | CLANG_WARN_STRICT_PROTOTYPES = YES; 338 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 339 | CLANG_WARN_UNREACHABLE_CODE = YES; 340 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 341 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 342 | COPY_PHASE_STRIP = NO; 343 | CURRENT_PROJECT_VERSION = 1; 344 | DEBUG_INFORMATION_FORMAT = dwarf; 345 | ENABLE_STRICT_OBJC_MSGSEND = YES; 346 | ENABLE_TESTABILITY = YES; 347 | GCC_C_LANGUAGE_STANDARD = gnu99; 348 | GCC_DYNAMIC_NO_PIC = NO; 349 | GCC_NO_COMMON_BLOCKS = YES; 350 | GCC_OPTIMIZATION_LEVEL = 0; 351 | GCC_PREPROCESSOR_DEFINITIONS = ( 352 | "DEBUG=1", 353 | "$(inherited)", 354 | ); 355 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 356 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 357 | GCC_WARN_UNDECLARED_SELECTOR = YES; 358 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 359 | GCC_WARN_UNUSED_FUNCTION = YES; 360 | GCC_WARN_UNUSED_VARIABLE = YES; 361 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 362 | MTL_ENABLE_DEBUG_INFO = YES; 363 | ONLY_ACTIVE_ARCH = YES; 364 | SDKROOT = iphoneos; 365 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 366 | TARGETED_DEVICE_FAMILY = "1,2"; 367 | VERSIONING_SYSTEM = "apple-generic"; 368 | VERSION_INFO_PREFIX = ""; 369 | }; 370 | name = Debug; 371 | }; 372 | C88A50A01BB683890054E3A4 /* Release */ = { 373 | isa = XCBuildConfiguration; 374 | buildSettings = { 375 | ALWAYS_SEARCH_USER_PATHS = NO; 376 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 377 | CLANG_CXX_LIBRARY = "libc++"; 378 | CLANG_ENABLE_MODULES = YES; 379 | CLANG_ENABLE_OBJC_ARC = YES; 380 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 381 | CLANG_WARN_BOOL_CONVERSION = YES; 382 | CLANG_WARN_COMMA = YES; 383 | CLANG_WARN_CONSTANT_CONVERSION = YES; 384 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 385 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 386 | CLANG_WARN_EMPTY_BODY = YES; 387 | CLANG_WARN_ENUM_CONVERSION = YES; 388 | CLANG_WARN_INFINITE_RECURSION = YES; 389 | CLANG_WARN_INT_CONVERSION = YES; 390 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 391 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 392 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 393 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 394 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 395 | CLANG_WARN_STRICT_PROTOTYPES = YES; 396 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 397 | CLANG_WARN_UNREACHABLE_CODE = YES; 398 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 399 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 400 | COPY_PHASE_STRIP = NO; 401 | CURRENT_PROJECT_VERSION = 1; 402 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 403 | ENABLE_NS_ASSERTIONS = NO; 404 | ENABLE_STRICT_OBJC_MSGSEND = YES; 405 | GCC_C_LANGUAGE_STANDARD = gnu99; 406 | GCC_NO_COMMON_BLOCKS = YES; 407 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 408 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 409 | GCC_WARN_UNDECLARED_SELECTOR = YES; 410 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 411 | GCC_WARN_UNUSED_FUNCTION = YES; 412 | GCC_WARN_UNUSED_VARIABLE = YES; 413 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 414 | MTL_ENABLE_DEBUG_INFO = NO; 415 | SDKROOT = iphoneos; 416 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 417 | TARGETED_DEVICE_FAMILY = "1,2"; 418 | VALIDATE_PRODUCT = YES; 419 | VERSIONING_SYSTEM = "apple-generic"; 420 | VERSION_INFO_PREFIX = ""; 421 | }; 422 | name = Release; 423 | }; 424 | C88A50A21BB683890054E3A4 /* Debug */ = { 425 | isa = XCBuildConfiguration; 426 | buildSettings = { 427 | CLANG_ENABLE_MODULES = YES; 428 | CODE_SIGN_IDENTITY = "iPhone Developer"; 429 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 430 | DEFINES_MODULE = YES; 431 | DYLIB_COMPATIBILITY_VERSION = 1; 432 | DYLIB_CURRENT_VERSION = 1; 433 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 434 | INFOPLIST_FILE = JSONNeverDie/Info.plist; 435 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 436 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 437 | PRODUCT_BUNDLE_IDENTIFIER = com.lvwenhan.JSONNeverDie; 438 | PRODUCT_NAME = "$(TARGET_NAME)"; 439 | SKIP_INSTALL = YES; 440 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 441 | SWIFT_VERSION = 4.0; 442 | }; 443 | name = Debug; 444 | }; 445 | C88A50A31BB683890054E3A4 /* Release */ = { 446 | isa = XCBuildConfiguration; 447 | buildSettings = { 448 | CLANG_ENABLE_MODULES = YES; 449 | CODE_SIGN_IDENTITY = "iPhone Developer"; 450 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 451 | DEFINES_MODULE = YES; 452 | DYLIB_COMPATIBILITY_VERSION = 1; 453 | DYLIB_CURRENT_VERSION = 1; 454 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 455 | INFOPLIST_FILE = JSONNeverDie/Info.plist; 456 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 457 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 458 | PRODUCT_BUNDLE_IDENTIFIER = com.lvwenhan.JSONNeverDie; 459 | PRODUCT_NAME = "$(TARGET_NAME)"; 460 | SKIP_INSTALL = YES; 461 | SWIFT_VERSION = 4.0; 462 | }; 463 | name = Release; 464 | }; 465 | /* End XCBuildConfiguration section */ 466 | 467 | /* Begin XCConfigurationList section */ 468 | C81DD43B1BB7DB35007CE97E /* Build configuration list for PBXNativeTarget "JSONNeverDieTests" */ = { 469 | isa = XCConfigurationList; 470 | buildConfigurations = ( 471 | C81DD4391BB7DB35007CE97E /* Debug */, 472 | C81DD43A1BB7DB35007CE97E /* Release */, 473 | ); 474 | defaultConfigurationIsVisible = 0; 475 | defaultConfigurationName = Release; 476 | }; 477 | C88A50931BB683890054E3A4 /* Build configuration list for PBXProject "JSONNeverDie" */ = { 478 | isa = XCConfigurationList; 479 | buildConfigurations = ( 480 | C88A509F1BB683890054E3A4 /* Debug */, 481 | C88A50A01BB683890054E3A4 /* Release */, 482 | ); 483 | defaultConfigurationIsVisible = 0; 484 | defaultConfigurationName = Release; 485 | }; 486 | C88A50A11BB683890054E3A4 /* Build configuration list for PBXNativeTarget "JSONNeverDie" */ = { 487 | isa = XCConfigurationList; 488 | buildConfigurations = ( 489 | C88A50A21BB683890054E3A4 /* Debug */, 490 | C88A50A31BB683890054E3A4 /* Release */, 491 | ); 492 | defaultConfigurationIsVisible = 0; 493 | defaultConfigurationName = Release; 494 | }; 495 | /* End XCConfigurationList section */ 496 | }; 497 | rootObject = C88A50901BB683890054E3A4 /* Project object */; 498 | } 499 | -------------------------------------------------------------------------------- /JSONNeverDie.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /JSONNeverDie.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /JSONNeverDie.xcodeproj/project.xcworkspace/xcuserdata/JohnLui.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnlui/JSONNeverDie/606f3bb4c3a17d6248d73dda3a73e4d383141a18/JSONNeverDie.xcodeproj/project.xcworkspace/xcuserdata/JohnLui.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /JSONNeverDie.xcodeproj/project.xcworkspace/xcuserdata/leqicheng.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnlui/JSONNeverDie/606f3bb4c3a17d6248d73dda3a73e4d383141a18/JSONNeverDie.xcodeproj/project.xcworkspace/xcuserdata/leqicheng.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /JSONNeverDie.xcodeproj/xcshareddata/xcschemes/JSONNeverDie.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 34 | 40 | 41 | 42 | 43 | 44 | 50 | 51 | 52 | 53 | 54 | 55 | 65 | 66 | 72 | 73 | 74 | 75 | 76 | 77 | 83 | 84 | 90 | 91 | 92 | 93 | 95 | 96 | 99 | 100 | 101 | -------------------------------------------------------------------------------- /JSONNeverDie.xcodeproj/xcuserdata/JohnLui.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /JSONNeverDie.xcodeproj/xcuserdata/JohnLui.xcuserdatad/xcschemes/JSONNeverDieTests.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 14 | 15 | 17 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 39 | 40 | 41 | 42 | 48 | 49 | 51 | 52 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /JSONNeverDie.xcodeproj/xcuserdata/JohnLui.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | JSONNeverDie.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 1 11 | 12 | JSONNeverDieTests.xcscheme 13 | 14 | orderHint 15 | 3 16 | 17 | 18 | SuppressBuildableAutocreation 19 | 20 | C81DD4301BB7DB35007CE97E 21 | 22 | primary 23 | 24 | 25 | C88A50981BB683890054E3A4 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /JSONNeverDie.xcodeproj/xcuserdata/leqicheng.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SuppressBuildableAutocreation 6 | 7 | C81DD4301BB7DB35007CE97E 8 | 9 | primary 10 | 11 | 12 | C88A50981BB683890054E3A4 13 | 14 | primary 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /JSONNeverDie/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 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /JSONNeverDie/JSONNeverDie.h: -------------------------------------------------------------------------------- 1 | // 2 | // JSONNeverDie.h 3 | // JSONNeverDie 4 | // 5 | // Created by 吕文翰 on 15/9/26. 6 | // Copyright © 2015年 JohnLui. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for JSONNeverDie. 12 | FOUNDATION_EXPORT double JSONNeverDieVersionNumber; 13 | 14 | //! Project version string for JSONNeverDie. 15 | FOUNDATION_EXPORT const unsigned char JSONNeverDieVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /JSONNeverDieTests/ArrayTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ArrayTests.swift 3 | // JSONNeverDie 4 | // 5 | // Created by 吕文翰 on 15/10/11. 6 | // Copyright © 2015年 JohnLui. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import JSONNeverDie 11 | 12 | class ArrayTests: BaseTests { 13 | 14 | func testArrayNil() { 15 | XCTAssertNil(self.json["array_nil"].array) 16 | XCTAssertEqual(self.json["array_nil"].arrayValue.count, 0) 17 | 18 | self.json.data = "haha" 19 | XCTAssertNil(self.json.array) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /JSONNeverDieTests/ArrayWithObjectsTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ArrayWithObjectsTests.swift 3 | // JSONNeverDie 4 | // 5 | // Created by 吕文翰 on 15/10/11. 6 | // Copyright © 2015年 JohnLui. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import JSONNeverDie 11 | 12 | class ArrayWithObjectsTests: BaseTests { 13 | 14 | var array: [JSONND]! 15 | 16 | override func setUp() { 17 | super.setUp() 18 | 19 | self.array = self.json["array"].arrayValue 20 | } 21 | 22 | func testArrayWithObjects() { 23 | XCTAssertEqual(self.array[0]["key"].int, 10010) 24 | XCTAssertEqual(self.array[1]["key"].stringValue, "🐶") 25 | XCTAssertEqual(self.array[2]["key"].doubleValue, 0.02) 26 | } 27 | 28 | func testArrayWithObjectsNil() { 29 | XCTAssertNil(self.array[0]["key_nil"].int) 30 | XCTAssertNil(self.array[1]["key_nil"].string) 31 | XCTAssertNil(self.array[2]["key_nil"].double) 32 | 33 | XCTAssertEqual(self.array[0]["key_nil"].intValue, 0) 34 | XCTAssertEqual(self.array[1]["key_nil"].stringValue, "") 35 | XCTAssertEqual(self.array[2]["key_nil"].doubleValue, 0.0) 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /JSONNeverDieTests/ArrayWithValuesTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ArrayWithValuesTests.swift 3 | // JSONNeverDie 4 | // 5 | // Created by 吕文翰 on 15/10/11. 6 | // Copyright © 2015年 JohnLui. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import JSONNeverDie 11 | 12 | class ArrayWithValuesTests: BaseTests { 13 | 14 | var array: [JSONND]! 15 | 16 | override func setUp() { 17 | super.setUp() 18 | 19 | self.array = self.json["array_values"].arrayValue 20 | } 21 | 22 | func testArrayWithValues() { 23 | XCTAssertEqual(self.array[0].intValue, 10000) 24 | XCTAssertEqual(self.array[1].stringValue, "🙈") 25 | XCTAssertEqual(self.array[2].doubleValue, 0.03) 26 | } 27 | } -------------------------------------------------------------------------------- /JSONNeverDieTests/BaseTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BaseTests.swift 3 | // JSONNeverDie 4 | // 5 | // Created by 吕文翰 on 15/10/11. 6 | // Copyright © 2015年 JohnLui. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import JSONNeverDie 11 | 12 | class BaseTests: XCTestCase { 13 | 14 | var json: JSONND! 15 | 16 | override func setUp() { 17 | super.setUp() 18 | JSONND.debug = true 19 | if let url = Bundle(for:BaseTests.self).url(forResource: "test", withExtension: "json") { 20 | if let string = try? String(contentsOf: url, encoding: String.Encoding.utf8) { 21 | self.json = JSONND(string: string) 22 | } else { 23 | XCTFail("NSData from test JSON file is nil!") 24 | } 25 | } else { 26 | XCTFail("Can't find the test JSON file") 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /JSONNeverDieTests/BoolTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BoolTests.swift 3 | // JSONNeverDie 4 | // 5 | // Created by 吕文翰 on 15/10/11. 6 | // Copyright © 2015年 JohnLui. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class BoolTests: BaseTests { 12 | 13 | func testBool() { 14 | XCTAssertEqual(self.json["hey"]["man"]["hello"].boolValue, true) 15 | } 16 | 17 | func testBoolNil() { 18 | XCTAssertEqual(self.json["hey_nil"]["man"]["hello"].boolValue, false) 19 | } 20 | } -------------------------------------------------------------------------------- /JSONNeverDieTests/DoubleTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DoubleTests.swift 3 | // JSONNeverDie 4 | // 5 | // Created by 吕文翰 on 16/7/11. 6 | // Copyright © 2016年 JohnLui. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class DoubleTests: BaseTests { 12 | 13 | func testDouble() { 14 | XCTAssertNotNil(self.json["double"].double) 15 | XCTAssertEqual(self.json["double"].doubleValue, 0.01) 16 | } 17 | 18 | func testDoubleNil() { 19 | XCTAssertNil(self.json["double_nil"].double) 20 | XCTAssertEqual(self.json["double_nil"].doubleValue, 0.0) 21 | } 22 | } -------------------------------------------------------------------------------- /JSONNeverDieTests/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 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /JSONNeverDieTests/IntTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // IntTests.swift 3 | // JSONNeverDie 4 | // 5 | // Created by 吕文翰 on 15/10/11. 6 | // Copyright © 2015年 JohnLui. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class IntTests: BaseTests { 12 | 13 | func testInt() { 14 | XCTAssertNotNil(self.json["int"].int) 15 | XCTAssertEqual(self.json["int"].intValue, 10086) 16 | } 17 | 18 | func testIntNil() { 19 | XCTAssertNil(self.json["int_nil"].int) 20 | XCTAssertEqual(self.json["int_nil"].intValue, 0) 21 | } 22 | } -------------------------------------------------------------------------------- /JSONNeverDieTests/JSONInitTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // JSONInitTests.swift 3 | // JSONNeverDie 4 | // 5 | // Created by 吕文翰 on 15/10/11. 6 | // Copyright © 2015年 JohnLui. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import JSONNeverDie 11 | 12 | class JSONInitTests: BaseTests { 13 | 14 | func testJSONInitByLiteral() { 15 | let jsonFromArray: JSONND = ["love", "you", "guys"] 16 | let jsonFromDictionary: JSONND = ["love": ["you": "guys"]] 17 | 18 | XCTAssertEqual(jsonFromArray.RAWValue, "[\n \"love\",\n \"you\",\n \"guys\"\n]") 19 | XCTAssertEqual(jsonFromDictionary.RAWValue, "{\n \"love\" : {\n \"you\" : \"guys\"\n }\n}") 20 | } 21 | 22 | func testJSONInitByParam() { 23 | let jsonFromArray = JSONND(array: ["love", "you", "guys"]) 24 | let jsonFromDictionary = JSONND(dictionary: ["love": ["you": "guys"]]) 25 | 26 | XCTAssertEqual(jsonFromArray.RAWValue, "[\n \"love\",\n \"you\",\n \"guys\"\n]") 27 | XCTAssertEqual(jsonFromDictionary.RAWValue, "{\n \"love\" : {\n \"you\" : \"guys\"\n }\n}") 28 | } 29 | 30 | func testJSONInitError() { 31 | let json = JSONND(string: "haha") 32 | XCTAssertNil(json.data) 33 | 34 | XCTAssertNil(json.RAW) 35 | XCTAssertEqual(json.RAWValue, "") 36 | } 37 | 38 | func testJSONInitNil() { 39 | let json = JSONND() 40 | XCTAssertNil(json.data) 41 | 42 | XCTAssertNil(json.RAW) 43 | XCTAssertEqual(json.RAWValue, "") 44 | } 45 | 46 | func testSomething() { 47 | // here is something we need to do to increase coverage 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /JSONNeverDieTests/JSONNDModelTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // JSONNDModelTests.swift 3 | // JSONNeverDie 4 | // 5 | // Created by 吕文翰 on 15/10/3. 6 | // Copyright © 2015年 JohnLui. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | import JSONNeverDie 11 | 12 | class JSONNDModelTests: BaseTests { 13 | 14 | var testModel: TestModel! 15 | var man: Man! 16 | 17 | override func setUp() { 18 | super.setUp() 19 | 20 | self.testModel = TestModel(JSONNDObject: self.json["test_model"]) 21 | XCTAssertNotNil(self.testModel, "testModel should not be nil!") 22 | 23 | self.man = Man() 24 | XCTAssertFalse(self.man.hello, "JSONNDModel init with nothing should gather init values") 25 | } 26 | 27 | override func tearDown() { 28 | // Put teardown code here. This method is called after the invocation of each test method in the class. 29 | super.tearDown() 30 | } 31 | 32 | func testModelInitfromJSONString() { 33 | let m = Man(fromJSONString: "{\"hello\": true}") 34 | XCTAssertTrue(m.hello) 35 | } 36 | 37 | func testModelString() { 38 | XCTAssertNotNil(self.testModel.string) 39 | XCTAssertEqual(self.testModel.string, "🐳") 40 | } 41 | func testModelInt() { 42 | XCTAssertNotNil(self.testModel.int) 43 | XCTAssertEqual(self.testModel.int, 10086) 44 | } 45 | func testModelDouble() { 46 | XCTAssertNotNil(self.testModel.double) 47 | XCTAssertEqual(self.testModel.double, 0.01) 48 | } 49 | func testModelBool() { 50 | XCTAssertEqual(self.testModel.hey.man.hello, true) 51 | } 52 | 53 | func testModelJSONStringValue() { 54 | let jsonSon: JSONND = ["man": ["hello": true]] 55 | let jsonSonSon: JSONND = ["hello": true] 56 | XCTAssertEqual(self.testModel.hey.RAWValue, jsonSon.RAWValue) 57 | XCTAssertEqual(self.testModel.hey.man.RAWValue, jsonSonSon.RAWValue) 58 | } 59 | 60 | func testModelJSONStringValueNil() { 61 | class Model: JSONNDModel {} 62 | let model = Model(JSONNDObject: JSONND()) 63 | 64 | XCTAssertNil(model.RAW) 65 | XCTAssertEqual(model.RAWValue, "") 66 | } 67 | 68 | func testModelArrayWithObjects() { 69 | print(self.testModel) 70 | XCTAssertEqual(self.testModel.array[0].key, 10000) 71 | XCTAssertEqual(self.testModel.array[1].key, 10001) 72 | XCTAssertEqual(self.testModel.array[2].key, 10002) 73 | } 74 | func testModelArrayWithValues() { 75 | XCTAssertEqual(self.testModel.array_values[0], 20000) 76 | XCTAssertEqual(self.testModel.array_values[1], 20001) 77 | XCTAssertEqual(self.testModel.array_values[2], 20002) 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /JSONNeverDieTests/JSONValueTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // JSONValueTests.swift 3 | // JSONNeverDie 4 | // 5 | // Created by 吕文翰 on 15/10/11. 6 | // Copyright © 2015年 JohnLui. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import JSONNeverDie 11 | 12 | class JSONValueTests: BaseTests { 13 | 14 | func testJSONValue1() { 15 | let jsonSon: JSONND = ["man": ["hello": true]] 16 | XCTAssertEqual(self.json["hey"].RAWValue, jsonSon.RAWValue) 17 | } 18 | 19 | func testJSONValue2() { 20 | let jsonSonSon: JSONND = ["hello": true] 21 | XCTAssertEqual(self.json["hey"]["man"].RAWValue, jsonSonSon.RAWValue) 22 | } 23 | 24 | func testJSONValueNil() { 25 | XCTAssertNil(self.json["hey_nil"].RAW) 26 | XCTAssertNil(self.json["hey_nil"]["man"].RAW) 27 | XCTAssertNil(self.json["hey"]["man_nil"].RAW) 28 | 29 | XCTAssertEqual(self.json["hey_nil"].RAWValue, "") 30 | XCTAssertEqual(self.json["hey_nil"]["man"].RAWValue, "") 31 | XCTAssertEqual(self.json["hey"]["man_nil"].RAWValue, "") 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /JSONNeverDieTests/ParseJSONTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ParseJSONTests.swift 3 | // JSONNeverDie 4 | // 5 | // Created by 吕文翰 on 15/10/11. 6 | // Copyright © 2015年 JohnLui. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class ParseJSONTests: BaseTests { 12 | 13 | func testParseJSON() { 14 | XCTAssertNotNil(self.json.data, "JSONND.jsonObject should not be nil!") 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /JSONNeverDieTests/StringTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // StringTests.swift 3 | // JSONNeverDie 4 | // 5 | // Created by 吕文翰 on 15/10/11. 6 | // Copyright © 2015年 JohnLui. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class StringTests: BaseTests { 12 | 13 | func testString() { 14 | XCTAssertNotNil(self.json["string"].string) 15 | XCTAssertEqual(self.json["string"].stringValue, "🐳") 16 | } 17 | 18 | func testStringNil() { 19 | XCTAssertNil(self.json["string_nil"].string) 20 | XCTAssertEqual(self.json["string_nil"].stringValue, "") 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /JSONNeverDieTests/TestModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TestModel.swift 3 | // JSONNeverDie 4 | // 5 | // Created by 吕文翰 on 15/10/3. 6 | // Copyright © 2015年 JohnLui. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import JSONNeverDie 11 | 12 | class TestModel: JSONNDModel { 13 | @objc var string = "" 14 | @objc var double = 0.0 15 | @objc var int = 0 16 | @objc var array_values = [Int]() 17 | @objc var array = [ModelOnlyOneKey]() 18 | @objc var hey: Hey! 19 | override init(JSONNDObject json: JSONND) { 20 | super.init(JSONNDObject: json) 21 | 22 | for i in json["array_values"].arrayValue { 23 | self.array_values.append(i.intValue) 24 | } 25 | for i in json["array"].arrayValue { 26 | self.array.append(ModelOnlyOneKey(JSONNDObject: i)) 27 | } 28 | self.hey = Hey(JSONNDObject: json["hey"]) 29 | } 30 | } 31 | class ModelOnlyOneKey: JSONNDModel { 32 | @objc var key = 0 33 | } 34 | class Hey: JSONNDModel { 35 | @objc var man: Man! 36 | override init(JSONNDObject json: JSONND) { 37 | super.init(JSONNDObject: json) 38 | 39 | self.man = Man(JSONNDObject: json["man"]) 40 | } 41 | } 42 | class Man: JSONNDModel { 43 | @objc var hello = false 44 | } 45 | -------------------------------------------------------------------------------- /JSONNeverDieTests/test.json: -------------------------------------------------------------------------------- 1 | { 2 | "hey": { 3 | "man": { 4 | "hello": true 5 | } 6 | }, 7 | "string": "🐳", 8 | "array": [ 9 | {"key": 10010}, 10 | {"key": "🐶"}, 11 | {"key": 0.02} 12 | ], 13 | "array_values": [ 14 | 10000, "🙈", 0.03 15 | ], 16 | "double": 0.01, 17 | "int": 10086, 18 | "test_model": { 19 | "hey": { 20 | "man": { 21 | "hello": true 22 | } 23 | }, 24 | "string": "🐳", 25 | "array": [ 26 | {"key": 10000}, 27 | {"key": 10001}, 28 | {"key": 10002} 29 | ], 30 | "array_values": [ 31 | 20000, 20001, 20002 32 | ], 33 | "double": 0.01, 34 | "int": 10086 35 | } 36 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 JohnLui 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 |

4 | 5 |

6 | 7 | 8 | 9 | 10 | 11 |

12 | 13 | JSONNeverDie is an auto reflection tool from JSON to Model, a user friendly JSON encoder / decoder, aims to never die. Also JSONNeverDie is a very important part of [Pitaya](https://github.com/johnlui/Pitaya). 14 | 15 | ### [中文介绍](#中文介绍) 16 | 17 | ## Example 18 | set up a Model: 19 | 20 | ```swift 21 | class People: JSONNDModel { 22 | @objc var name = "" 23 | } 24 | ``` 25 | reflex JSON to Model automatic: 26 | 27 | ```swift 28 | let json = JSONND(string: "{\"name\": \"JohnLui\"}") 29 | let people = People(JSONNDObject: json) 30 | print(people.name) 31 | ``` 32 | 33 | ## Features 34 | 35 | ### reflection features 36 | - [x] JSON to Model reflection automatic 37 | - [x] auto reflection with no need of init() 38 | - [x] supports multi-level reflection 39 | 40 | #### [Read the documentation of auto reflection](https://github.com/johnlui/JSONNeverDie/wiki). 41 | 42 | ### JSON encode / decode features 43 | - [x] supports all types: Int, Double, Bool, String, Array 44 | - [x] user friendly: Xcode can prompt all available types 45 | - [x] provides both Optional-type(Int?) and Original-type(Int) 46 | 47 | And JSONNeverDie is well tested. 48 | 49 | 50 | ## Requirements 51 | 52 | * iOS 7.0+ 53 | * Swift 4 (Version 3) in current swift4 branch 54 | * Swift 3 (Version 2) in swift3 branch 55 | * Swift 2.x / Xcode 7 (Version 1.x) in master branch 56 | 57 | 58 | ##Contribution 59 | 60 | You are welcome to fork and submit pull requests. 61 | 62 | ##License 63 | 64 | JSONNeverDie is open-sourced software licensed under the MIT license. 65 | 66 | # 中文介绍 67 | 68 | ## 基本示例 69 | 构建一个 Model: 70 | 71 | ```swift 72 | class People: JSONNDModel { 73 | @objc var name = "" 74 | } 75 | ``` 76 | 从字符串转换成 JSON 再自动映射为 Model: 77 | 78 | ```swift 79 | let json = JSONND(string: "{\"name\": \"JohnLui\"}") 80 | let people = People(JSONNDObject: json) 81 | print(people.name) 82 | ``` 83 | 84 | ### [中文文档](https://github.com/johnlui/JSONNeverDie/wiki/%E4%B8%AD%E6%96%87%E6%96%87%E6%A1%A3) 85 | 86 | ## 参与开源 87 | 88 | 欢迎提交 issue 和 PR,大门永远向所有人敞开。 89 | 90 | ## 开源协议 91 | 92 | 本项目遵循 MIT 协议开源,具体请查看根目录下的 LICENSE 文件。 93 | 94 | -------------------------------------------------------------------------------- /Source/JSONND+ArrayLiteralConvertible.swift: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | 3 | // Copyright (c) 2015 JohnLui https://github.com/johnlui 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 | // JSONND+ArrayLiteralConvertible.swift 24 | // JSONNeverDie 25 | // 26 | // Created by 吕文翰 on 15/10/7. 27 | // 28 | 29 | import Foundation 30 | 31 | // stolen from SwiftyJSON 32 | extension JSONND: ExpressibleByArrayLiteral { 33 | public init(arrayLiteral elements: Any...) { 34 | self.init(JSONdata: elements as AnyObject?) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Source/JSONND+DictionaryLiteralConvertible.swift: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | 3 | // Copyright (c) 2015 JohnLui https://github.com/johnlui 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 | // JSONND+DictionaryLiteralConvertible.swift 24 | // JSONNeverDie 25 | // 26 | // Created by 吕文翰 on 15/10/7. 27 | // 28 | 29 | import Foundation 30 | 31 | // stolen from SwiftyJSON 32 | extension JSONND: ExpressibleByDictionaryLiteral { 33 | public init(dictionaryLiteral elements: (String, Any)...) { 34 | let data = elements.reduce([String: Any]()){(dictionary: [String: Any], element:(String, Any)) -> [String: Any] in 35 | var d = dictionary 36 | d[element.0] = element.1 37 | return d 38 | } 39 | self.init(JSONdata: data as AnyObject) 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Source/JSONND.swift: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | 3 | // Copyright (c) 2015 JohnLui https://github.com/johnlui 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 | // JSONND.swift 24 | // JSONNeverDie 25 | // 26 | // Created by 吕文翰 on 15/10/7. 27 | // 28 | 29 | import Foundation 30 | 31 | public struct JSONND { 32 | 33 | public static var debug = false 34 | 35 | public var data: Any! 36 | 37 | public init(string: String, encoding: String.Encoding = String.Encoding.utf8) { 38 | do { 39 | if let data = string.data(using: encoding) { 40 | let d = try JSONSerialization.jsonObject(with: data, options: JSONSerialization.ReadingOptions.allowFragments) 41 | self.data = d as AnyObject? 42 | } 43 | } catch let error as NSError { 44 | let e = NSError(domain: "JSONNeverDie.JSONParseError", code: error.code, userInfo: error.userInfo) 45 | if JSONND.debug { NSLog(e.localizedDescription) } 46 | } 47 | } 48 | 49 | fileprivate init(any: AnyObject) { 50 | let j: JSONND = [any] 51 | self.data = j.arrayValue.first?.data 52 | } 53 | 54 | internal init(JSONdata: AnyObject!) { 55 | self.data = JSONdata 56 | } 57 | 58 | public init() { 59 | self.init(JSONdata: nil) 60 | } 61 | public init(dictionary: [String: Any]) { 62 | self.init(any: dictionary as AnyObject) 63 | } 64 | public init(array: [Any]) { 65 | self.init(any: array as AnyObject) 66 | } 67 | public subscript (index: String) -> JSONND { 68 | if let jsonDictionary = self.data as? Dictionary { 69 | if let value = jsonDictionary[index] { 70 | return JSONND(JSONdata: value) 71 | } else { 72 | if JSONND.debug { NSLog("JSONNeverDie: No such key '\(index)'") } 73 | } 74 | } 75 | return JSONND(JSONdata: nil) 76 | } 77 | 78 | public var RAW: String? { 79 | get { 80 | if let _ = self.data { 81 | do { 82 | let d = try JSONSerialization.data(withJSONObject: self.data, options: .prettyPrinted) 83 | return NSString(data: d, encoding: String.Encoding.utf8.rawValue) as String? 84 | } catch { return nil } 85 | // can not test Errors here. 86 | // It seems that NSJSONSerialization.dataWithJSONObject() method dose not support do-try-catch in Swift 2 now. 87 | } 88 | return nil 89 | } 90 | } 91 | 92 | public var RAWValue: String { 93 | get { 94 | return self.RAW ?? "" 95 | } 96 | } 97 | public var int: Int? { 98 | get { 99 | if let number = self.data as? NSNumber { 100 | return number.intValue 101 | } 102 | if let number = self.data as? NSString { 103 | return number.integerValue 104 | } 105 | return nil 106 | } 107 | } 108 | public var intValue: Int { 109 | get { 110 | return self.int ?? 0 111 | } 112 | } 113 | public var double: Double? { 114 | get { 115 | if let number = self.data as? NSNumber { 116 | return number.doubleValue 117 | } 118 | if let number = self.data as? NSString { 119 | return number.doubleValue 120 | } 121 | return nil 122 | } 123 | } 124 | public var doubleValue: Double { 125 | get { 126 | return self.double ?? 0.0 127 | } 128 | } 129 | public var string: String? { 130 | get { 131 | return self.data as? String 132 | } 133 | } 134 | public var stringValue: String { 135 | get { 136 | return self.string ?? "" 137 | } 138 | } 139 | public var bool: Bool? { 140 | get { 141 | return self.data as? Bool 142 | } 143 | } 144 | public var boolValue: Bool { 145 | get { 146 | return self.bool ?? false 147 | } 148 | } 149 | public var array: [JSONND]? { 150 | get { 151 | if let _ = self.data { 152 | if let arr = self.data as? Array { 153 | var result = Array() 154 | for i in arr { 155 | result.append(JSONND(JSONdata: i)) 156 | } 157 | return result 158 | } 159 | return nil 160 | } 161 | return nil 162 | } 163 | } 164 | public var arrayValue: [JSONND] { 165 | get { 166 | return self.array ?? [] 167 | } 168 | } 169 | } 170 | -------------------------------------------------------------------------------- /Source/JSONNDModel.swift: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | 3 | // Copyright (c) 2015 JohnLui https://github.com/johnlui 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 | // JSONNDModel.swift 24 | // JSONNeverDie 25 | // 26 | // Created by 吕文翰 on 15/10/3. 27 | // 28 | 29 | import Foundation 30 | 31 | open class JSONNDModel: NSObject { 32 | 33 | open var JSONNDObject: JSONND? 34 | 35 | public override init() { 36 | super.init() 37 | } 38 | public init(fromJSONString string: String, encoding: String.Encoding = String.Encoding.utf8) { 39 | let jsonnd = JSONND(string: string, encoding: encoding) 40 | self.JSONNDObject = jsonnd 41 | super.init() 42 | self.mapValues() 43 | } 44 | public init(JSONNDObject json: JSONND) { 45 | self.JSONNDObject = json 46 | super.init() 47 | self.mapValues() 48 | } 49 | 50 | internal func mapValues() { 51 | let mirror = Mirror(reflecting: self) 52 | for (k, v) in AnyRandomAccessCollection(mirror.children)! { 53 | if let key = k, let jSONNDObject = self.JSONNDObject { 54 | let json = jSONNDObject[key] 55 | var valueWillBeSet: Any? 56 | switch v { 57 | case _ as String: 58 | valueWillBeSet = json.stringValue 59 | case _ as Int: 60 | valueWillBeSet = json.intValue 61 | case _ as Double: 62 | valueWillBeSet = json.doubleValue 63 | case _ as Bool: 64 | valueWillBeSet = json.boolValue 65 | default: 66 | continue 67 | } 68 | self.setValue(valueWillBeSet, forKey: key) 69 | } 70 | } 71 | } 72 | 73 | open var RAW: String? { 74 | get { 75 | return self.JSONNDObject?.RAW 76 | } 77 | } 78 | 79 | open var RAWValue: String { 80 | get { 81 | return self.RAW ?? "" 82 | } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /assets/logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnlui/JSONNeverDie/606f3bb4c3a17d6248d73dda3a73e4d383141a18/assets/logo.jpg -------------------------------------------------------------------------------- /assets/types.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnlui/JSONNeverDie/606f3bb4c3a17d6248d73dda3a73e4d383141a18/assets/types.png --------------------------------------------------------------------------------