0001    // The MIT License (MIT)
0002    
0003    // Copyright (c) 2015 JohnLui <wenhanlv@gmail.com> https://github.com/johnlui
0004    
0005    // Permission is hereby granted, free of charge, to any person obtaining a copy
0006    // of this software and associated documentation files (the "Software"), to deal
0007    // in the Software without restriction, including without limitation the rights
0008    // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
0009    // copies of the Software, and to permit persons to whom the Software is
0010    // furnished to do so, subject to the following conditions:
0011    
0012    // The above copyright notice and this permission notice shall be included in all
0013    // copies or substantial portions of the Software.
0014    
0015    // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0016    // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0017    // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
0018    // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
0019    // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
0020    // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
0021    // SOFTWARE.
0022    //
0023    //  JSONNDModel.swift
0024    //  JSONNeverDie
0025    //
0026    //  Created by 吕文翰 on 15/10/3.
0027    //
0028    
0029    import Foundation
0030    
0031    public class JSONNDModel: NSObject {
0032        
0033        public var JSONNDObject
JSONNDModel.swift:36
        self.JSONNDObject = json
JSONNDModel.swift:42
                let json = self.JSONNDObject[key]
JSONNDModel.swift:67
            return self.JSONNDObject?.RAW
: JSONND! 0034 0035 public required init(JSONNDObject json: JSONND) { 0036 self.JSONNDObject = json 0037 super.init() 0038 0039 let mirror = Mirror(reflecting: self) 0040 for (k, v) in AnyRandomAccessCollection(mirror.children)! { 0041 if let key = k { 0042 let json = self.JSONNDObject[key] 0043 var valueWillBeSet: AnyObject? 0044 switch v { 0045 case _ as String: 0046 valueWillBeSet = json.stringValue 0047 case _ as Int: 0048 valueWillBeSet = json.intValue 0049 case _ as Float: 0050 valueWillBeSet = json.floatValue 0051 case _ as Bool: 0052 valueWillBeSet = json.boolValue 0053 default: 0054 break 0055 } 0056 self.setValue(valueWillBeSet, forKey: key) 0057 } 0058 } 0059 } 0060 0061 @available (*, unavailable, renamed="RAW") 0062 public var jsonString: String? { 0063 return "" 0064 } 0065 public var RAW
JSONNDModel.swift:76
            return self.RAW ?? ""
: String? { 0066 get { 0067 return self.JSONNDObject?.RAW 0068 } 0069 } 0070 @available (*, unavailable, renamed="RAWValue") 0071 public var jsonStringValue: String { 0072 return "" 0073 } 0074 public var RAWValue: String { 0075 get { 0076 return self.RAW ?? "" 0077 } 0078 } 0079 } 0080