Skip to content

Commit bf8134e

Browse files
authored
Merge pull request #96 from kashifshaikh/master
Adding support for Swift 4 Codable
2 parents d6f592d + 17c177b commit bf8134e

File tree

2 files changed

+119
-0
lines changed

2 files changed

+119
-0
lines changed

JSONExport.xcodeproj/project.pbxproj

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
01ACC24B1FBB42E300C410C2 /* Swift-Codable.json in Resources */ = {isa = PBXBuildFile; fileRef = 01ACC24A1FBB42E300C410C2 /* Swift-Codable.json */; };
1011
166AF5CE1CEF6C3600516EDD /* Swift-Struct-Gloss.json in Resources */ = {isa = PBXBuildFile; fileRef = 166AF5CD1CEF6C3600516EDD /* Swift-Struct-Gloss.json */; };
1112
608896441CF278440074CB80 /* Author.swift in Sources */ = {isa = PBXBuildFile; fileRef = 608896431CF278440074CB80 /* Author.swift */; };
1213
60FB8FF01B9B361600290979 /* Java-Android Realm.json in Resources */ = {isa = PBXBuildFile; fileRef = 60FB8FE61B9B361600290979 /* Java-Android Realm.json */; };
@@ -45,6 +46,7 @@
4546
/* End PBXBuildFile section */
4647

4748
/* Begin PBXFileReference section */
49+
01ACC24A1FBB42E300C410C2 /* Swift-Codable.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = "Swift-Codable.json"; path = "Supported Languages/Swift-Codable.json"; sourceTree = "<group>"; };
4850
166AF5CD1CEF6C3600516EDD /* Swift-Struct-Gloss.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = "Swift-Struct-Gloss.json"; path = "Supported Languages/Swift-Struct-Gloss.json"; sourceTree = "<group>"; };
4951
608896431CF278440074CB80 /* Author.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Author.swift; sourceTree = "<group>"; };
5052
60FB8FE61B9B361600290979 /* Java-Android Realm.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = "Java-Android Realm.json"; path = "Supported Languages/Java-Android Realm.json"; sourceTree = "<group>"; };
@@ -165,6 +167,7 @@
165167
60FB8FED1B9B361600290979 /* Swift-Mappable.json */,
166168
60FB8FEE1B9B361600290979 /* Swift-Struct.json */,
167169
98978FC01D5B6B19000C1846 /* Swift-Struct-Unbox.json */,
170+
01ACC24A1FBB42E300C410C2 /* Swift-Codable.json */,
168171
60FB8FEF1B9B361600290979 /* SwiftyJSON-Class.json */,
169172
);
170173
name = "Supported Languages";
@@ -284,6 +287,7 @@
284287
isa = PBXResourcesBuildPhase;
285288
buildActionMask = 2147483647;
286289
files = (
290+
01ACC24B1FBB42E300C410C2 /* Swift-Codable.json in Resources */,
287291
60FB8FF51B9B361600290979 /* Swift-Class.json in Resources */,
288292
60FB8FF01B9B361600290979 /* Java-Android Realm.json in Resources */,
289293
A329A7ED1D5DA1ED00FB59E8 /* Java-Android Gson.json in Resources */,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
{
2+
"modelStart": "{\n",
3+
"importForEachCustomType": "",
4+
"reservedKeywords": [
5+
"abstract",
6+
"assert",
7+
"boolean",
8+
"break",
9+
"byte",
10+
"case",
11+
"catch",
12+
"char",
13+
"class",
14+
"const",
15+
"continue",
16+
"default",
17+
"do",
18+
"double",
19+
"else",
20+
"enum",
21+
"extends",
22+
"false",
23+
"final",
24+
"finally",
25+
"float",
26+
"for",
27+
"goto",
28+
"if",
29+
"implements",
30+
"import",
31+
"instanceof",
32+
"int",
33+
"interface",
34+
"long",
35+
"native",
36+
"new",
37+
"null",
38+
"package",
39+
"private",
40+
"protected",
41+
"public",
42+
"return",
43+
"short",
44+
"static",
45+
"strictfp",
46+
"super",
47+
"switch",
48+
"synchronized",
49+
"this",
50+
"throw",
51+
"throws",
52+
"transient",
53+
"true",
54+
"try",
55+
"void",
56+
"volatile",
57+
"while",
58+
"class",
59+
"description"
60+
],
61+
"booleanGetter": "",
62+
"briefDescription": "Defines how your JSON objects can be mapped to Swift structures using the built-in NSJSONSerialization class",
63+
"utilityMethods": [
64+
],
65+
"dataTypes": {
66+
"stringType": "String",
67+
"boolType": "Bool",
68+
"floatType": "Float",
69+
"doubleType": "Double",
70+
"characterType": "Character",
71+
"longType": "Double",
72+
"intType": "Int"
73+
},
74+
"wordsToRemoveToGetArrayElementsType": [
75+
"[",
76+
"]"
77+
],
78+
"constructors": [
79+
{
80+
"fetchBasicTypeWithSpecialNeedsPropertyFromMap": "",
81+
"bodyStart": "{\n",
82+
"body": "",
83+
"bodyEnd": "\t}\n",
84+
"fetchBasicTypePropertyFromMap": "\t\tcase <!VarName!> = \"<!JsonKeyName!>\"\n",
85+
"signature": "\tenum CodingKeys: String, CodingKey ",
86+
"fetchArrayOfCustomTypePropertyFromMap": "\t\tcase <!VarName!> = \"<!JsonKeyName!>\"\n",
87+
"comment": "",
88+
"fetchCustomTypePropertyFromMap": "\t\tcase <!VarName!>\n"
89+
},
90+
{
91+
"fetchBasicTypeWithSpecialNeedsPropertyFromMap": "",
92+
"bodyStart": "{\n\t\tlet values = try decoder.container(keyedBy: CodingKeys.self)\n",
93+
"bodyEnd": "\t}\n",
94+
"fetchBasicTypePropertyFromMap": "\t\t<!VarName!> = try values.decodeIfPresent(<!VarType!>.self, forKey: .<!VarName!>)\n",
95+
"signature": "\tinit(from decoder: Decoder) throws ",
96+
"fetchArrayOfCustomTypePropertyFromMap": "\t\t<!VarName!> = try values.decodeIfPresent(<!VarType!>.self, forKey: .<!VarName!>)\n",
97+
"comment": "",
98+
"fetchCustomTypePropertyFromMap": "\t\t<!VarName!> = try <!VarType!>(from: decoder)\n"
99+
}
100+
],
101+
"modelDefinition": "\nstruct <!ModelName!> : Codable ",
102+
"genericType": "AnyObject",
103+
"getter": "",
104+
"setter": "",
105+
"fileExtension": "swift",
106+
"arrayType": "[<!ElementType!>]",
107+
"basicTypesWithSpecialFetchingNeeds": [
108+
],
109+
"displayLangName": "Swift - Struct - Codable",
110+
"instanceVarDefinition": "\tlet <!VarName!> : <!VarType!>?\n",
111+
"supportsFirstLineStatement": "false",
112+
"modelEnd": "\n}",
113+
"staticImports": "import Foundation",
114+
"langName": "Swift"
115+
}

0 commit comments

Comments
 (0)