File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -10,21 +10,19 @@ extension MapInitializable {
1010 throw MapError . cannotInitialize ( type: Self . self, from: try type ( of: map. get ( ) ) )
1111 }
1212
13- self = try createInstance ( )
14- let info = try typeInfo ( of: Self . self)
15-
16- for property in info. properties {
13+ self = try createInstance ( ) { property in
1714 guard let initializable = property. type as? MapInitializable . Type else {
1815 throw MapError . notMapInitializable ( property. type)
1916 }
17+
2018 switch dictionary [ property. name] ?? . null {
2119 case . null:
2220 guard let expressibleByNilLiteral = property. type as? ExpressibleByNilLiteral . Type else {
2321 throw RuntimeReflectionError . requiredValueMissing ( key: property. name)
2422 }
25- try property . set ( value : expressibleByNilLiteral. init ( nilLiteral: ( ) ) , on : & self )
23+ return expressibleByNilLiteral. init ( nilLiteral: ( ) )
2624 case let x:
27- try property . set ( value : initializable. init ( map: x) , on : & self )
25+ return try initializable. init ( map: x)
2826 }
2927 }
3028 }
You can’t perform that action at this time.
0 commit comments