Repository: johnlui/JSONNeverDie Branch: swift4 Commit: 606f3bb4c3a1 Files: 54 Total size: 95.9 KB Directory structure: gitextract_nra9x05a/ ├── .gitattributes ├── .gitignore ├── .travis.yml ├── Example/ │ ├── JSONNeverDieExample/ │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets/ │ │ │ └── AppIcon.appiconset/ │ │ │ └── Contents.json │ │ ├── Base.lproj/ │ │ │ ├── LaunchScreen.storyboard │ │ │ └── Main.storyboard │ │ ├── Info.plist │ │ ├── Model.json │ │ ├── Model.swift │ │ └── ViewController.swift │ └── 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 ├── JSONNeverDie/ │ ├── Info.plist │ └── JSONNeverDie.h ├── 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 ├── 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 ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitattributes ================================================ *.h linguist-language=Swift *.m linguist-language=Swift ================================================ FILE: .gitignore ================================================ .DS_Store ================================================ FILE: .travis.yml ================================================ os: osx osx_image: xcode9 language: objective-c script: xcodebuild test -project JSONNeverDie.xcodeproj -scheme JSONNeverDie -destination 'platform=iOS Simulator,name=iPhone 7,OS=latest' ================================================ FILE: Example/JSONNeverDieExample/AppDelegate.swift ================================================ // // AppDelegate.swift // JSONNeverDieExample // // Created by 吕文翰 on 15/9/27. // Copyright © 2015年 JohnLui. All rights reserved. // import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. return true } func applicationWillResignActive(_ application: UIApplication) { // 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. // 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. } func applicationDidEnterBackground(_ application: UIApplication) { // 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. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } func applicationWillEnterForeground(_ application: UIApplication) { // 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. } func applicationDidBecomeActive(_ application: UIApplication) { // 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. } func applicationWillTerminate(_ application: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } } ================================================ FILE: Example/JSONNeverDieExample/Assets.xcassets/AppIcon.appiconset/Contents.json ================================================ { "images" : [ { "idiom" : "iphone", "size" : "29x29", "scale" : "2x" }, { "idiom" : "iphone", "size" : "29x29", "scale" : "3x" }, { "idiom" : "iphone", "size" : "40x40", "scale" : "2x" }, { "idiom" : "iphone", "size" : "40x40", "scale" : "3x" }, { "idiom" : "iphone", "size" : "60x60", "scale" : "2x" }, { "idiom" : "iphone", "size" : "60x60", "scale" : "3x" }, { "idiom" : "ipad", "size" : "29x29", "scale" : "1x" }, { "idiom" : "ipad", "size" : "29x29", "scale" : "2x" }, { "idiom" : "ipad", "size" : "40x40", "scale" : "1x" }, { "idiom" : "ipad", "size" : "40x40", "scale" : "2x" }, { "idiom" : "ipad", "size" : "76x76", "scale" : "1x" }, { "idiom" : "ipad", "size" : "76x76", "scale" : "2x" } ], "info" : { "version" : 1, "author" : "xcode" } } ================================================ FILE: Example/JSONNeverDieExample/Base.lproj/LaunchScreen.storyboard ================================================ ================================================ FILE: Example/JSONNeverDieExample/Base.lproj/Main.storyboard ================================================ ================================================ FILE: Example/JSONNeverDieExample/Info.plist ================================================ NSAppTransportSecurity NSAllowsArbitraryLoads CFBundleDevelopmentRegion en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName $(PRODUCT_NAME) CFBundlePackageType APPL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1 LSRequiresIPhoneOS UILaunchStoryboardName LaunchScreen UIMainStoryboardFile Main UIRequiredDeviceCapabilities armv7 UISupportedInterfaceOrientations UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UISupportedInterfaceOrientations~ipad UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight ================================================ FILE: Example/JSONNeverDieExample/Model.json ================================================ { "hey": { "man": { "hello": true } }, "string": "🐳", "array": [ {"key": 10000}, {"key": 10001}, {"key": 10002} ], "array_values": [ 20000, 20001, 20002 ], "double": 0.01, "int": 10086 } ================================================ FILE: Example/JSONNeverDieExample/Model.swift ================================================ // // Model.swift // JSONNeverDieExample // // Created by 吕文翰 on 15/10/3. // Copyright © 2015年 JohnLui. All rights reserved. // import JSONNeverDie class Model: JSONNDModel { @objc var string = "" @objc var double = 0.0 @objc var int = 0 @objc var array_values = [Int]() @objc var array = [ModelOnlyOneKey]() @objc var hey: Hey! override init(JSONNDObject json: JSONND) { super.init(JSONNDObject: json) for i in json["array_values"].arrayValue { self.array_values.append(i.intValue) } for i in json["array"].arrayValue { self.array.append(ModelOnlyOneKey(JSONNDObject: i)) } self.hey = Hey(JSONNDObject: json["hey"]) } } class ModelOnlyOneKey: JSONNDModel { @objc var key = 0 } class Hey: JSONNDModel { @objc var man: Man! override init(JSONNDObject json: JSONND) { super.init(JSONNDObject: json) self.man = Man(JSONNDObject: json["man"]) } } class Man: JSONNDModel { @objc var hello = false } ================================================ FILE: Example/JSONNeverDieExample/ViewController.swift ================================================ // // ViewController.swift // JSONNeverDieExample // // Created by 吕文翰 on 15/9/27. // Copyright © 2015年 JohnLui. All rights reserved. // import UIKit import JSONNeverDie class People: JSONNDModel { @objc var name = "" } class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() let json = JSONND(string: "{\"name\": \"JohnLui\"}") let people = People(JSONNDObject: json) print(people.name) if let url = URL(string: "http://httpbin.org/get?hello=world"), let string = try? String(contentsOf: url, encoding: String.Encoding.utf8) { let json1 = JSONND(string: string) print(json1["args"]["hello"].stringValue) print(json1.RAW) } if let url = URL(string: "http://httpbin.org/get?hello=world"), let string = try? String(contentsOf: url, encoding: String.Encoding.utf8) { let json = JSONND(string: string) print("json string: \(json.RAWValue)") print("GOT string for key 'hello': ", json["args"]["hello"].stringValue) } // init from array let array = ["hello", 123, false] as [Any] let arrayJSON = JSONND(array: array as [AnyObject]) print(arrayJSON.array?.first?.string) print(arrayJSON.array?[1].int) print(arrayJSON.array?[2].bool) print(arrayJSON.RAW) // init from dictionary let dic = ["hello": "NeverDie", "json": 200] as [String : Any] let dicJSON = JSONND(dictionary: dic as [String : AnyObject]) print(dicJSON["hello"].string) print(dicJSON["json"].int) print(dicJSON.RAW) if let url = Bundle.main.url(forResource: "Model", withExtension: "json"), let string = try? String(contentsOf: url, encoding: String.Encoding.utf8) { let jsonForModel = JSONND(string: string) let model = Model(JSONNDObject: jsonForModel) print(model.string) print(model.double) print(model.int) print(model.array_values.first) print(model.array.first?.key) print(model.hey.man.hello) } self.testReflection() } func testReflection() { let json = JSONND(dictionary: ["name": "JohnLui" as AnyObject]) let people = People(JSONNDObject: json) print(people.name) // get "JohnLui" } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } } ================================================ FILE: Example/JSONNeverDieExample.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ C86D3D341BBFD981007FBA24 /* Model.json in Resources */ = {isa = PBXBuildFile; fileRef = C86D3D331BBFD981007FBA24 /* Model.json */; }; C86D3D371BBFD993007FBA24 /* Model.swift in Sources */ = {isa = PBXBuildFile; fileRef = C86D3D361BBFD993007FBA24 /* Model.swift */; }; C89EB9DD1BB7EDB100207C75 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89EB9DC1BB7EDB100207C75 /* AppDelegate.swift */; }; C89EB9DF1BB7EDB100207C75 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89EB9DE1BB7EDB100207C75 /* ViewController.swift */; }; C89EB9E21BB7EDB100207C75 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C89EB9E01BB7EDB100207C75 /* Main.storyboard */; }; C89EB9E41BB7EDB100207C75 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C89EB9E31BB7EDB100207C75 /* Assets.xcassets */; }; C89EB9E71BB7EDB100207C75 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C89EB9E51BB7EDB100207C75 /* LaunchScreen.storyboard */; }; C8B70CDA1BB7EE2A00F83495 /* JSONNeverDie.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C89EB9F41BB7EE0F00207C75 /* JSONNeverDie.framework */; }; C8B70CDB1BB7EE2A00F83495 /* JSONNeverDie.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = C89EB9F41BB7EE0F00207C75 /* JSONNeverDie.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ C89EB9F31BB7EE0F00207C75 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C89EB9EE1BB7EE0F00207C75 /* JSONNeverDie.xcodeproj */; proxyType = 2; remoteGlobalIDString = C88A50991BB683890054E3A4; remoteInfo = JSONNeverDie; }; C89EB9F51BB7EE0F00207C75 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C89EB9EE1BB7EE0F00207C75 /* JSONNeverDie.xcodeproj */; proxyType = 2; remoteGlobalIDString = C81DD4311BB7DB35007CE97E; remoteInfo = JSONNeverDieTests; }; C8B70CDC1BB7EE2A00F83495 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C89EB9EE1BB7EE0F00207C75 /* JSONNeverDie.xcodeproj */; proxyType = 1; remoteGlobalIDString = C88A50981BB683890054E3A4; remoteInfo = JSONNeverDie; }; /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ C8B70CDE1BB7EE2A00F83495 /* Embed Frameworks */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; dstPath = ""; dstSubfolderSpec = 10; files = ( C8B70CDB1BB7EE2A00F83495 /* JSONNeverDie.framework in Embed Frameworks */, ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; }; /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ C86D3D331BBFD981007FBA24 /* Model.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = Model.json; sourceTree = ""; }; C86D3D361BBFD993007FBA24 /* Model.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Model.swift; sourceTree = ""; }; C89EB9D91BB7EDB100207C75 /* JSONNeverDieExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JSONNeverDieExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; C89EB9DC1BB7EDB100207C75 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; C89EB9DE1BB7EDB100207C75 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; C89EB9E11BB7EDB100207C75 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; C89EB9E31BB7EDB100207C75 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; C89EB9E61BB7EDB100207C75 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; C89EB9E81BB7EDB100207C75 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; C89EB9EE1BB7EE0F00207C75 /* JSONNeverDie.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = JSONNeverDie.xcodeproj; path = ../JSONNeverDie.xcodeproj; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ C89EB9D61BB7EDB100207C75 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( C8B70CDA1BB7EE2A00F83495 /* JSONNeverDie.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ C89EB9D01BB7EDB100207C75 = { isa = PBXGroup; children = ( C89EB9EE1BB7EE0F00207C75 /* JSONNeverDie.xcodeproj */, C89EB9DB1BB7EDB100207C75 /* JSONNeverDieExample */, C89EB9DA1BB7EDB100207C75 /* Products */, ); sourceTree = ""; }; C89EB9DA1BB7EDB100207C75 /* Products */ = { isa = PBXGroup; children = ( C89EB9D91BB7EDB100207C75 /* JSONNeverDieExample.app */, ); name = Products; sourceTree = ""; }; C89EB9DB1BB7EDB100207C75 /* JSONNeverDieExample */ = { isa = PBXGroup; children = ( C89EB9DC1BB7EDB100207C75 /* AppDelegate.swift */, C89EB9DE1BB7EDB100207C75 /* ViewController.swift */, C86D3D361BBFD993007FBA24 /* Model.swift */, C86D3D331BBFD981007FBA24 /* Model.json */, C89EB9E01BB7EDB100207C75 /* Main.storyboard */, C89EB9E31BB7EDB100207C75 /* Assets.xcassets */, C89EB9E51BB7EDB100207C75 /* LaunchScreen.storyboard */, C89EB9E81BB7EDB100207C75 /* Info.plist */, ); path = JSONNeverDieExample; sourceTree = ""; }; C89EB9EF1BB7EE0F00207C75 /* Products */ = { isa = PBXGroup; children = ( C89EB9F41BB7EE0F00207C75 /* JSONNeverDie.framework */, C89EB9F61BB7EE0F00207C75 /* JSONNeverDieTests.xctest */, ); name = Products; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ C89EB9D81BB7EDB100207C75 /* JSONNeverDieExample */ = { isa = PBXNativeTarget; buildConfigurationList = C89EB9EB1BB7EDB100207C75 /* Build configuration list for PBXNativeTarget "JSONNeverDieExample" */; buildPhases = ( C89EB9D51BB7EDB100207C75 /* Sources */, C89EB9D61BB7EDB100207C75 /* Frameworks */, C89EB9D71BB7EDB100207C75 /* Resources */, C8B70CDE1BB7EE2A00F83495 /* Embed Frameworks */, ); buildRules = ( ); dependencies = ( C8B70CDD1BB7EE2A00F83495 /* PBXTargetDependency */, ); name = JSONNeverDieExample; productName = JSONNeverDieExample; productReference = C89EB9D91BB7EDB100207C75 /* JSONNeverDieExample.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ C89EB9D11BB7EDB100207C75 /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0930; ORGANIZATIONNAME = JohnLui; TargetAttributes = { C89EB9D81BB7EDB100207C75 = { CreatedOnToolsVersion = 7.0; LastSwiftMigration = 0800; }; }; }; buildConfigurationList = C89EB9D41BB7EDB100207C75 /* Build configuration list for PBXProject "JSONNeverDieExample" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, Base, ); mainGroup = C89EB9D01BB7EDB100207C75; productRefGroup = C89EB9DA1BB7EDB100207C75 /* Products */; projectDirPath = ""; projectReferences = ( { ProductGroup = C89EB9EF1BB7EE0F00207C75 /* Products */; ProjectRef = C89EB9EE1BB7EE0F00207C75 /* JSONNeverDie.xcodeproj */; }, ); projectRoot = ""; targets = ( C89EB9D81BB7EDB100207C75 /* JSONNeverDieExample */, ); }; /* End PBXProject section */ /* Begin PBXReferenceProxy section */ C89EB9F41BB7EE0F00207C75 /* JSONNeverDie.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; path = JSONNeverDie.framework; remoteRef = C89EB9F31BB7EE0F00207C75 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; C89EB9F61BB7EE0F00207C75 /* JSONNeverDieTests.xctest */ = { isa = PBXReferenceProxy; fileType = wrapper.cfbundle; path = JSONNeverDieTests.xctest; remoteRef = C89EB9F51BB7EE0F00207C75 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXReferenceProxy section */ /* Begin PBXResourcesBuildPhase section */ C89EB9D71BB7EDB100207C75 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( C89EB9E71BB7EDB100207C75 /* LaunchScreen.storyboard in Resources */, C89EB9E41BB7EDB100207C75 /* Assets.xcassets in Resources */, C89EB9E21BB7EDB100207C75 /* Main.storyboard in Resources */, C86D3D341BBFD981007FBA24 /* Model.json in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ C89EB9D51BB7EDB100207C75 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( C86D3D371BBFD993007FBA24 /* Model.swift in Sources */, C89EB9DF1BB7EDB100207C75 /* ViewController.swift in Sources */, C89EB9DD1BB7EDB100207C75 /* AppDelegate.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ C8B70CDD1BB7EE2A00F83495 /* PBXTargetDependency */ = { isa = PBXTargetDependency; name = JSONNeverDie; targetProxy = C8B70CDC1BB7EE2A00F83495 /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ C89EB9E01BB7EDB100207C75 /* Main.storyboard */ = { isa = PBXVariantGroup; children = ( C89EB9E11BB7EDB100207C75 /* Base */, ); name = Main.storyboard; sourceTree = ""; }; C89EB9E51BB7EDB100207C75 /* LaunchScreen.storyboard */ = { isa = PBXVariantGroup; children = ( C89EB9E61BB7EDB100207C75 /* Base */, ); name = LaunchScreen.storyboard; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ C89EB9E91BB7EDB100207C75 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; }; C89EB9EA1BB7EDB100207C75 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; name = Release; }; C89EB9EC1BB7EDB100207C75 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_IDENTITY = "iPhone Developer"; INFOPLIST_FILE = JSONNeverDieExample/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.lvwenhan.JSONNeverDieExample; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 4.0; }; name = Debug; }; C89EB9ED1BB7EDB100207C75 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_IDENTITY = "iPhone Developer"; INFOPLIST_FILE = JSONNeverDieExample/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.lvwenhan.JSONNeverDieExample; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 4.0; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ C89EB9D41BB7EDB100207C75 /* Build configuration list for PBXProject "JSONNeverDieExample" */ = { isa = XCConfigurationList; buildConfigurations = ( C89EB9E91BB7EDB100207C75 /* Debug */, C89EB9EA1BB7EDB100207C75 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; C89EB9EB1BB7EDB100207C75 /* Build configuration list for PBXNativeTarget "JSONNeverDieExample" */ = { isa = XCConfigurationList; buildConfigurations = ( C89EB9EC1BB7EDB100207C75 /* Debug */, C89EB9ED1BB7EDB100207C75 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = C89EB9D11BB7EDB100207C75 /* Project object */; } ================================================ FILE: Example/JSONNeverDieExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata ================================================ ================================================ FILE: Example/JSONNeverDieExample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist ================================================ IDEDidComputeMac32BitWarning ================================================ FILE: Example/JSONNeverDieExample.xcodeproj/xcuserdata/JohnLui.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist ================================================ ================================================ FILE: Example/JSONNeverDieExample.xcodeproj/xcuserdata/JohnLui.xcuserdatad/xcschemes/JSONNeverDieExample.xcscheme ================================================ ================================================ FILE: Example/JSONNeverDieExample.xcodeproj/xcuserdata/JohnLui.xcuserdatad/xcschemes/xcschememanagement.plist ================================================ SchemeUserState JSONNeverDieExample.xcscheme orderHint 0 SuppressBuildableAutocreation C89EB9D81BB7EDB100207C75 primary ================================================ FILE: Example/JSONNeverDieExample.xcodeproj/xcuserdata/leqicheng.xcuserdatad/xcschemes/JSONNeverDieExample.xcscheme ================================================ ================================================ FILE: Example/JSONNeverDieExample.xcodeproj/xcuserdata/leqicheng.xcuserdatad/xcschemes/xcschememanagement.plist ================================================ SchemeUserState JSONNeverDieExample.xcscheme orderHint 0 SuppressBuildableAutocreation C89EB9D81BB7EDB100207C75 primary ================================================ FILE: JSONNeverDie/Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName $(PRODUCT_NAME) CFBundlePackageType FMWK CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion $(CURRENT_PROJECT_VERSION) NSPrincipalClass ================================================ FILE: JSONNeverDie/JSONNeverDie.h ================================================ // // JSONNeverDie.h // JSONNeverDie // // Created by 吕文翰 on 15/9/26. // Copyright © 2015年 JohnLui. All rights reserved. // #import //! Project version number for JSONNeverDie. FOUNDATION_EXPORT double JSONNeverDieVersionNumber; //! Project version string for JSONNeverDie. FOUNDATION_EXPORT const unsigned char JSONNeverDieVersionString[]; // In this header, you should import all the public headers of your framework using statements like #import ================================================ FILE: JSONNeverDie.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ C80546BE1BC55C9600BB6226 /* JSONND.swift in Sources */ = {isa = PBXBuildFile; fileRef = C80546BD1BC55C9600BB6226 /* JSONND.swift */; }; C80546C01BC55CD200BB6226 /* JSONND+DictionaryLiteralConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = C80546BF1BC55CD200BB6226 /* JSONND+DictionaryLiteralConvertible.swift */; }; C80546C21BC55CF400BB6226 /* JSONND+ArrayLiteralConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = C80546C11BC55CF400BB6226 /* JSONND+ArrayLiteralConvertible.swift */; }; C80546C41BC55DB600BB6226 /* JSONNDModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C80546C31BC55DB600BB6226 /* JSONNDModel.swift */; }; C81DD4361BB7DB35007CE97E /* JSONNeverDie.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C88A50991BB683890054E3A4 /* JSONNeverDie.framework */; }; C81DD43D1BB7DCA7007CE97E /* test.json in Resources */ = {isa = PBXBuildFile; fileRef = C81DD43C1BB7DCA7007CE97E /* test.json */; }; C8271AB91BC9873500F69FC2 /* ParseJSONTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8271AB81BC9873500F69FC2 /* ParseJSONTests.swift */; }; C8271ABB1BC987C800F69FC2 /* StringTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8271ABA1BC987C800F69FC2 /* StringTests.swift */; }; C8271ABD1BC9881000F69FC2 /* IntTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8271ABC1BC9881000F69FC2 /* IntTests.swift */; }; C8271AC11BC988D400F69FC2 /* BoolTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8271AC01BC988D400F69FC2 /* BoolTests.swift */; }; C8271AC31BC9894400F69FC2 /* JSONValueTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8271AC21BC9894400F69FC2 /* JSONValueTests.swift */; }; C8271AC51BC98A8B00F69FC2 /* ArrayWithObjectsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8271AC41BC98A8B00F69FC2 /* ArrayWithObjectsTests.swift */; }; C8271AC71BC98B9D00F69FC2 /* ArrayWithValuesTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8271AC61BC98B9D00F69FC2 /* ArrayWithValuesTests.swift */; }; C8271AC91BC98C4200F69FC2 /* JSONInitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8271AC81BC98C4200F69FC2 /* JSONInitTests.swift */; }; C8271ACC1BC9961B00F69FC2 /* ArrayTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8271ACB1BC9961B00F69FC2 /* ArrayTests.swift */; }; C863C5D11D33625C0070898C /* DoubleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C863C5D01D33625C0070898C /* DoubleTests.swift */; }; C86D3D2D1BBFBA63007FBA24 /* JSONNDModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C86D3D2C1BBFBA63007FBA24 /* JSONNDModelTests.swift */; }; C86D3D2F1BBFBB9B007FBA24 /* TestModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C86D3D2E1BBFBB9B007FBA24 /* TestModel.swift */; }; C88A509D1BB683890054E3A4 /* JSONNeverDie.h in Headers */ = {isa = PBXBuildFile; fileRef = C88A509C1BB683890054E3A4 /* JSONNeverDie.h */; settings = {ATTRIBUTES = (Public, ); }; }; C8BF46741BC9864E00786057 /* BaseTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8BF46731BC9864E00786057 /* BaseTests.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ C81DD4371BB7DB35007CE97E /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C88A50901BB683890054E3A4 /* Project object */; proxyType = 1; remoteGlobalIDString = C88A50981BB683890054E3A4; remoteInfo = JSONNeverDie; }; /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ C80546BD1BC55C9600BB6226 /* JSONND.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JSONND.swift; path = Source/JSONND.swift; sourceTree = SOURCE_ROOT; }; C80546BF1BC55CD200BB6226 /* JSONND+DictionaryLiteralConvertible.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "JSONND+DictionaryLiteralConvertible.swift"; path = "Source/JSONND+DictionaryLiteralConvertible.swift"; sourceTree = SOURCE_ROOT; }; C80546C11BC55CF400BB6226 /* JSONND+ArrayLiteralConvertible.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "JSONND+ArrayLiteralConvertible.swift"; path = "Source/JSONND+ArrayLiteralConvertible.swift"; sourceTree = SOURCE_ROOT; }; C80546C31BC55DB600BB6226 /* JSONNDModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JSONNDModel.swift; path = Source/JSONNDModel.swift; sourceTree = SOURCE_ROOT; }; C81DD4311BB7DB35007CE97E /* JSONNeverDieTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = JSONNeverDieTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; C81DD4351BB7DB35007CE97E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; C81DD43C1BB7DCA7007CE97E /* test.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = test.json; sourceTree = ""; }; C8271AB81BC9873500F69FC2 /* ParseJSONTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ParseJSONTests.swift; sourceTree = ""; }; C8271ABA1BC987C800F69FC2 /* StringTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StringTests.swift; sourceTree = ""; }; C8271ABC1BC9881000F69FC2 /* IntTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IntTests.swift; sourceTree = ""; }; C8271AC01BC988D400F69FC2 /* BoolTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BoolTests.swift; sourceTree = ""; }; C8271AC21BC9894400F69FC2 /* JSONValueTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JSONValueTests.swift; sourceTree = ""; }; C8271AC41BC98A8B00F69FC2 /* ArrayWithObjectsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArrayWithObjectsTests.swift; sourceTree = ""; }; C8271AC61BC98B9D00F69FC2 /* ArrayWithValuesTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArrayWithValuesTests.swift; sourceTree = ""; }; C8271AC81BC98C4200F69FC2 /* JSONInitTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JSONInitTests.swift; sourceTree = ""; }; C8271ACB1BC9961B00F69FC2 /* ArrayTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArrayTests.swift; sourceTree = ""; }; C863C5D01D33625C0070898C /* DoubleTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DoubleTests.swift; sourceTree = ""; }; C86D3D2C1BBFBA63007FBA24 /* JSONNDModelTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JSONNDModelTests.swift; sourceTree = ""; }; C86D3D2E1BBFBB9B007FBA24 /* TestModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestModel.swift; sourceTree = ""; }; C88A50991BB683890054E3A4 /* JSONNeverDie.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = JSONNeverDie.framework; sourceTree = BUILT_PRODUCTS_DIR; }; C88A509C1BB683890054E3A4 /* JSONNeverDie.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JSONNeverDie.h; sourceTree = ""; }; C88A509E1BB683890054E3A4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; C8BF46731BC9864E00786057 /* BaseTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BaseTests.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ C81DD42E1BB7DB35007CE97E /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( C81DD4361BB7DB35007CE97E /* JSONNeverDie.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; C88A50951BB683890054E3A4 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ C81DD4321BB7DB35007CE97E /* JSONNeverDieTests */ = { isa = PBXGroup; children = ( C8BF46731BC9864E00786057 /* BaseTests.swift */, C8271AB81BC9873500F69FC2 /* ParseJSONTests.swift */, C8271ABA1BC987C800F69FC2 /* StringTests.swift */, C8271ABC1BC9881000F69FC2 /* IntTests.swift */, C863C5D01D33625C0070898C /* DoubleTests.swift */, C8271AC01BC988D400F69FC2 /* BoolTests.swift */, C8271AC21BC9894400F69FC2 /* JSONValueTests.swift */, C8271ACB1BC9961B00F69FC2 /* ArrayTests.swift */, C8271AC41BC98A8B00F69FC2 /* ArrayWithObjectsTests.swift */, C8271AC61BC98B9D00F69FC2 /* ArrayWithValuesTests.swift */, C8271AC81BC98C4200F69FC2 /* JSONInitTests.swift */, C86D3D2C1BBFBA63007FBA24 /* JSONNDModelTests.swift */, C86D3D2E1BBFBB9B007FBA24 /* TestModel.swift */, C81DD43C1BB7DCA7007CE97E /* test.json */, C81DD4351BB7DB35007CE97E /* Info.plist */, ); path = JSONNeverDieTests; sourceTree = ""; }; C88A508F1BB683890054E3A4 = { isa = PBXGroup; children = ( C88A509B1BB683890054E3A4 /* JSONNeverDie */, C81DD4321BB7DB35007CE97E /* JSONNeverDieTests */, C88A509A1BB683890054E3A4 /* Products */, ); sourceTree = ""; }; C88A509A1BB683890054E3A4 /* Products */ = { isa = PBXGroup; children = ( C88A50991BB683890054E3A4 /* JSONNeverDie.framework */, C81DD4311BB7DB35007CE97E /* JSONNeverDieTests.xctest */, ); name = Products; sourceTree = ""; }; C88A509B1BB683890054E3A4 /* JSONNeverDie */ = { isa = PBXGroup; children = ( C88A509C1BB683890054E3A4 /* JSONNeverDie.h */, C80546BD1BC55C9600BB6226 /* JSONND.swift */, C80546BF1BC55CD200BB6226 /* JSONND+DictionaryLiteralConvertible.swift */, C80546C11BC55CF400BB6226 /* JSONND+ArrayLiteralConvertible.swift */, C80546C31BC55DB600BB6226 /* JSONNDModel.swift */, C88A509E1BB683890054E3A4 /* Info.plist */, ); path = JSONNeverDie; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ C88A50961BB683890054E3A4 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( C88A509D1BB683890054E3A4 /* JSONNeverDie.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ C81DD4301BB7DB35007CE97E /* JSONNeverDieTests */ = { isa = PBXNativeTarget; buildConfigurationList = C81DD43B1BB7DB35007CE97E /* Build configuration list for PBXNativeTarget "JSONNeverDieTests" */; buildPhases = ( C81DD42D1BB7DB35007CE97E /* Sources */, C81DD42E1BB7DB35007CE97E /* Frameworks */, C81DD42F1BB7DB35007CE97E /* Resources */, ); buildRules = ( ); dependencies = ( C81DD4381BB7DB35007CE97E /* PBXTargetDependency */, ); name = JSONNeverDieTests; productName = JSONNeverDieTests; productReference = C81DD4311BB7DB35007CE97E /* JSONNeverDieTests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; C88A50981BB683890054E3A4 /* JSONNeverDie */ = { isa = PBXNativeTarget; buildConfigurationList = C88A50A11BB683890054E3A4 /* Build configuration list for PBXNativeTarget "JSONNeverDie" */; buildPhases = ( C88A50941BB683890054E3A4 /* Sources */, C88A50951BB683890054E3A4 /* Frameworks */, C88A50961BB683890054E3A4 /* Headers */, C88A50971BB683890054E3A4 /* Resources */, ); buildRules = ( ); dependencies = ( ); name = JSONNeverDie; productName = JSONNeverDie; productReference = C88A50991BB683890054E3A4 /* JSONNeverDie.framework */; productType = "com.apple.product-type.framework"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ C88A50901BB683890054E3A4 /* Project object */ = { isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0700; LastUpgradeCheck = 0930; ORGANIZATIONNAME = JohnLui; TargetAttributes = { C81DD4301BB7DB35007CE97E = { CreatedOnToolsVersion = 7.0; DevelopmentTeam = FPBUD52ZYH; LastSwiftMigration = 0800; }; C88A50981BB683890054E3A4 = { CreatedOnToolsVersion = 7.0; LastSwiftMigration = 0800; }; }; }; buildConfigurationList = C88A50931BB683890054E3A4 /* Build configuration list for PBXProject "JSONNeverDie" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, ); mainGroup = C88A508F1BB683890054E3A4; productRefGroup = C88A509A1BB683890054E3A4 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( C88A50981BB683890054E3A4 /* JSONNeverDie */, C81DD4301BB7DB35007CE97E /* JSONNeverDieTests */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ C81DD42F1BB7DB35007CE97E /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( C81DD43D1BB7DCA7007CE97E /* test.json in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; C88A50971BB683890054E3A4 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ C81DD42D1BB7DB35007CE97E /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( C8BF46741BC9864E00786057 /* BaseTests.swift in Sources */, C8271AB91BC9873500F69FC2 /* ParseJSONTests.swift in Sources */, C8271ABD1BC9881000F69FC2 /* IntTests.swift in Sources */, C8271AC91BC98C4200F69FC2 /* JSONInitTests.swift in Sources */, C86D3D2F1BBFBB9B007FBA24 /* TestModel.swift in Sources */, C8271AC51BC98A8B00F69FC2 /* ArrayWithObjectsTests.swift in Sources */, C8271AC31BC9894400F69FC2 /* JSONValueTests.swift in Sources */, C8271ABB1BC987C800F69FC2 /* StringTests.swift in Sources */, C86D3D2D1BBFBA63007FBA24 /* JSONNDModelTests.swift in Sources */, C863C5D11D33625C0070898C /* DoubleTests.swift in Sources */, C8271AC11BC988D400F69FC2 /* BoolTests.swift in Sources */, C8271ACC1BC9961B00F69FC2 /* ArrayTests.swift in Sources */, C8271AC71BC98B9D00F69FC2 /* ArrayWithValuesTests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; C88A50941BB683890054E3A4 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( C80546C21BC55CF400BB6226 /* JSONND+ArrayLiteralConvertible.swift in Sources */, C80546C41BC55DB600BB6226 /* JSONNDModel.swift in Sources */, C80546BE1BC55C9600BB6226 /* JSONND.swift in Sources */, C80546C01BC55CD200BB6226 /* JSONND+DictionaryLiteralConvertible.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ C81DD4381BB7DB35007CE97E /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = C88A50981BB683890054E3A4 /* JSONNeverDie */; targetProxy = C81DD4371BB7DB35007CE97E /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ C81DD4391BB7DB35007CE97E /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { INFOPLIST_FILE = JSONNeverDieTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.lvwenhan.JSONNeverDieTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 4.0; }; name = Debug; }; C81DD43A1BB7DB35007CE97E /* Release */ = { isa = XCBuildConfiguration; buildSettings = { INFOPLIST_FILE = JSONNeverDieTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.lvwenhan.JSONNeverDieTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 4.0; }; name = Release; }; C88A509F1BB683890054E3A4 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; name = Debug; }; C88A50A01BB683890054E3A4 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; name = Release; }; C88A50A21BB683890054E3A4 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = JSONNeverDie/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.lvwenhan.JSONNeverDie; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 4.0; }; name = Debug; }; C88A50A31BB683890054E3A4 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = JSONNeverDie/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.lvwenhan.JSONNeverDie; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_VERSION = 4.0; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ C81DD43B1BB7DB35007CE97E /* Build configuration list for PBXNativeTarget "JSONNeverDieTests" */ = { isa = XCConfigurationList; buildConfigurations = ( C81DD4391BB7DB35007CE97E /* Debug */, C81DD43A1BB7DB35007CE97E /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; C88A50931BB683890054E3A4 /* Build configuration list for PBXProject "JSONNeverDie" */ = { isa = XCConfigurationList; buildConfigurations = ( C88A509F1BB683890054E3A4 /* Debug */, C88A50A01BB683890054E3A4 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; C88A50A11BB683890054E3A4 /* Build configuration list for PBXNativeTarget "JSONNeverDie" */ = { isa = XCConfigurationList; buildConfigurations = ( C88A50A21BB683890054E3A4 /* Debug */, C88A50A31BB683890054E3A4 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = C88A50901BB683890054E3A4 /* Project object */; } ================================================ FILE: JSONNeverDie.xcodeproj/project.xcworkspace/contents.xcworkspacedata ================================================ ================================================ FILE: JSONNeverDie.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist ================================================ IDEDidComputeMac32BitWarning ================================================ FILE: JSONNeverDie.xcodeproj/xcshareddata/xcschemes/JSONNeverDie.xcscheme ================================================ ================================================ FILE: JSONNeverDie.xcodeproj/xcuserdata/JohnLui.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist ================================================ ================================================ FILE: JSONNeverDie.xcodeproj/xcuserdata/JohnLui.xcuserdatad/xcschemes/JSONNeverDieTests.xcscheme ================================================ ================================================ FILE: JSONNeverDie.xcodeproj/xcuserdata/JohnLui.xcuserdatad/xcschemes/xcschememanagement.plist ================================================ SchemeUserState JSONNeverDie.xcscheme_^#shared#^_ orderHint 1 JSONNeverDieTests.xcscheme orderHint 3 SuppressBuildableAutocreation C81DD4301BB7DB35007CE97E primary C88A50981BB683890054E3A4 primary ================================================ FILE: JSONNeverDie.xcodeproj/xcuserdata/leqicheng.xcuserdatad/xcschemes/xcschememanagement.plist ================================================ SuppressBuildableAutocreation C81DD4301BB7DB35007CE97E primary C88A50981BB683890054E3A4 primary ================================================ FILE: JSONNeverDieTests/ArrayTests.swift ================================================ // // ArrayTests.swift // JSONNeverDie // // Created by 吕文翰 on 15/10/11. // Copyright © 2015年 JohnLui. All rights reserved. // import XCTest @testable import JSONNeverDie class ArrayTests: BaseTests { func testArrayNil() { XCTAssertNil(self.json["array_nil"].array) XCTAssertEqual(self.json["array_nil"].arrayValue.count, 0) self.json.data = "haha" XCTAssertNil(self.json.array) } } ================================================ FILE: JSONNeverDieTests/ArrayWithObjectsTests.swift ================================================ // // ArrayWithObjectsTests.swift // JSONNeverDie // // Created by 吕文翰 on 15/10/11. // Copyright © 2015年 JohnLui. All rights reserved. // import XCTest @testable import JSONNeverDie class ArrayWithObjectsTests: BaseTests { var array: [JSONND]! override func setUp() { super.setUp() self.array = self.json["array"].arrayValue } func testArrayWithObjects() { XCTAssertEqual(self.array[0]["key"].int, 10010) XCTAssertEqual(self.array[1]["key"].stringValue, "🐶") XCTAssertEqual(self.array[2]["key"].doubleValue, 0.02) } func testArrayWithObjectsNil() { XCTAssertNil(self.array[0]["key_nil"].int) XCTAssertNil(self.array[1]["key_nil"].string) XCTAssertNil(self.array[2]["key_nil"].double) XCTAssertEqual(self.array[0]["key_nil"].intValue, 0) XCTAssertEqual(self.array[1]["key_nil"].stringValue, "") XCTAssertEqual(self.array[2]["key_nil"].doubleValue, 0.0) } } ================================================ FILE: JSONNeverDieTests/ArrayWithValuesTests.swift ================================================ // // ArrayWithValuesTests.swift // JSONNeverDie // // Created by 吕文翰 on 15/10/11. // Copyright © 2015年 JohnLui. All rights reserved. // import XCTest @testable import JSONNeverDie class ArrayWithValuesTests: BaseTests { var array: [JSONND]! override func setUp() { super.setUp() self.array = self.json["array_values"].arrayValue } func testArrayWithValues() { XCTAssertEqual(self.array[0].intValue, 10000) XCTAssertEqual(self.array[1].stringValue, "🙈") XCTAssertEqual(self.array[2].doubleValue, 0.03) } } ================================================ FILE: JSONNeverDieTests/BaseTests.swift ================================================ // // BaseTests.swift // JSONNeverDie // // Created by 吕文翰 on 15/10/11. // Copyright © 2015年 JohnLui. All rights reserved. // import XCTest @testable import JSONNeverDie class BaseTests: XCTestCase { var json: JSONND! override func setUp() { super.setUp() JSONND.debug = true if let url = Bundle(for:BaseTests.self).url(forResource: "test", withExtension: "json") { if let string = try? String(contentsOf: url, encoding: String.Encoding.utf8) { self.json = JSONND(string: string) } else { XCTFail("NSData from test JSON file is nil!") } } else { XCTFail("Can't find the test JSON file") } } } ================================================ FILE: JSONNeverDieTests/BoolTests.swift ================================================ // // BoolTests.swift // JSONNeverDie // // Created by 吕文翰 on 15/10/11. // Copyright © 2015年 JohnLui. All rights reserved. // import XCTest class BoolTests: BaseTests { func testBool() { XCTAssertEqual(self.json["hey"]["man"]["hello"].boolValue, true) } func testBoolNil() { XCTAssertEqual(self.json["hey_nil"]["man"]["hello"].boolValue, false) } } ================================================ FILE: JSONNeverDieTests/DoubleTests.swift ================================================ // // DoubleTests.swift // JSONNeverDie // // Created by 吕文翰 on 16/7/11. // Copyright © 2016年 JohnLui. All rights reserved. // import XCTest class DoubleTests: BaseTests { func testDouble() { XCTAssertNotNil(self.json["double"].double) XCTAssertEqual(self.json["double"].doubleValue, 0.01) } func testDoubleNil() { XCTAssertNil(self.json["double_nil"].double) XCTAssertEqual(self.json["double_nil"].doubleValue, 0.0) } } ================================================ FILE: JSONNeverDieTests/Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName $(PRODUCT_NAME) CFBundlePackageType BNDL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1 ================================================ FILE: JSONNeverDieTests/IntTests.swift ================================================ // // IntTests.swift // JSONNeverDie // // Created by 吕文翰 on 15/10/11. // Copyright © 2015年 JohnLui. All rights reserved. // import XCTest class IntTests: BaseTests { func testInt() { XCTAssertNotNil(self.json["int"].int) XCTAssertEqual(self.json["int"].intValue, 10086) } func testIntNil() { XCTAssertNil(self.json["int_nil"].int) XCTAssertEqual(self.json["int_nil"].intValue, 0) } } ================================================ FILE: JSONNeverDieTests/JSONInitTests.swift ================================================ // // JSONInitTests.swift // JSONNeverDie // // Created by 吕文翰 on 15/10/11. // Copyright © 2015年 JohnLui. All rights reserved. // import XCTest @testable import JSONNeverDie class JSONInitTests: BaseTests { func testJSONInitByLiteral() { let jsonFromArray: JSONND = ["love", "you", "guys"] let jsonFromDictionary: JSONND = ["love": ["you": "guys"]] XCTAssertEqual(jsonFromArray.RAWValue, "[\n \"love\",\n \"you\",\n \"guys\"\n]") XCTAssertEqual(jsonFromDictionary.RAWValue, "{\n \"love\" : {\n \"you\" : \"guys\"\n }\n}") } func testJSONInitByParam() { let jsonFromArray = JSONND(array: ["love", "you", "guys"]) let jsonFromDictionary = JSONND(dictionary: ["love": ["you": "guys"]]) XCTAssertEqual(jsonFromArray.RAWValue, "[\n \"love\",\n \"you\",\n \"guys\"\n]") XCTAssertEqual(jsonFromDictionary.RAWValue, "{\n \"love\" : {\n \"you\" : \"guys\"\n }\n}") } func testJSONInitError() { let json = JSONND(string: "haha") XCTAssertNil(json.data) XCTAssertNil(json.RAW) XCTAssertEqual(json.RAWValue, "") } func testJSONInitNil() { let json = JSONND() XCTAssertNil(json.data) XCTAssertNil(json.RAW) XCTAssertEqual(json.RAWValue, "") } func testSomething() { // here is something we need to do to increase coverage } } ================================================ FILE: JSONNeverDieTests/JSONNDModelTests.swift ================================================ // // JSONNDModelTests.swift // JSONNeverDie // // Created by 吕文翰 on 15/10/3. // Copyright © 2015年 JohnLui. All rights reserved. // import XCTest import JSONNeverDie class JSONNDModelTests: BaseTests { var testModel: TestModel! var man: Man! override func setUp() { super.setUp() self.testModel = TestModel(JSONNDObject: self.json["test_model"]) XCTAssertNotNil(self.testModel, "testModel should not be nil!") self.man = Man() XCTAssertFalse(self.man.hello, "JSONNDModel init with nothing should gather init values") } override func tearDown() { // Put teardown code here. This method is called after the invocation of each test method in the class. super.tearDown() } func testModelInitfromJSONString() { let m = Man(fromJSONString: "{\"hello\": true}") XCTAssertTrue(m.hello) } func testModelString() { XCTAssertNotNil(self.testModel.string) XCTAssertEqual(self.testModel.string, "🐳") } func testModelInt() { XCTAssertNotNil(self.testModel.int) XCTAssertEqual(self.testModel.int, 10086) } func testModelDouble() { XCTAssertNotNil(self.testModel.double) XCTAssertEqual(self.testModel.double, 0.01) } func testModelBool() { XCTAssertEqual(self.testModel.hey.man.hello, true) } func testModelJSONStringValue() { let jsonSon: JSONND = ["man": ["hello": true]] let jsonSonSon: JSONND = ["hello": true] XCTAssertEqual(self.testModel.hey.RAWValue, jsonSon.RAWValue) XCTAssertEqual(self.testModel.hey.man.RAWValue, jsonSonSon.RAWValue) } func testModelJSONStringValueNil() { class Model: JSONNDModel {} let model = Model(JSONNDObject: JSONND()) XCTAssertNil(model.RAW) XCTAssertEqual(model.RAWValue, "") } func testModelArrayWithObjects() { print(self.testModel) XCTAssertEqual(self.testModel.array[0].key, 10000) XCTAssertEqual(self.testModel.array[1].key, 10001) XCTAssertEqual(self.testModel.array[2].key, 10002) } func testModelArrayWithValues() { XCTAssertEqual(self.testModel.array_values[0], 20000) XCTAssertEqual(self.testModel.array_values[1], 20001) XCTAssertEqual(self.testModel.array_values[2], 20002) } } ================================================ FILE: JSONNeverDieTests/JSONValueTests.swift ================================================ // // JSONValueTests.swift // JSONNeverDie // // Created by 吕文翰 on 15/10/11. // Copyright © 2015年 JohnLui. All rights reserved. // import XCTest @testable import JSONNeverDie class JSONValueTests: BaseTests { func testJSONValue1() { let jsonSon: JSONND = ["man": ["hello": true]] XCTAssertEqual(self.json["hey"].RAWValue, jsonSon.RAWValue) } func testJSONValue2() { let jsonSonSon: JSONND = ["hello": true] XCTAssertEqual(self.json["hey"]["man"].RAWValue, jsonSonSon.RAWValue) } func testJSONValueNil() { XCTAssertNil(self.json["hey_nil"].RAW) XCTAssertNil(self.json["hey_nil"]["man"].RAW) XCTAssertNil(self.json["hey"]["man_nil"].RAW) XCTAssertEqual(self.json["hey_nil"].RAWValue, "") XCTAssertEqual(self.json["hey_nil"]["man"].RAWValue, "") XCTAssertEqual(self.json["hey"]["man_nil"].RAWValue, "") } } ================================================ FILE: JSONNeverDieTests/ParseJSONTests.swift ================================================ // // ParseJSONTests.swift // JSONNeverDie // // Created by 吕文翰 on 15/10/11. // Copyright © 2015年 JohnLui. All rights reserved. // import XCTest class ParseJSONTests: BaseTests { func testParseJSON() { XCTAssertNotNil(self.json.data, "JSONND.jsonObject should not be nil!") } } ================================================ FILE: JSONNeverDieTests/StringTests.swift ================================================ // // StringTests.swift // JSONNeverDie // // Created by 吕文翰 on 15/10/11. // Copyright © 2015年 JohnLui. All rights reserved. // import XCTest class StringTests: BaseTests { func testString() { XCTAssertNotNil(self.json["string"].string) XCTAssertEqual(self.json["string"].stringValue, "🐳") } func testStringNil() { XCTAssertNil(self.json["string_nil"].string) XCTAssertEqual(self.json["string_nil"].stringValue, "") } } ================================================ FILE: JSONNeverDieTests/TestModel.swift ================================================ // // TestModel.swift // JSONNeverDie // // Created by 吕文翰 on 15/10/3. // Copyright © 2015年 JohnLui. All rights reserved. // import Foundation import JSONNeverDie class TestModel: JSONNDModel { @objc var string = "" @objc var double = 0.0 @objc var int = 0 @objc var array_values = [Int]() @objc var array = [ModelOnlyOneKey]() @objc var hey: Hey! override init(JSONNDObject json: JSONND) { super.init(JSONNDObject: json) for i in json["array_values"].arrayValue { self.array_values.append(i.intValue) } for i in json["array"].arrayValue { self.array.append(ModelOnlyOneKey(JSONNDObject: i)) } self.hey = Hey(JSONNDObject: json["hey"]) } } class ModelOnlyOneKey: JSONNDModel { @objc var key = 0 } class Hey: JSONNDModel { @objc var man: Man! override init(JSONNDObject json: JSONND) { super.init(JSONNDObject: json) self.man = Man(JSONNDObject: json["man"]) } } class Man: JSONNDModel { @objc var hello = false } ================================================ FILE: JSONNeverDieTests/test.json ================================================ { "hey": { "man": { "hello": true } }, "string": "🐳", "array": [ {"key": 10010}, {"key": "🐶"}, {"key": 0.02} ], "array_values": [ 10000, "🙈", 0.03 ], "double": 0.01, "int": 10086, "test_model": { "hey": { "man": { "hello": true } }, "string": "🐳", "array": [ {"key": 10000}, {"key": 10001}, {"key": 10002} ], "array_values": [ 20000, 20001, 20002 ], "double": 0.01, "int": 10086 } } ================================================ FILE: LICENSE ================================================ The MIT License (MIT) Copyright (c) 2015 JohnLui Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: README.md ================================================

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). ### [中文介绍](#中文介绍) ## Example set up a Model: ```swift class People: JSONNDModel { @objc var name = "" } ``` reflex JSON to Model automatic: ```swift let json = JSONND(string: "{\"name\": \"JohnLui\"}") let people = People(JSONNDObject: json) print(people.name) ``` ## Features ### reflection features - [x] JSON to Model reflection automatic - [x] auto reflection with no need of init() - [x] supports multi-level reflection #### [Read the documentation of auto reflection](https://github.com/johnlui/JSONNeverDie/wiki). ### JSON encode / decode features - [x] supports all types: Int, Double, Bool, String, Array - [x] user friendly: Xcode can prompt all available types - [x] provides both Optional-type(Int?) and Original-type(Int) And JSONNeverDie is well tested. ## Requirements * iOS 7.0+ * Swift 4 (Version 3) in current swift4 branch * Swift 3 (Version 2) in swift3 branch * Swift 2.x / Xcode 7 (Version 1.x) in master branch ##Contribution You are welcome to fork and submit pull requests. ##License JSONNeverDie is open-sourced software licensed under the MIT license. # 中文介绍 ## 基本示例 构建一个 Model: ```swift class People: JSONNDModel { @objc var name = "" } ``` 从字符串转换成 JSON 再自动映射为 Model: ```swift let json = JSONND(string: "{\"name\": \"JohnLui\"}") let people = People(JSONNDObject: json) print(people.name) ``` ### [中文文档](https://github.com/johnlui/JSONNeverDie/wiki/%E4%B8%AD%E6%96%87%E6%96%87%E6%A1%A3) ## 参与开源 欢迎提交 issue 和 PR,大门永远向所有人敞开。 ## 开源协议 本项目遵循 MIT 协议开源,具体请查看根目录下的 LICENSE 文件。 ================================================ FILE: Source/JSONND+ArrayLiteralConvertible.swift ================================================ // The MIT License (MIT) // Copyright (c) 2015 JohnLui https://github.com/johnlui // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. // // JSONND+ArrayLiteralConvertible.swift // JSONNeverDie // // Created by 吕文翰 on 15/10/7. // import Foundation // stolen from SwiftyJSON extension JSONND: ExpressibleByArrayLiteral { public init(arrayLiteral elements: Any...) { self.init(JSONdata: elements as AnyObject?) } } ================================================ FILE: Source/JSONND+DictionaryLiteralConvertible.swift ================================================ // The MIT License (MIT) // Copyright (c) 2015 JohnLui https://github.com/johnlui // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. // // JSONND+DictionaryLiteralConvertible.swift // JSONNeverDie // // Created by 吕文翰 on 15/10/7. // import Foundation // stolen from SwiftyJSON extension JSONND: ExpressibleByDictionaryLiteral { public init(dictionaryLiteral elements: (String, Any)...) { let data = elements.reduce([String: Any]()){(dictionary: [String: Any], element:(String, Any)) -> [String: Any] in var d = dictionary d[element.0] = element.1 return d } self.init(JSONdata: data as AnyObject) } } ================================================ FILE: Source/JSONND.swift ================================================ // The MIT License (MIT) // Copyright (c) 2015 JohnLui https://github.com/johnlui // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. // // JSONND.swift // JSONNeverDie // // Created by 吕文翰 on 15/10/7. // import Foundation public struct JSONND { public static var debug = false public var data: Any! public init(string: String, encoding: String.Encoding = String.Encoding.utf8) { do { if let data = string.data(using: encoding) { let d = try JSONSerialization.jsonObject(with: data, options: JSONSerialization.ReadingOptions.allowFragments) self.data = d as AnyObject? } } catch let error as NSError { let e = NSError(domain: "JSONNeverDie.JSONParseError", code: error.code, userInfo: error.userInfo) if JSONND.debug { NSLog(e.localizedDescription) } } } fileprivate init(any: AnyObject) { let j: JSONND = [any] self.data = j.arrayValue.first?.data } internal init(JSONdata: AnyObject!) { self.data = JSONdata } public init() { self.init(JSONdata: nil) } public init(dictionary: [String: Any]) { self.init(any: dictionary as AnyObject) } public init(array: [Any]) { self.init(any: array as AnyObject) } public subscript (index: String) -> JSONND { if let jsonDictionary = self.data as? Dictionary { if let value = jsonDictionary[index] { return JSONND(JSONdata: value) } else { if JSONND.debug { NSLog("JSONNeverDie: No such key '\(index)'") } } } return JSONND(JSONdata: nil) } public var RAW: String? { get { if let _ = self.data { do { let d = try JSONSerialization.data(withJSONObject: self.data, options: .prettyPrinted) return NSString(data: d, encoding: String.Encoding.utf8.rawValue) as String? } catch { return nil } // can not test Errors here. // It seems that NSJSONSerialization.dataWithJSONObject() method dose not support do-try-catch in Swift 2 now. } return nil } } public var RAWValue: String { get { return self.RAW ?? "" } } public var int: Int? { get { if let number = self.data as? NSNumber { return number.intValue } if let number = self.data as? NSString { return number.integerValue } return nil } } public var intValue: Int { get { return self.int ?? 0 } } public var double: Double? { get { if let number = self.data as? NSNumber { return number.doubleValue } if let number = self.data as? NSString { return number.doubleValue } return nil } } public var doubleValue: Double { get { return self.double ?? 0.0 } } public var string: String? { get { return self.data as? String } } public var stringValue: String { get { return self.string ?? "" } } public var bool: Bool? { get { return self.data as? Bool } } public var boolValue: Bool { get { return self.bool ?? false } } public var array: [JSONND]? { get { if let _ = self.data { if let arr = self.data as? Array { var result = Array() for i in arr { result.append(JSONND(JSONdata: i)) } return result } return nil } return nil } } public var arrayValue: [JSONND] { get { return self.array ?? [] } } } ================================================ FILE: Source/JSONNDModel.swift ================================================ // The MIT License (MIT) // Copyright (c) 2015 JohnLui https://github.com/johnlui // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. // // JSONNDModel.swift // JSONNeverDie // // Created by 吕文翰 on 15/10/3. // import Foundation open class JSONNDModel: NSObject { open var JSONNDObject: JSONND? public override init() { super.init() } public init(fromJSONString string: String, encoding: String.Encoding = String.Encoding.utf8) { let jsonnd = JSONND(string: string, encoding: encoding) self.JSONNDObject = jsonnd super.init() self.mapValues() } public init(JSONNDObject json: JSONND) { self.JSONNDObject = json super.init() self.mapValues() } internal func mapValues() { let mirror = Mirror(reflecting: self) for (k, v) in AnyRandomAccessCollection(mirror.children)! { if let key = k, let jSONNDObject = self.JSONNDObject { let json = jSONNDObject[key] var valueWillBeSet: Any? switch v { case _ as String: valueWillBeSet = json.stringValue case _ as Int: valueWillBeSet = json.intValue case _ as Double: valueWillBeSet = json.doubleValue case _ as Bool: valueWillBeSet = json.boolValue default: continue } self.setValue(valueWillBeSet, forKey: key) } } } open var RAW: String? { get { return self.JSONNDObject?.RAW } } open var RAWValue: String { get { return self.RAW ?? "" } } }