diff --git a/Reflect.xcodeproj/xcuserdata/marcosun.xcuserdatad/xcschemes/Reflect.xcscheme b/Reflect.xcodeproj/xcuserdata/marcosun.xcuserdatad/xcschemes/Reflect.xcscheme new file mode 100644 index 0000000..b99fb17 --- /dev/null +++ b/Reflect.xcodeproj/xcuserdata/marcosun.xcuserdatad/xcschemes/Reflect.xcscheme @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Reflect.xcodeproj/xcuserdata/marcosun.xcuserdatad/xcschemes/xcschememanagement.plist b/Reflect.xcodeproj/xcuserdata/marcosun.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..c77f066 --- /dev/null +++ b/Reflect.xcodeproj/xcuserdata/marcosun.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,27 @@ + + + + + SchemeUserState + + Reflect.xcscheme + + orderHint + 0 + + + SuppressBuildableAutocreation + + 89B833691B842549002C60EB + + primary + + + 89B8337E1B84254A002C60EB + + primary + + + + + diff --git a/Reflect/Reflect/Dict2Model/Reflect+Parse.swift b/Reflect/Reflect/Dict2Model/Reflect+Parse.swift index 706fc23..768fbca 100755 --- a/Reflect/Reflect/Dict2Model/Reflect+Parse.swift +++ b/Reflect/Reflect/Dict2Model/Reflect+Parse.swift @@ -66,7 +66,18 @@ extension Reflect{ model.setValue(dict[key]?.boolValue, forKeyPath: name) }else{ - model.setValue(dict[key], forKeyPath: name) + + var dictValue = dict[key] + + if let tmp = dictValue { + + if tmp.isEqual(NSNull.init()) { + + dictValue = nil + } + } + + model.setValue(dictValue, forKeyPath: name) } @@ -75,7 +86,16 @@ extension Reflect{ //这里是模型 //首选判断字典中是否有值 - let dictValue = dict[key] + + var dictValue = dict[key] + + if let tmp = dictValue { + + if tmp.isEqual(NSNull.init()) { + + dictValue = nil + } + } if dictValue != nil { //字典中有模型