From c5a4da49eb58b4c578d4ea1292490e6f8aa84ad6 Mon Sep 17 00:00:00 2001 From: superk Date: Mon, 27 Nov 2017 09:44:58 +0800 Subject: [PATCH 01/21] fix a complier error in SwiftyJSON - Class --- JSONExport/Supported Languages/SwiftyJSON-Class.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/JSONExport/Supported Languages/SwiftyJSON-Class.json b/JSONExport/Supported Languages/SwiftyJSON-Class.json index 9159910..af485bf 100755 --- a/JSONExport/Supported Languages/SwiftyJSON-Class.json +++ b/JSONExport/Supported Languages/SwiftyJSON-Class.json @@ -77,7 +77,7 @@ "forEachCustomTypeProperty": "\t\tif != nil{\n\t\t\tdictionary[\"\"] = .toDictionary()\n\t\t}\n", "forEachArrayOfCustomTypeProperty": "\t\tif != nil{\n\t\t\tvar dictionaryElements = [[String:Any]]()\n\t\t\tfor Element in {\n\t\t\t\tdictionaryElements.append(Element.toDictionary())\n\t\t\t}\n\t\t\tdictionary[\"\"] = dictionaryElements\n\t\t}\n", "returnStatement": "\t\treturn dictionary\n", - "body": "\t\tlet dictionary = [String:Any]()\n", + "body": "\t\tvar dictionary = [String:Any]()\n", "comment": "\t/**\n\t * Returns all the available property values in the form of [String:Any] object where the key is the approperiate json key and the value is the value of the corresponding property\n\t */\n", "bodyStart": "\n\t{\n" }, From 779a06f5dcb26c02cd0b9e48edfa725de1986b72 Mon Sep 17 00:00:00 2001 From: Serhii Londar Date: Wed, 13 Dec 2017 18:33:54 +0200 Subject: [PATCH 02/21] Migrate to Swift 4 --- JSONExport.xcodeproj/project.pbxproj | 4 +-- .../UserInterfaceState.xcuserstate | Bin 0 -> 33880 bytes .../xcschemes/xcschememanagement.plist | 14 ++++++++++ JSONExport/FilePreviewCell.swift | 16 +++++------ JSONExport/ViewController.swift | 26 ++++++++---------- 5 files changed, 36 insertions(+), 24 deletions(-) create mode 100644 JSONExport.xcodeproj/project.xcworkspace/xcuserdata/serhii-londar.xcuserdatad/UserInterfaceState.xcuserstate create mode 100644 JSONExport.xcodeproj/xcuserdata/serhii-londar.xcuserdatad/xcschemes/xcschememanagement.plist diff --git a/JSONExport.xcodeproj/project.pbxproj b/JSONExport.xcodeproj/project.pbxproj index c4f6227..ff07a60 100755 --- a/JSONExport.xcodeproj/project.pbxproj +++ b/JSONExport.xcodeproj/project.pbxproj @@ -447,7 +447,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "JSONExport/JSONExport-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.0; }; name = Debug; }; @@ -462,7 +462,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "ahmed.ali.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "JSONExport/JSONExport-Bridging-Header.h"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.0; }; name = Release; }; diff --git a/JSONExport.xcodeproj/project.xcworkspace/xcuserdata/serhii-londar.xcuserdatad/UserInterfaceState.xcuserstate b/JSONExport.xcodeproj/project.xcworkspace/xcuserdata/serhii-londar.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000000000000000000000000000000000000..46a37a2a6429fceb6e602df7564f20c3eae1a6b3 GIT binary patch literal 33880 zcmeIb2Ygh;_BcLs%ZBt#+w^2No8BuS)N}}>Zz`L@CfOuQlHIT+Ar!qA5fo66rW6GN zQUt+5mnIf0C`uJU1OWvLqSz7noqKO~lThCCef#_W$$paDy)$#>%$zf)OgU56-l{Pe zV`Gmaj0i*`3eiX;DiM`d1a_$P28~Wz5vZ#hudX*5Dg#ye`eqHhE(tX1+MN-ev2u$O zK8LK(0OW#PksAs^!6*cUqA(PWB2Ww(h?3DDl!6LSAu2+}NP$XFDJnzdr~*}@S~L!+ zkq)(^2}q9&$cQ=-i>9F&=y9|FEkujZV)PPv8NGsDMO)D}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}$g*Ob0fdacZ*Y)IL#ve9J) zWkqm5Y-O3Utfp*SnXXJe)Y~>@BGb(3SK2bTZa(?Bi$~BcQR&K7`Qu$Kl-pa$3M=Fn2o~Zn!@=WEq$_tg( zD{oZ(Qu$lu&C0*V;<40N(b%Z5xnuQX7mwXD_JYz{DN%YWeU(yWkTOIWu8dR;Q4Uw8 zD$|t(%3@`yvO=j;Rx4YS9m+?P3zbhRmnxrCu2im8u2pVOZc^@59#9@szNtKc^|+RL`wmT)m`vdG(6wRn_lR|5g)N z6IGK~GomK9Mp08%Q(040Q(x0qqk;J+ZB1uQSIxsUb7~gUEUsBnv%F??&Dxp`HJfTS z*X*d-UGrAW(VEjWXKOyM`J(1(&9^n**Zf%XQ_Zbfs@C50jA^N9ooTCShiSKIujzp4 z4b$7EW2Td)PfTY_=S=5KUzjd+Sa(EsRCG-1nBB3UV|mAlj`bZ|I<|Hk>Ug)~Xvc|; zQyr%}zU;W#@lD6IjvqR1bo|+IyAyYkopzn}osOLzonf63ozb0for#^vor61vb&lvv o>&)*g>@4mq?X2r;=xprNbWZMMI%o9wuY~YlRMF3UMV*iRKm9qQdH?_b literal 0 HcmV?d00001 diff --git a/JSONExport.xcodeproj/xcuserdata/serhii-londar.xcuserdatad/xcschemes/xcschememanagement.plist b/JSONExport.xcodeproj/xcuserdata/serhii-londar.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..1ccfc36 --- /dev/null +++ b/JSONExport.xcodeproj/xcuserdata/serhii-londar.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + JSONExport.xcscheme + + orderHint + 0 + + + + diff --git a/JSONExport/FilePreviewCell.swift b/JSONExport/FilePreviewCell.swift index e31d04c..f4d9a77 100755 --- a/JSONExport/FilePreviewCell.swift +++ b/JSONExport/FilePreviewCell.swift @@ -35,14 +35,14 @@ class FilePreviewCell: NSTableCellView, NSTextViewDelegate { } if self.file.includeConstructors{ - self.constructors.state = NSOnState + self.constructors.state = .on }else{ - self.constructors.state = NSOffState + self.constructors.state = .off } if self.file.includeUtilities{ - self.utilities.state = NSOnState + self.utilities.state = .on }else{ - self.utilities.state = NSOffState + self.utilities.state = .off } } }else{ @@ -70,14 +70,14 @@ class FilePreviewCell: NSTableCellView, NSTextViewDelegate { scrollView.hasVerticalRuler = true scrollView.verticalRulerView = lineNumberView scrollView.rulersVisible = true - textView.font = NSFont.userFixedPitchFont(ofSize: NSFont.smallSystemFontSize()) + textView.font = NSFont.userFixedPitchFont(ofSize: NSFont.smallSystemFontSize) } @IBAction func toggleConstructors(_ sender: NSButtonCell) { if file != nil{ - file.includeConstructors = (sender.state == NSOnState) + file.includeConstructors = (sender.state == NSControl.StateValue.on) textView.string = file.toString() } @@ -86,13 +86,13 @@ class FilePreviewCell: NSTableCellView, NSTextViewDelegate { @IBAction func toggleUtilityMethods(_ sender: NSButtonCell) { if file != nil{ - file.includeUtilities = (sender.state == NSOnState) + file.includeUtilities = (sender.state == NSControl.StateValue.on) textView.string = file.toString() } } func textDidChange(_ notification: Notification) { - file.fileContent = textView.string ?? file.fileContent + file.fileContent = textView.string } diff --git a/JSONExport/ViewController.swift b/JSONExport/ViewController.swift index 6e55e7a..72bb3b2 100755 --- a/JSONExport/ViewController.swift +++ b/JSONExport/ViewController.swift @@ -119,7 +119,7 @@ class ViewController: NSViewController, NSUserNotificationCenterDelegate, NSTabl scrollView.hasVerticalRuler = true scrollView.verticalRulerView = lineNumberView scrollView.rulersVisible = true - sourceText.font = NSFont.userFixedPitchFont(ofSize: NSFont.smallSystemFontSize()) + sourceText.font = NSFont.userFixedPitchFont(ofSize: NSFont.smallSystemFontSize) } @@ -185,7 +185,7 @@ class ViewController: NSViewController, NSUserNotificationCenterDelegate, NSTabl { let jsonString = String(data: jsonData, encoding: .utf8) - sourceText.string = jsonString + sourceText.string = jsonString! } //MARK: - Handlind events @@ -199,8 +199,8 @@ class ViewController: NSViewController, NSUserNotificationCenterDelegate, NSTabl oPanel.allowedFileTypes = ["json","JSON"] oPanel.prompt = "Choose JSON file" - oPanel.beginSheetModal(for: self.view.window!, completionHandler: { (button : Int) -> Void in - if button == NSFileHandlingPanelOKButton{ + oPanel.beginSheetModal(for: self.view.window!) { (button) in + if button.rawValue == NSFileHandlingPanelOKButton { let jsonPath = oPanel.urls.first!.path let fileHandle = FileHandle(forReadingAtPath: jsonPath) @@ -209,7 +209,7 @@ class ViewController: NSViewController, NSUserNotificationCenterDelegate, NSTabl self.parseJSONData(jsonData: (fileHandle!.readDataToEndOfFile() as NSData!) as Data!) } - }) + } } @@ -286,14 +286,12 @@ class ViewController: NSViewController, NSUserNotificationCenterDelegate, NSTabl openPanel.canChooseDirectories = true openPanel.canCreateDirectories = true openPanel.prompt = "Choose" - openPanel.beginSheetModal(for: self.view.window!, completionHandler: { (button : Int) -> Void in - if button == NSFileHandlingPanelOKButton{ - + openPanel.beginSheetModal(for: self.view.window!) { button in + if button.rawValue == NSFileHandlingPanelOKButton{ self.saveToPath(openPanel.url!.path) - self.showDoneSuccessfully() } - }) + } } @@ -386,7 +384,7 @@ class ViewController: NSViewController, NSUserNotificationCenterDelegate, NSTabl func generateClasses() { saveButton.isEnabled = false - var str = sourceText.string! + var str = sourceText.string if str.characters.count == 0{ runOnUiThread{ @@ -455,8 +453,8 @@ class ViewController: NSViewController, NSUserNotificationCenterDelegate, NSTabl func prepareAndGetFilesBuilder() -> FilesContentBuilder { let filesBuilder = FilesContentBuilder.instance - filesBuilder.includeConstructors = (generateConstructors.state == NSOnState) - filesBuilder.includeUtilities = (generateUtilityMethods.state == NSOnState) + filesBuilder.includeConstructors = (generateConstructors.state == .on) + filesBuilder.includeUtilities = (generateUtilityMethods.state == .on) filesBuilder.firstLine = firstLineField.stringValue filesBuilder.lang = selectedLang! filesBuilder.classPrefix = classPrefixField.stringValue @@ -477,7 +475,7 @@ class ViewController: NSViewController, NSUserNotificationCenterDelegate, NSTabl //MARK: - NSTableViewDelegate func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? { - let cell = tableView.make(withIdentifier: "fileCell", owner: self) as! FilePreviewCell + let cell = tableView.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "fileCell"), owner: self) as! FilePreviewCell let file = files[row] cell.file = file From e40b25831ea6048626d2556b0146ff877dcb846c Mon Sep 17 00:00:00 2001 From: Muhammad Umer Date: Tue, 26 Dec 2017 11:23:05 +0500 Subject: [PATCH 03/21] Added Swift-Codable-Struct with forced unwrapped option --- JSONExport/FileRepresenter.swift | 2 +- JSONExport/HeaderFileRepresenter.swift | 2 +- JSONExport/Swift-Codable-Unwrapped.json | 105 ++++++++++++++++++++++++ JSONExport/ViewController.swift | 4 +- 4 files changed, 109 insertions(+), 4 deletions(-) create mode 100644 JSONExport/Swift-Codable-Unwrapped.json diff --git a/JSONExport/FileRepresenter.swift b/JSONExport/FileRepresenter.swift index b26a80e..96d286f 100755 --- a/JSONExport/FileRepresenter.swift +++ b/JSONExport/FileRepresenter.swift @@ -189,7 +189,7 @@ class FileRepresenter{ fileContent += ". All rights reserved.\n" } - fileContent += "//\tModel file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport" + // fileContent += "//\tModel file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport" if let langAuthor = lang.author{ fileContent += "\n\n//\tThe \"\(lang.displayLangName!)\" support has been made available by \(langAuthor.name!)" diff --git a/JSONExport/HeaderFileRepresenter.swift b/JSONExport/HeaderFileRepresenter.swift index c819679..dde5b12 100755 --- a/JSONExport/HeaderFileRepresenter.swift +++ b/JSONExport/HeaderFileRepresenter.swift @@ -109,7 +109,7 @@ class HeaderFileRepresenter : FileRepresenter{ } fileContent += ". All rights reserved.\n//\n\n" - fileContent += "//\tModel file Generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport\n\n" + //fileContent += "//\tModel file Generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport\n\n" } } diff --git a/JSONExport/Swift-Codable-Unwrapped.json b/JSONExport/Swift-Codable-Unwrapped.json new file mode 100644 index 0000000..9b1a0a4 --- /dev/null +++ b/JSONExport/Swift-Codable-Unwrapped.json @@ -0,0 +1,105 @@ +{ + "modelStart": "{\n", + "importForEachCustomType": "", + "reservedKeywords": [ + "abstract", + "assert", + "boolean", + "break", + "byte", + "case", + "catch", + "char", + "class", + "const", + "continue", + "default", + "do", + "double", + "else", + "enum", + "extends", + "false", + "final", + "finally", + "float", + "for", + "goto", + "if", + "implements", + "import", + "instanceof", + "int", + "interface", + "long", + "native", + "new", + "null", + "package", + "private", + "protected", + "public", + "return", + "short", + "static", + "strictfp", + "super", + "switch", + "synchronized", + "this", + "throw", + "throws", + "transient", + "true", + "try", + "void", + "volatile", + "while", + "class", + "description" + ], + "booleanGetter": "", + "briefDescription": "Defines how your JSON objects can be mapped to Swift structures using the built-in NSJSONSerialization class", + "utilityMethods": [ + ], + "dataTypes": { + "stringType": "String", + "boolType": "Bool", + "floatType": "Float", + "doubleType": "Double", + "characterType": "Character", + "longType": "Double", + "intType": "Int" + }, + "wordsToRemoveToGetArrayElementsType": [ + "[", + "]" + ], + "constructors": [ + { + "fetchBasicTypeWithSpecialNeedsPropertyFromMap": "", + "bodyStart": "{\n", + "body": "", + "bodyEnd": "\t}\n", + "fetchBasicTypePropertyFromMap": "\t\tcase = \"\"\n", + "signature": "\tenum CodingKeys: String, CodingKey ", + "fetchArrayOfCustomTypePropertyFromMap": "\t\tcase = \"\"\n", + "comment": "", + "fetchCustomTypePropertyFromMap": "\t\tcase \n" + } + ], + "modelDefinition": "\nstruct : Codable ", + "genericType": "AnyObject", + "getter": "", + "setter": "", + "fileExtension": "swift", + "arrayType": "[]", + "basicTypesWithSpecialFetchingNeeds": [ + ], + "displayLangName": "Swift - Struct - Codable - Unwrapped", + "instanceVarDefinition": "\tlet : \n", + "supportsFirstLineStatement": "false", + "modelEnd": "\n}", + "staticImports": "import Foundation", + "langName": "Swift" +} diff --git a/JSONExport/ViewController.swift b/JSONExport/ViewController.swift index 6e55e7a..bd6c0ae 100755 --- a/JSONExport/ViewController.swift +++ b/JSONExport/ViewController.swift @@ -388,7 +388,7 @@ class ViewController: NSViewController, NSUserNotificationCenterDelegate, NSTabl saveButton.isEnabled = false var str = sourceText.string! - if str.characters.count == 0{ + if str.count == 0{ runOnUiThread{ //Nothing to do, just clear any generated files self.files.removeAll(keepingCapacity: false) @@ -397,7 +397,7 @@ class ViewController: NSViewController, NSUserNotificationCenterDelegate, NSTabl return; } var rootClassName = classNameField.stringValue - if rootClassName.characters.count == 0{ + if rootClassName.count == 0{ rootClassName = "RootClass" } sourceText.isEditable = false From 2f8ba428bd660d0360d5e96af2d929ff7c39e644 Mon Sep 17 00:00:00 2001 From: Muhammad Umer Date: Tue, 26 Dec 2017 11:29:29 +0500 Subject: [PATCH 04/21] added back credit file --- JSONExport/FileRepresenter.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/JSONExport/FileRepresenter.swift b/JSONExport/FileRepresenter.swift index 96d286f..b26a80e 100755 --- a/JSONExport/FileRepresenter.swift +++ b/JSONExport/FileRepresenter.swift @@ -189,7 +189,7 @@ class FileRepresenter{ fileContent += ". All rights reserved.\n" } - // fileContent += "//\tModel file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport" + fileContent += "//\tModel file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport" if let langAuthor = lang.author{ fileContent += "\n\n//\tThe \"\(lang.displayLangName!)\" support has been made available by \(langAuthor.name!)" From df54d97f7d883ce3794908fa408867abefc0698a Mon Sep 17 00:00:00 2001 From: Ankush Kushwaha Date: Mon, 12 Feb 2018 14:58:27 +0200 Subject: [PATCH 05/21] Change generic type from 'AnyObject' to 'String' -> Fixes #105 In Swift-Struct-Codable format 'decodeIfPresent' cannot produce value of type 'Anyobject'. So changing geberic-type from 'AnyObject'to 'String' for null json values will allow to compile the xcode project Fixes #105 --- JSONExport/Supported Languages/Swift-Codable.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/JSONExport/Supported Languages/Swift-Codable.json b/JSONExport/Supported Languages/Swift-Codable.json index 90592fe..69b11f2 100755 --- a/JSONExport/Supported Languages/Swift-Codable.json +++ b/JSONExport/Supported Languages/Swift-Codable.json @@ -99,7 +99,7 @@ } ], "modelDefinition": "\nstruct : Codable ", - "genericType": "AnyObject", + "genericType": "String", "getter": "", "setter": "", "fileExtension": "swift", From 8528d6a1c6bc572ba9dd01592815e0743f8c02c5 Mon Sep 17 00:00:00 2001 From: Yasuaki Tamura Date: Sat, 3 Mar 2018 16:45:08 +0900 Subject: [PATCH 06/21] Java Gson for Android: Fix method name to be "optString" instead of "opt" to get String type value from JSONObject in constructor. --- .gitignore | 31 +++++++++++++++++++ .../Java-Android Gson.json | 6 ++-- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index b51e80e..1305bc9 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,34 @@ JSONExport.xcodeproj/xcuserdata/ahmed.xcuserdatad/xcdebugger/Breakpoints_v2.xcbk JSONExport.xcodeproj/project.xcworkspace/xcuserdata/ahmedali.xcuserdatad/UserInterfaceState.xcuserstate JSONExport.xcodeproj/xcuserdata/ahmedali.xcuserdatad/xcschemes/JSONExport.xcscheme JSONExport.xcodeproj/xcuserdata/ahmedali.xcuserdatad/xcschemes/xcschememanagement.plist + + +# OS X Finder +.DS_Store +.LSOverride + +# Xcode per-user config +*.mode1 +*.mode1v3 +*.mode2v3 +*.perspective +*.perspectivev3 +*.pbxuser +#*.xcworkspace +xcuserdata + + +# Build products +build/ +*.o +*.LinkFileList +*.hmap + +# Automatic backup files +*~.nib/ +*.swp +*~ +*.dat +*.dep + +Breakpoints.xcbkptlist diff --git a/JSONExport/Supported Languages/Java-Android Gson.json b/JSONExport/Supported Languages/Java-Android Gson.json index ed1e58d..58a9e7b 100755 --- a/JSONExport/Supported Languages/Java-Android Gson.json +++ b/JSONExport/Supported Languages/Java-Android Gson.json @@ -36,8 +36,8 @@ "String" ], "basicTypesWithSpecialFetchingNeedsReplacements" : [ - - "","" + "", + "String" ], "constructors": [ { @@ -66,4 +66,4 @@ "returnStatement": "\t\t} catch (JSONException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn jsonObject;\n" } ] -} \ No newline at end of file +} From 02a96ed98549b42f0544398e77c5eed1c1d2e23a Mon Sep 17 00:00:00 2001 From: Yasuaki Tamura Date: Sat, 3 Mar 2018 18:56:02 +0900 Subject: [PATCH 07/21] Fix: float type issue --- JSONExport/FileRepresenter.swift | 35 ++++++++++++++++++- JSONExport/LangModel.swift | 2 ++ JSONExport/SharedConstants.swift | 1 + .../Java-Android Gson.json | 13 +++++-- 4 files changed, 47 insertions(+), 4 deletions(-) diff --git a/JSONExport/FileRepresenter.swift b/JSONExport/FileRepresenter.swift index b26a80e..2906259 100755 --- a/JSONExport/FileRepresenter.swift +++ b/JSONExport/FileRepresenter.swift @@ -372,7 +372,18 @@ class FileRepresenter{ if let index = lang.basicTypesWithSpecialFetchingNeeds.index(of: property.type), let replacement = lang.basicTypesWithSpecialFetchingNeedsReplacements?[index]{ propertyHandlingStr = propertyHandlingStr.replacingOccurrences(of: varTypeReplacement, with: replacement) - + var castString = String() + if let cast = lang.basicTypesWithSpecialFetchingNeedsTypeCast?[index]{ + // if needs cast + if !cast.isEmpty { + castString = "(\(cast)) " + } + else { + castString = cast + } + } + propertyHandlingStr = propertyHandlingStr.replacingOccurrences(of: varTypeCast, with: castString) + let lowerCaseType = property.type.lowercased() propertyHandlingStr = propertyHandlingStr.replacingOccurrences(of: lowerCaseVarType, with: lowerCaseType) @@ -468,6 +479,16 @@ class FileRepresenter{ propertyStr = constructor.fetchArrayOfBasicTypePropertyFromMap let replacement = lang.basicTypesWithSpecialFetchingNeedsReplacements[index] propertyStr = propertyStr.replacingOccurrences(of: varTypeReplacement, with: replacement) + + // if needs cast + let cast = lang.basicTypesWithSpecialFetchingNeedsTypeCast[index] + if !cast.isEmpty { + propertyStr = propertyStr.replacingOccurrences(of: varTypeCast, with: "(\(cast)) ") + } + else { + propertyStr = propertyStr.replacingOccurrences(of: varTypeCast, with: cast) + } + }else{ propertyStr = constructor.fetchBasicTypePropertyFromMap } @@ -500,6 +521,18 @@ class FileRepresenter{ propertyStr = propertyStr.replacingOccurrences(of: varTypeReplacement, with: replacement) } + var castString = String() + if let cast = lang.basicTypesWithSpecialFetchingNeedsTypeCast?[index!]{ + // if needs cast + if !cast.isEmpty { + castString = "(\(cast)) " + } + else { + castString = cast + } + } + propertyStr = propertyStr.replacingOccurrences(of: varTypeCast, with: castString) + let lowerCaseType = property.type.lowercased() propertyStr = propertyStr.replacingOccurrences(of: lowerCaseVarType, with: lowerCaseType) diff --git a/JSONExport/LangModel.swift b/JSONExport/LangModel.swift index 46d7504..b78f061 100755 --- a/JSONExport/LangModel.swift +++ b/JSONExport/LangModel.swift @@ -12,6 +12,7 @@ class LangModel{ var arrayType : String! var basicTypesWithSpecialFetchingNeeds : [String]! var basicTypesWithSpecialFetchingNeedsReplacements : [String]! + var basicTypesWithSpecialFetchingNeedsTypeCast : [String]! var basicTypesWithSpecialStoringNeeds : [String]! var booleanGetter : String! var briefDescription : String! @@ -50,6 +51,7 @@ class LangModel{ arrayType = dictionary["arrayType"] as? String basicTypesWithSpecialFetchingNeeds = dictionary["basicTypesWithSpecialFetchingNeeds"] as? [String] basicTypesWithSpecialFetchingNeedsReplacements = dictionary["basicTypesWithSpecialFetchingNeedsReplacements"] as? [String] + basicTypesWithSpecialFetchingNeedsTypeCast = dictionary["basicTypesWithSpecialFetchingNeedsTypeCast"] as? [String] basicTypesWithSpecialStoringNeeds = dictionary["basicTypesWithSpecialStoringNeeds"] as? [String] booleanGetter = dictionary["booleanGetter"] as? String briefDescription = dictionary["briefDescription"] as? String diff --git a/JSONExport/SharedConstants.swift b/JSONExport/SharedConstants.swift index 924e434..83591f7 100755 --- a/JSONExport/SharedConstants.swift +++ b/JSONExport/SharedConstants.swift @@ -39,6 +39,7 @@ let varName = "" let capitalizedVarName = "" let varType = "" let varTypeReplacement = "" +let varTypeCast = "" let capitalizedVarType = "" let lowerCaseVarType = "" let lowerCaseModelName = "" diff --git a/JSONExport/Supported Languages/Java-Android Gson.json b/JSONExport/Supported Languages/Java-Android Gson.json index 58a9e7b..a809019 100755 --- a/JSONExport/Supported Languages/Java-Android Gson.json +++ b/JSONExport/Supported Languages/Java-Android Gson.json @@ -33,11 +33,18 @@ ], "basicTypesWithSpecialFetchingNeeds" : [ "Object", - "String" + "String", + "float" ], "basicTypesWithSpecialFetchingNeedsReplacements" : [ "", - "String" + "String", + "Double" + ], + "basicTypesWithSpecialFetchingNeedsTypeCast" : [ + "", + "", + "float" ], "constructors": [ { @@ -47,7 +54,7 @@ "bodyEnd": "\t}\n", "fetchBasicTypePropertyFromMap": "\t\t = jsonObject.opt(\"\");\n", "fetchArrayOfBasicTypePropertyFromMap" : "\t\tJSONArray Tmp = jsonObject.optJSONArray(\"\");\n\t\tif(Tmp != null){\n\t\t\t = new [Tmp.length()];\n\t\t\tfor(int i = 0; i < Tmp.length(); i++){\n\t\t\t\t[i] = Tmp.get(i);\n\t\t\t}\n\t\t}\n", - "fetchBasicTypeWithSpecialNeedsPropertyFromMap": "\t\t = jsonObject.opt(\"\");\n", + "fetchBasicTypeWithSpecialNeedsPropertyFromMap": "\t\t = jsonObject.opt(\"\");\n", "fetchCustomTypePropertyFromMap": "\t\t = new (jsonObject.optJSONObject(\"\"));\n", "fetchArrayOfCustomTypePropertyFromMap": "\t\tJSONArray JsonArray = jsonObject.optJSONArray(\"\");\n\t\tif(JsonArray != null){\n\t\t\tArrayList<> ArrayList = new ArrayList<>();\n\t\t\tfor (int i = 0; i < JsonArray.length(); i++) {\n\t\t\t\tJSONObject Object = JsonArray.optJSONObject(i);\n\t\t\t\tArrayList.add(new (Object));\n\t\t\t}\n\t\t\t = ([]) ArrayList.toArray();\n\t\t}" } From 4c61a93bc8487a626c8671d2d18fd10adf7283ae Mon Sep 17 00:00:00 2001 From: Brychan Odlum Date: Tue, 2 Oct 2018 00:09:01 -0700 Subject: [PATCH 08/21] Update to Swift 4.2 --- JSONExport.xcodeproj/project.pbxproj | 28 ++++++++-- JSONExport/FileContentBuilder.swift | 2 +- JSONExport/FilePreviewCell.swift | 18 +++---- JSONExport/FileRepresenter.swift | 6 +-- JSONExport/HeaderFileRepresenter.swift | 4 +- JSONExport/StringExtension.swift | 29 +++++----- JSONExport/ViewController.swift | 75 ++++++++++++-------------- 7 files changed, 89 insertions(+), 73 deletions(-) diff --git a/JSONExport.xcodeproj/project.pbxproj b/JSONExport.xcodeproj/project.pbxproj index c4f6227..ab51cdf 100755 --- a/JSONExport.xcodeproj/project.pbxproj +++ b/JSONExport.xcodeproj/project.pbxproj @@ -255,12 +255,12 @@ attributes = { LastSwiftMigration = 0700; LastSwiftUpdateCheck = 0700; - LastUpgradeCheck = 0800; + LastUpgradeCheck = 1000; ORGANIZATIONNAME = "Ahmed Ali"; TargetAttributes = { E2FA87B41A059AC100648EB6 = { CreatedOnToolsVersion = 6.1; - LastSwiftMigration = 0800; + LastSwiftMigration = 1000; }; }; }; @@ -358,14 +358,22 @@ 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; @@ -393,6 +401,7 @@ ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; }; name = Debug; }; @@ -404,14 +413,22 @@ 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; @@ -432,6 +449,7 @@ MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; }; name = Release; }; @@ -447,7 +465,8 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "JSONExport/JSONExport-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = On; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -462,7 +481,8 @@ PRODUCT_BUNDLE_IDENTIFIER = "ahmed.ali.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "JSONExport/JSONExport-Bridging-Header.h"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = On; + SWIFT_VERSION = 4.2; }; name = Release; }; diff --git a/JSONExport/FileContentBuilder.swift b/JSONExport/FileContentBuilder.swift index 0f85698..2ff5f7a 100755 --- a/JSONExport/FileContentBuilder.swift +++ b/JSONExport/FileContentBuilder.swift @@ -338,7 +338,7 @@ class FilesContentBuilder{ str = str.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines) var output = "" var makeNextCharUpperCase = startFromFirstChar - for char in input.characters{ + for char in input { if char == "_" { makeNextCharUpperCase = true }else if makeNextCharUpperCase{ diff --git a/JSONExport/FilePreviewCell.swift b/JSONExport/FilePreviewCell.swift index e31d04c..fafc686 100755 --- a/JSONExport/FilePreviewCell.swift +++ b/JSONExport/FilePreviewCell.swift @@ -35,14 +35,14 @@ class FilePreviewCell: NSTableCellView, NSTextViewDelegate { } if self.file.includeConstructors{ - self.constructors.state = NSOnState + self.constructors.state = NSControl.StateValue.on }else{ - self.constructors.state = NSOffState + self.constructors.state = NSControl.StateValue.off } if self.file.includeUtilities{ - self.utilities.state = NSOnState + self.utilities.state = NSControl.StateValue.on }else{ - self.utilities.state = NSOffState + self.utilities.state = NSControl.StateValue.off } } }else{ @@ -70,14 +70,14 @@ class FilePreviewCell: NSTableCellView, NSTextViewDelegate { scrollView.hasVerticalRuler = true scrollView.verticalRulerView = lineNumberView scrollView.rulersVisible = true - textView.font = NSFont.userFixedPitchFont(ofSize: NSFont.smallSystemFontSize()) + textView.font = NSFont.userFixedPitchFont(ofSize: NSFont.smallSystemFontSize) } @IBAction func toggleConstructors(_ sender: NSButtonCell) { if file != nil{ - file.includeConstructors = (sender.state == NSOnState) + file.includeConstructors = (sender.state == NSControl.StateValue.off) textView.string = file.toString() } @@ -86,14 +86,12 @@ class FilePreviewCell: NSTableCellView, NSTextViewDelegate { @IBAction func toggleUtilityMethods(_ sender: NSButtonCell) { if file != nil{ - file.includeUtilities = (sender.state == NSOnState) + file.includeUtilities = (sender.state == NSControl.StateValue.on) textView.string = file.toString() } } func textDidChange(_ notification: Notification) { - file.fileContent = textView.string ?? file.fileContent + file.fileContent = textView.string } - - } diff --git a/JSONExport/FileRepresenter.swift b/JSONExport/FileRepresenter.swift index b26a80e..f2d35d9 100755 --- a/JSONExport/FileRepresenter.swift +++ b/JSONExport/FileRepresenter.swift @@ -101,7 +101,7 @@ class FileRepresenter{ appendCustomImports() //start the model defination var definition = "" - if lang.modelDefinitionWithParent != nil && parentClassName.characters.count > 0{ + if lang.modelDefinitionWithParent != nil && parentClassName.count > 0{ definition = lang.modelDefinitionWithParent.replacingOccurrences(of: modelName, with: className) definition = definition.replacingOccurrences(of: modelWithParentClassName, with: parentClassName) }else if includeUtilities && lang.defaultParentWithUtilityMethods != nil{ @@ -129,7 +129,7 @@ class FileRepresenter{ */ func appendFirstLineStatement() { - if lang.supportsFirstLineStatement != nil && lang.supportsFirstLineStatement! && firstLine.characters.count > 0{ + if lang.supportsFirstLineStatement != nil && lang.supportsFirstLineStatement! && firstLine.count > 0{ fileContent += "\(firstLine)\n\n" } } @@ -419,7 +419,7 @@ class FileRepresenter{ type = type.replacingOccurrences(of: arrayWord, with: "") } - if type.characters.count == 0{ + if type.count == 0{ type = typeNameForArrayElements(property.sampleValue as! NSArray, lang: lang) } return type diff --git a/JSONExport/HeaderFileRepresenter.swift b/JSONExport/HeaderFileRepresenter.swift index c819679..961373c 100755 --- a/JSONExport/HeaderFileRepresenter.swift +++ b/JSONExport/HeaderFileRepresenter.swift @@ -46,7 +46,7 @@ class HeaderFileRepresenter : FileRepresenter{ //start the model defination var definition = "" - if lang.headerFileData.modelDefinitionWithParent != nil && parentClassName.characters.count > 0{ + if lang.headerFileData.modelDefinitionWithParent != nil && parentClassName.count > 0{ definition = lang.headerFileData.modelDefinitionWithParent.replacingOccurrences(of: modelName, with: className) definition = definition.replacingOccurrences(of: modelWithParentClassName, with: parentClassName) }else if includeUtilities && lang.defaultParentWithUtilityMethods != nil{ @@ -82,7 +82,7 @@ class HeaderFileRepresenter : FileRepresenter{ func appendImportParentHeader() { - if lang.headerFileData.importParentHeaderFile != nil && parentClassName.characters.count > 0{ + if lang.headerFileData.importParentHeaderFile != nil && parentClassName.count > 0{ fileContent += lang.headerFileData.importParentHeaderFile.replacingOccurrences(of: modelWithParentClassName, with: parentClassName) } } diff --git a/JSONExport/StringExtension.swift b/JSONExport/StringExtension.swift index e06b22f..6a3e5ca 100755 --- a/JSONExport/StringExtension.swift +++ b/JSONExport/StringExtension.swift @@ -40,20 +40,21 @@ extension String{ func toSingular() -> String { var singular = self - let length = self.characters.count - if length > 3{ - let range = Range(characters.index(endIndex, offsetBy: -3) ..< endIndex) + let length = self.count + if length > 3 { + let range = self.index(self.endIndex, offsetBy: -3).. 2{ - let range = Range(characters.index(endIndex, offsetBy: -1) ..< endIndex) - let lastChar = self.substring(with: range) + if length > 2 { + let range = self.index(self.endIndex, offsetBy: -1).. String{ - if self.characters.count > 0{ - let range = Range(startIndex ..< characters.index(startIndex, offsetBy: 1)) - let firstLowerChar = self.substring(with: range).lowercased() + if self.count > 0 { + let range = self.startIndex.. String{ - if self.characters.count > 0{ - let range = Range(startIndex ..< characters.index(startIndex, offsetBy: 1)) - let firstUpperChar = self.substring(with: range).uppercased() + if self.count > 0 { + let range = startIndex.. Void in - if button == NSFileHandlingPanelOKButton{ - - let jsonPath = oPanel.urls.first!.path - let fileHandle = FileHandle(forReadingAtPath: jsonPath) - let urlStr:String = oPanel.urls.first!.lastPathComponent - self.classNameField.stringValue = urlStr.replacingOccurrences(of: ".json", with: "") - self.parseJSONData(jsonData: (fileHandle!.readDataToEndOfFile() as NSData!) as Data!) - - } - }) - } + @IBAction func openJSONFiles(sender: AnyObject) + { + let oPanel: NSOpenPanel = NSOpenPanel() + oPanel.canChooseDirectories = false + oPanel.canChooseFiles = true + oPanel.allowsMultipleSelection = false + oPanel.allowedFileTypes = ["json","JSON"] + oPanel.prompt = "Choose JSON file" + + oPanel.beginSheetModal(for: self.view.window!) { button in + if button.rawValue == NSFileHandlingPanelOKButton { + let jsonPath = oPanel.urls.first!.path + let fileHandle = FileHandle(forReadingAtPath: jsonPath) + let urlStr:String = oPanel.urls.first!.lastPathComponent + self.classNameField.stringValue = urlStr.replacingOccurrences(of: ".json", with: "") + self.parseJSONData(jsonData: (fileHandle!.readDataToEndOfFile())) + } + } + } @IBAction func toggleConstructors(_ sender: AnyObject) @@ -286,14 +284,12 @@ class ViewController: NSViewController, NSUserNotificationCenterDelegate, NSTabl openPanel.canChooseDirectories = true openPanel.canCreateDirectories = true openPanel.prompt = "Choose" - openPanel.beginSheetModal(for: self.view.window!, completionHandler: { (button : Int) -> Void in - if button == NSFileHandlingPanelOKButton{ - - self.saveToPath(openPanel.url!.path) - - self.showDoneSuccessfully() - } - }) + openPanel.beginSheetModal(for: self.view.window!){ button in + if button.rawValue == NSFileHandlingPanelOKButton{ + self.saveToPath(openPanel.url!.path) + self.showDoneSuccessfully() + } + } } @@ -386,9 +382,9 @@ class ViewController: NSViewController, NSUserNotificationCenterDelegate, NSTabl func generateClasses() { saveButton.isEnabled = false - var str = sourceText.string! + var str = sourceText.string - if str.characters.count == 0{ + if str.count == 0{ runOnUiThread{ //Nothing to do, just clear any generated files self.files.removeAll(keepingCapacity: false) @@ -397,7 +393,7 @@ class ViewController: NSViewController, NSUserNotificationCenterDelegate, NSTabl return; } var rootClassName = classNameField.stringValue - if rootClassName.characters.count == 0{ + if rootClassName.count == 0{ rootClassName = "RootClass" } sourceText.isEditable = false @@ -411,7 +407,7 @@ class ViewController: NSViewController, NSUserNotificationCenterDelegate, NSTabl var json : NSDictionary! if jsonData is NSDictionary{ //fine nothing to do - json = jsonData as! NSDictionary + json = jsonData as? NSDictionary }else{ json = unionDictionaryFromArrayElements(jsonData as! NSArray) } @@ -455,8 +451,8 @@ class ViewController: NSViewController, NSUserNotificationCenterDelegate, NSTabl func prepareAndGetFilesBuilder() -> FilesContentBuilder { let filesBuilder = FilesContentBuilder.instance - filesBuilder.includeConstructors = (generateConstructors.state == NSOnState) - filesBuilder.includeUtilities = (generateUtilityMethods.state == NSOnState) + filesBuilder.includeConstructors = (generateConstructors.state == NSControl.StateValue.on) + filesBuilder.includeUtilities = (generateUtilityMethods.state == NSControl.StateValue.on) filesBuilder.firstLine = firstLineField.stringValue filesBuilder.lang = selectedLang! filesBuilder.classPrefix = classPrefixField.stringValue @@ -477,7 +473,7 @@ class ViewController: NSViewController, NSUserNotificationCenterDelegate, NSTabl //MARK: - NSTableViewDelegate func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? { - let cell = tableView.make(withIdentifier: "fileCell", owner: self) as! FilePreviewCell + let cell = tableView.makeView(withIdentifier: NSUserInterfaceItemIdentifier("fileCell"), owner: self) as! FilePreviewCell let file = files[row] cell.file = file @@ -487,4 +483,3 @@ class ViewController: NSViewController, NSUserNotificationCenterDelegate, NSTabl } - From 0a3d17f8e4071ad973552db0e8fa08350efeaae4 Mon Sep 17 00:00:00 2001 From: Ahmed Ali Date: Sat, 24 Nov 2018 21:57:04 +0000 Subject: [PATCH 09/21] Updating GHANGELOG.md for release 1.0.9 --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ee3cca..e0089b1 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +* Version 1.0.9 +- Merged PR #88 : Fix minor typo in the README.MD file. Thanks to @AlexxNica +- Merged PR #93 Changed app icon and fix upside down text. Thanks to @narlei +- Merged PR #96 Adding support for Swift 4 Codable. Thanks to @kashifshaikh + * Version 1.0.8 - Merged PR #72 App now remembers what language user selected last time. Thanks to @TParizek - Merged PR #75 Fix Error for Swift in Xcode 8.2.1 and replace NSDictionary. Thanks to @dimohamdy From 30d87853a861327d3bd85cb7ec225bbcff8b8e13 Mon Sep 17 00:00:00 2001 From: Ahmed Ali Date: Sat, 24 Nov 2018 22:02:30 +0000 Subject: [PATCH 10/21] Updating CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e0089b1..b9a6ac1 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +* Version 1.1.0 +- Merged PR #98 : fix a complier error in SwiftyJSON - Class. Thanks to @superk589 + + * Version 1.0.9 - Merged PR #88 : Fix minor typo in the README.MD file. Thanks to @AlexxNica - Merged PR #93 Changed app icon and fix upside down text. Thanks to @narlei From c20cabb86f2d0bdcdd188169bb8e912950defe24 Mon Sep 17 00:00:00 2001 From: Ahmed Ali Date: Sat, 24 Nov 2018 22:04:59 +0000 Subject: [PATCH 11/21] Updating CHANGELOG.md --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b9a6ac1..67ab5ba 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ * Version 1.1.0 -- Merged PR #98 : fix a complier error in SwiftyJSON - Class. Thanks to @superk589 +- Merged PR #98 : fix a complier error in SwiftyJSON - Class. Thanks @superk589 +- Merged PR #99 : Migrate to Swift 4. Thanks @serhii-londar * Version 1.0.9 From 9ca6bdc098080b587d5a63d79ed18aa38e25e57e Mon Sep 17 00:00:00 2001 From: Ahmed Ali Date: Sat, 24 Nov 2018 22:08:04 +0000 Subject: [PATCH 12/21] Updating CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 67ab5ba..813a2fb 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ * Version 1.1.0 - Merged PR #98 : fix a complier error in SwiftyJSON - Class. Thanks @superk589 - Merged PR #99 : Migrate to Swift 4. Thanks @serhii-londar +- Merged PR #101 Added Codable Option to make Codable Structs with forced up-wrapped properties. Thanks @mumer92 * Version 1.0.9 From 0c5bd0d10caee3504ac5acc9c0e97cd32a25672b Mon Sep 17 00:00:00 2001 From: Ahmed Ali Date: Sat, 24 Nov 2018 22:22:12 +0000 Subject: [PATCH 13/21] Updating CHANGELOG.md --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 813a2fb..6c0ca8c 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,8 @@ * Version 1.1.0 - Merged PR #98 : fix a complier error in SwiftyJSON - Class. Thanks @superk589 - Merged PR #99 : Migrate to Swift 4. Thanks @serhii-londar -- Merged PR #101 Added Codable Option to make Codable Structs with forced up-wrapped properties. Thanks @mumer92 +- Merged PR #101 : Added Codable Option to make Codable Structs with forced up-wrapped properties. Thanks @mumer92 +- Merged PR #106 : Fix Xcode build-time error : Change generic type from 'AnyObject' to 'String' -> Fixes #105. Thanks @ankushkushwaha * Version 1.0.9 From 1e806c9bd085a97fa5bbd8117e1a5c79f37749f8 Mon Sep 17 00:00:00 2001 From: Ahmed Ali Date: Sat, 24 Nov 2018 22:36:31 +0000 Subject: [PATCH 14/21] Updating CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c0ca8c..8f7e18c 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ - Merged PR #99 : Migrate to Swift 4. Thanks @serhii-londar - Merged PR #101 : Added Codable Option to make Codable Structs with forced up-wrapped properties. Thanks @mumer92 - Merged PR #106 : Fix Xcode build-time error : Change generic type from 'AnyObject' to 'String' -> Fixes #105. Thanks @ankushkushwaha +- Merged PR #108 : Java Gson for Android: Fix method name. Thanks @ty0521-fss * Version 1.0.9 From 87f71cbad541e8cbffdd63a0280dca005312650c Mon Sep 17 00:00:00 2001 From: Ahmed Ali Date: Sat, 24 Nov 2018 22:57:41 +0000 Subject: [PATCH 15/21] Updating CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f7e18c..afd70dd 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Merged PR #101 : Added Codable Option to make Codable Structs with forced up-wrapped properties. Thanks @mumer92 - Merged PR #106 : Fix Xcode build-time error : Change generic type from 'AnyObject' to 'String' -> Fixes #105. Thanks @ankushkushwaha - Merged PR #108 : Java Gson for Android: Fix method name. Thanks @ty0521-fss +- Merged PR #123 : Update to Swift 4.2. Thanks @BrychanOdlum * Version 1.0.9 From a507ecff251f17fa73e6822d936012443ee83c47 Mon Sep 17 00:00:00 2001 From: Ahmed Ali Date: Sat, 24 Nov 2018 23:00:58 +0000 Subject: [PATCH 16/21] Fixing the project file --- JSONExport.xcodeproj/project.pbxproj | 8 -------- 1 file changed, 8 deletions(-) diff --git a/JSONExport.xcodeproj/project.pbxproj b/JSONExport.xcodeproj/project.pbxproj index dc0f20c..ab51cdf 100755 --- a/JSONExport.xcodeproj/project.pbxproj +++ b/JSONExport.xcodeproj/project.pbxproj @@ -465,12 +465,8 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "JSONExport/JSONExport-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; -<<<<<<< HEAD - SWIFT_VERSION = 4.0; -======= SWIFT_SWIFT3_OBJC_INFERENCE = On; SWIFT_VERSION = 4.2; ->>>>>>> 4c61a93bc8487a626c8671d2d18fd10adf7283ae }; name = Debug; }; @@ -485,12 +481,8 @@ PRODUCT_BUNDLE_IDENTIFIER = "ahmed.ali.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "JSONExport/JSONExport-Bridging-Header.h"; -<<<<<<< HEAD - SWIFT_VERSION = 4.0; -======= SWIFT_SWIFT3_OBJC_INFERENCE = On; SWIFT_VERSION = 4.2; ->>>>>>> 4c61a93bc8487a626c8671d2d18fd10adf7283ae }; name = Release; }; From db500f576c636d6a6941b1818782bc1c514a732e Mon Sep 17 00:00:00 2001 From: Ahmed Ali Date: Sat, 24 Nov 2018 23:08:17 +0000 Subject: [PATCH 17/21] Updating CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index afd70dd..cfbd7e5 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Merged PR #101 : Added Codable Option to make Codable Structs with forced up-wrapped properties. Thanks @mumer92 - Merged PR #106 : Fix Xcode build-time error : Change generic type from 'AnyObject' to 'String' -> Fixes #105. Thanks @ankushkushwaha - Merged PR #108 : Java Gson for Android: Fix method name. Thanks @ty0521-fss +- Merged PR #119 : Suuport for Outlaw. Thanks @LifetimeCode - Merged PR #123 : Update to Swift 4.2. Thanks @BrychanOdlum From 47a897ea413e5212d01c634e4ffa66399dd7c032 Mon Sep 17 00:00:00 2001 From: Ahmed Ali Date: Sat, 24 Nov 2018 23:32:20 +0000 Subject: [PATCH 18/21] Adding Outlaw JSON file to the project as the merge conflicts caused this to not to merge correctly --- JSONExport.xcodeproj/project.pbxproj | 8 + .../Supported Languages/Swift-Outlaw.json | 138 ++++++++++++++++++ JSONExport/ViewController.swift | 15 +- 3 files changed, 156 insertions(+), 5 deletions(-) create mode 100644 JSONExport/Supported Languages/Swift-Outlaw.json diff --git a/JSONExport.xcodeproj/project.pbxproj b/JSONExport.xcodeproj/project.pbxproj index ab51cdf..8b7491f 100755 --- a/JSONExport.xcodeproj/project.pbxproj +++ b/JSONExport.xcodeproj/project.pbxproj @@ -30,6 +30,8 @@ E2197C5D1A0EAEB900549D03 /* StringExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2197C5C1A0EAEB900549D03 /* StringExtension.swift */; }; E22BA2C51A162B54005CE143 /* FileContentBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = E22BA2C41A162B54005CE143 /* FileContentBuilder.swift */; }; E230BA2C1A113F8C00AE2054 /* FilePreviewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = E230BA2B1A113F8C00AE2054 /* FilePreviewCell.swift */; }; + E24E443221AA12B800435FE7 /* Swift-Outlaw.json in Resources */ = {isa = PBXBuildFile; fileRef = E24E443021AA12B800435FE7 /* Swift-Outlaw.json */; }; + E24E443321AA12B800435FE7 /* Swift3-Mappable.json in Resources */ = {isa = PBXBuildFile; fileRef = E24E443121AA12B800435FE7 /* Swift3-Mappable.json */; }; E278F9C61A2149AC00306EFC /* HeaderFileData.swift in Sources */ = {isa = PBXBuildFile; fileRef = E278F9C51A2149AC00306EFC /* HeaderFileData.swift */; }; E278F9CA1A2152D800306EFC /* HeaderFileRepresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = E278F9C91A2152D800306EFC /* HeaderFileRepresenter.swift */; }; E28631521A158CFA0041B178 /* Constructor.swift in Sources */ = {isa = PBXBuildFile; fileRef = E286314E1A158CFA0041B178 /* Constructor.swift */; }; @@ -72,6 +74,8 @@ E2197C5C1A0EAEB900549D03 /* StringExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StringExtension.swift; sourceTree = ""; }; E22BA2C41A162B54005CE143 /* FileContentBuilder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileContentBuilder.swift; sourceTree = ""; }; E230BA2B1A113F8C00AE2054 /* FilePreviewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FilePreviewCell.swift; sourceTree = ""; }; + E24E443021AA12B800435FE7 /* Swift-Outlaw.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = "Swift-Outlaw.json"; path = "Supported Languages/Swift-Outlaw.json"; sourceTree = ""; }; + E24E443121AA12B800435FE7 /* Swift3-Mappable.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = "Swift3-Mappable.json"; path = "Supported Languages/Swift3-Mappable.json"; sourceTree = ""; }; E278F9C51A2149AC00306EFC /* HeaderFileData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeaderFileData.swift; sourceTree = ""; }; E278F9C91A2152D800306EFC /* HeaderFileRepresenter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeaderFileRepresenter.swift; sourceTree = ""; }; E286314E1A158CFA0041B178 /* Constructor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Constructor.swift; sourceTree = ""; }; @@ -153,6 +157,8 @@ E2F07E8A1A0B3192004A1DAA /* Supported Languages */ = { isa = PBXGroup; children = ( + E24E443021AA12B800435FE7 /* Swift-Outlaw.json */, + E24E443121AA12B800435FE7 /* Swift3-Mappable.json */, 166AF5CD1CEF6C3600516EDD /* Swift-Struct-Gloss.json */, 60FB8FFA1B9B3F6400290979 /* ObjectiveC-Realm.json */, A329A7EC1D5DA1ED00FB59E8 /* Java-Android Gson.json */, @@ -294,6 +300,7 @@ 60FB8FF31B9B361600290979 /* ObjectiveC-iOS.json in Resources */, 60FB8FFC1B9B3F6400290979 /* ObjectiveC-Realm.json in Resources */, 60FB8FF11B9B361600290979 /* Java-Android.json in Resources */, + E24E443321AA12B800435FE7 /* Swift3-Mappable.json in Resources */, 60FB8FF81B9B361600290979 /* Swift-Struct.json in Resources */, E2FA87BF1A059AC100648EB6 /* Images.xcassets in Resources */, 98978FC11D5B6B19000C1846 /* Swift-Struct-Unbox.json in Resources */, @@ -303,6 +310,7 @@ 60FB8FF91B9B361600290979 /* SwiftyJSON-Class.json in Resources */, 60FB8FF21B9B361600290979 /* ObjectiveC-CoreData-iOS.json in Resources */, E2FA87C21A059AC100648EB6 /* Main.storyboard in Resources */, + E24E443221AA12B800435FE7 /* Swift-Outlaw.json in Resources */, 166AF5CE1CEF6C3600516EDD /* Swift-Struct-Gloss.json in Resources */, 60FB8FF41B9B361600290979 /* ObjectiveC-Mac.json in Resources */, ); diff --git a/JSONExport/Supported Languages/Swift-Outlaw.json b/JSONExport/Supported Languages/Swift-Outlaw.json new file mode 100644 index 0000000..cbb27d3 --- /dev/null +++ b/JSONExport/Supported Languages/Swift-Outlaw.json @@ -0,0 +1,138 @@ +{ + "modelStart": "{\n", + "importForEachCustomType": "", + "reservedKeywords": [ + "abstract", + "assert", + "boolean", + "break", + "byte", + "case", + "catch", + "char", + "class", + "const", + "continue", + "default", + "do", + "double", + "else", + "enum", + "extends", + "false", + "final", + "finally", + "float", + "for", + "goto", + "if", + "implements", + "import", + "instanceof", + "int", + "interface", + "long", + "native", + "new", + "null", + "package", + "private", + "protected", + "public", + "return", + "short", + "static", + "strictfp", + "super", + "switch", + "synchronized", + "this", + "throw", + "throws", + "transient", + "true", + "try", + "void", + "volatile", + "while", + "class", + "description" + ], + "booleanGetter": "", + "briefDescription": "Defines how your JSON objects can be mapped to Swift classes using the built-in NSJSONSerialization class", + "utilityMethods": [ + { + "forEachProperty": "\t\tif != nil{\n\t\t\tdictionary[\"\"] = \n\t\t}\n", + "bodyEnd": "\t}\n", + "signature": "\tfunc serialized() -> [String:Any]", + "forEachCustomTypeProperty": "\t\tif != nil{\n\t\t\tdictionary[\"\"] = !.serialized()\n\t\t}\n", + "forEachArrayOfCustomTypeProperty": "\t\tif != nil{\n\t\t\tvar dictionaryElements = [[String:Any]]()\n\t\t\tfor Element in ! {\n\t\t\t\tdictionaryElements.append(Element.serialized())\n\t\t\t}\n\t\t\tdictionary[\"\"] = dictionaryElements\n\t\t}\n", + "returnStatement": "\t\treturn dictionary\n", + "body": "\t\tvar dictionary = [String:Any]()\n", + "comment": "\t/**\n\t * Returns all the available property values in the form of [String:Any] object where the key is the approperiate json key and the value is the value of the corresponding property\n\t */\n", + "bodyStart": "\n\t{\n" + }, + { + "forEachProperty": " = aDecoder.decodeObject(forKey: \"\") as? \n", + "bodyEnd": "\n\t}\n", + "signature": " @objc required init(coder aDecoder: NSCoder)", + "forEachCustomTypeProperty": " = aDecoder.decodeObject(forKey: \"\") as? \n", + "forEachArrayOfCustomTypeProperty": " = aDecoder.decodeObject(forKey :\"\") as? \n", + "returnStatement": "", + "body": "", + "comment": "\n /**\n * NSCoding required initializer.\n * Fills the data from the passed decoder\n */\n", + "bodyStart": "\n\t{\n" + }, + { + "forEachProperty": "\t\tif != nil{\n\t\t\taCoder.encode(, forKey: \"\")\n\t\t}\n", + "bodyEnd": "\n\t}\n", + "signature": " @objc func encode(with aCoder: NSCoder)", + "forEachCustomTypeProperty": "\t\tif != nil{\n\t\t\taCoder.encode(, forKey: \"\")\n\t\t}\n", + "forEachArrayOfCustomTypeProperty": "\t\tif != nil{\n\t\t\taCoder.encode(, forKey: \"\")\n\t\t}\n", + "returnStatement": "", + "body": "", + "comment": "\n /**\n * NSCoding required method.\n * Encodes mode properties into the decoder\n */\n", + "bodyStart": "\n\t{\n" + } + ], + "dataTypes": { + "stringType": "String", + "boolType": "Bool", + "floatType": "Float", + "doubleType": "Double", + "characterType": "Character", + "longType": "Double", + "intType": "Int" + }, + "wordsToRemoveToGetArrayElementsType": [ + "[", + "]" + ], + "defaultParentWithUtilityMethods": "NSObject, DataObject", + "constructors": [ + { + "fetchBasicTypeWithSpecialNeedsPropertyFromMap": "", + "fetchCustomTypePropertyFromMap": "\t\tif let Data = object.optionalAny(for: \"\") as? [String:Any]{\n\t\t\t = try (object: Data)\n\t\t}\n", + "bodyEnd": "\t}\n", + "fetchBasicTypePropertyFromMap": "\t\t = object.value(for: \"\")\n", + "signature": "\trequired init(object: Extractable) throws", + "fetchArrayOfCustomTypePropertyFromMap": "\t\t = ()\n\t\tif let Array = object.optionalAny(for: \"\") as? [[String:Any]]{\n\t\t\tfor dic in Array{\n\t\t\t\tlet value = try (object: dic)\n\t\t\t\t!.append(value)\n\t\t\t}\n\t\t}\n", + "comment": "\t/**\n\t * Instantiate the instance using the passed dictionary values to set the properties values\n\t */\n", + "bodyStart": "{\n" + } + ], + "modelDefinition": "\nclass ", + "genericType": "AnyObject", + "getter": "", + "setter": "", + "displayLangName": "Swift - Outlaw", + "fileExtension": "swift", + "basicTypesWithSpecialFetchingNeeds": [], + "arrayType": "[]", + "modelDefinitionWithParent": "\n\nclass : ", + "instanceVarDefinition": "\tvar : ?\n", + "supportsFirstLineStatement": "false", + "modelEnd": "\n}", + "staticImports": "import Foundation\nimport Outlaw", + "langName": "Swift" +} \ No newline at end of file diff --git a/JSONExport/ViewController.swift b/JSONExport/ViewController.swift index e947b0d..64d4e98 100755 --- a/JSONExport/ViewController.swift +++ b/JSONExport/ViewController.swift @@ -76,8 +76,10 @@ class ViewController: NSViewController, NSUserNotificationCenterDelegate, NSTabl var selectedLang : LangModel! //Returns the title of the selected language in the languagesPopup + //Call only from main thread var selectedLanguageName : String { + assert(Thread.isMainThread); return languagesPopup.titleOfSelectedItem! } @@ -242,7 +244,10 @@ class ViewController: NSViewController, NSUserNotificationCenterDelegate, NSTabl { updateUIFieldsForSelectedLanguage() generateClasses() - UserDefaults.standard.set(selectedLanguageName, forKey: "selectedLanguage") + DispatchQueue.main.async { + UserDefaults.standard.set(self.selectedLanguageName, forKey: "selectedLanguage") + } + } @@ -261,8 +266,7 @@ class ViewController: NSViewController, NSUserNotificationCenterDelegate, NSTabl //MARK: - Language selection handling func loadSelectedLanguageModel() { - selectedLang = langs[selectedLanguageName] - + selectedLang = langs[self.selectedLanguageName] } @@ -411,9 +415,10 @@ class ViewController: NSViewController, NSUserNotificationCenterDelegate, NSTabl }else{ json = unionDictionaryFromArrayElements(jsonData as! NSArray) } - self.loadSelectedLanguageModel() - self.files.removeAll(keepingCapacity: false) + runOnUiThread{ + self.loadSelectedLanguageModel() + self.files.removeAll(keepingCapacity: false) let fileGenerator = self.prepareAndGetFilesBuilder() fileGenerator.addFileWithName(&rootClassName, jsonObject: json, files: &self.files) fileGenerator.fixReferenceMismatches(inFiles: self.files) From a0ec4941a9c27d095150071578434cb9ed57340b Mon Sep 17 00:00:00 2001 From: Ahmed Ali Date: Sat, 24 Nov 2018 23:36:12 +0000 Subject: [PATCH 19/21] nit: removing empty line --- JSONExport/ViewController.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/JSONExport/ViewController.swift b/JSONExport/ViewController.swift index 64d4e98..08f0159 100755 --- a/JSONExport/ViewController.swift +++ b/JSONExport/ViewController.swift @@ -159,7 +159,6 @@ class ViewController: NSViewController, NSUserNotificationCenterDelegate, NSTabl } } - //MARK: - Handling pre defined languages func loadSupportedLanguages() { From 50e3f93ae08089851bd5f46c3b8a03b036c461d0 Mon Sep 17 00:00:00 2001 From: Ahmed Ali Date: Sat, 24 Nov 2018 23:41:21 +0000 Subject: [PATCH 20/21] Fixed an issue with trying to figure the selected language from an UI element outside the UI thread --- CHANGELOG.md | 1 + JSONExport/ViewController.swift | 7 +------ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cfbd7e5..d772ebe 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Merged PR #108 : Java Gson for Android: Fix method name. Thanks @ty0521-fss - Merged PR #119 : Suuport for Outlaw. Thanks @LifetimeCode - Merged PR #123 : Update to Swift 4.2. Thanks @BrychanOdlum +- Fixed an issue with trying to figure the selected language from an UI element outside the UI thread * Version 1.0.9 diff --git a/JSONExport/ViewController.swift b/JSONExport/ViewController.swift index 08f0159..c81166e 100755 --- a/JSONExport/ViewController.swift +++ b/JSONExport/ViewController.swift @@ -171,15 +171,10 @@ class ViewController: NSViewController, NSUserNotificationCenterDelegate, NSTabl } langs[lang.displayLangName] = lang } - - } } - } - - - + // MARK: - parse the json file func parseJSONData(jsonData: Data!) From ee430bf587c769603ee1690e302296cbddc97b4a Mon Sep 17 00:00:00 2001 From: "dimo.hamdy" Date: Thu, 4 Apr 2019 03:09:46 +0200 Subject: [PATCH 21/21] support Swift - Codable - Realm --- JSONExport.xcodeproj/project.pbxproj | 4 + JSONExport/Swift-Codable-Realm.json | 117 +++++++++++++++++++++++++++ 2 files changed, 121 insertions(+) create mode 100755 JSONExport/Swift-Codable-Realm.json diff --git a/JSONExport.xcodeproj/project.pbxproj b/JSONExport.xcodeproj/project.pbxproj index 8b7491f..9c222c3 100755 --- a/JSONExport.xcodeproj/project.pbxproj +++ b/JSONExport.xcodeproj/project.pbxproj @@ -9,6 +9,7 @@ /* Begin PBXBuildFile section */ 01ACC24B1FBB42E300C410C2 /* Swift-Codable.json in Resources */ = {isa = PBXBuildFile; fileRef = 01ACC24A1FBB42E300C410C2 /* Swift-Codable.json */; }; 166AF5CE1CEF6C3600516EDD /* Swift-Struct-Gloss.json in Resources */ = {isa = PBXBuildFile; fileRef = 166AF5CD1CEF6C3600516EDD /* Swift-Struct-Gloss.json */; }; + 3D41804522559064000A79E3 /* Swift-Codable-Realm.json in Resources */ = {isa = PBXBuildFile; fileRef = 3D41804422559064000A79E3 /* Swift-Codable-Realm.json */; }; 608896441CF278440074CB80 /* Author.swift in Sources */ = {isa = PBXBuildFile; fileRef = 608896431CF278440074CB80 /* Author.swift */; }; 60FB8FF01B9B361600290979 /* Java-Android Realm.json in Resources */ = {isa = PBXBuildFile; fileRef = 60FB8FE61B9B361600290979 /* Java-Android Realm.json */; }; 60FB8FF11B9B361600290979 /* Java-Android.json in Resources */ = {isa = PBXBuildFile; fileRef = 60FB8FE71B9B361600290979 /* Java-Android.json */; }; @@ -50,6 +51,7 @@ /* Begin PBXFileReference section */ 01ACC24A1FBB42E300C410C2 /* Swift-Codable.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = "Swift-Codable.json"; path = "Supported Languages/Swift-Codable.json"; sourceTree = ""; }; 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 = ""; }; + 3D41804422559064000A79E3 /* Swift-Codable-Realm.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "Swift-Codable-Realm.json"; sourceTree = ""; }; 608896431CF278440074CB80 /* Author.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Author.swift; sourceTree = ""; }; 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 = ""; }; 60FB8FE71B9B361600290979 /* Java-Android.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = "Java-Android.json"; path = "Supported Languages/Java-Android.json"; sourceTree = ""; }; @@ -174,6 +176,7 @@ 60FB8FEE1B9B361600290979 /* Swift-Struct.json */, 98978FC01D5B6B19000C1846 /* Swift-Struct-Unbox.json */, 01ACC24A1FBB42E300C410C2 /* Swift-Codable.json */, + 3D41804422559064000A79E3 /* Swift-Codable-Realm.json */, 60FB8FEF1B9B361600290979 /* SwiftyJSON-Class.json */, ); name = "Supported Languages"; @@ -303,6 +306,7 @@ E24E443321AA12B800435FE7 /* Swift3-Mappable.json in Resources */, 60FB8FF81B9B361600290979 /* Swift-Struct.json in Resources */, E2FA87BF1A059AC100648EB6 /* Images.xcassets in Resources */, + 3D41804522559064000A79E3 /* Swift-Codable-Realm.json in Resources */, 98978FC11D5B6B19000C1846 /* Swift-Struct-Unbox.json in Resources */, 60FB8FFD1B9B3F6400290979 /* Swift-Realm.json in Resources */, 60FB8FF71B9B361600290979 /* Swift-Mappable.json in Resources */, diff --git a/JSONExport/Swift-Codable-Realm.json b/JSONExport/Swift-Codable-Realm.json new file mode 100755 index 0000000..976ec8e --- /dev/null +++ b/JSONExport/Swift-Codable-Realm.json @@ -0,0 +1,117 @@ +{ + "modelStart": "{\n", + "importForEachCustomType": "", + "reservedKeywords": [ + "abstract", + "assert", + "boolean", + "break", + "byte", + "case", + "catch", + "char", + "class", + "const", + "continue", + "default", + "do", + "double", + "else", + "enum", + "extends", + "false", + "final", + "finally", + "float", + "for", + "goto", + "if", + "implements", + "import", + "instanceof", + "int", + "interface", + "long", + "native", + "new", + "null", + "package", + "private", + "protected", + "public", + "return", + "short", + "static", + "strictfp", + "super", + "switch", + "synchronized", + "this", + "throw", + "throws", + "transient", + "true", + "try", + "void", + "volatile", + "while", + "class", + "description", + "dynamic", + "Object" + ], + "booleanGetter": "", + "briefDescription": "Defines how your JSON objects can be mapped to Swift structures using the built-in NSJSONSerialization class", + "utilityMethods": [ + ], + "dataTypes": { + "stringType": "String", + "boolType": "Bool", + "floatType": "Float", + "doubleType": "Double", + "characterType": "Character", + "longType": "Double", + "intType": "Int" + }, + "wordsToRemoveToGetArrayElementsType": [ + "[", + "]" + ], + "constructors": [ + { + "fetchBasicTypeWithSpecialNeedsPropertyFromMap": "", + "bodyStart": "{\n", + "body": "", + "bodyEnd": "\t}\n", + "fetchBasicTypePropertyFromMap": "\t\tcase = \"\"\n", + "signature": "\tenum CodingKeys: String, CodingKey ", + "fetchArrayOfCustomTypePropertyFromMap": "\t\tcase = \"\"\n", + "comment": "", + "fetchCustomTypePropertyFromMap": "\t\tcase \n" + }, + { + "fetchBasicTypeWithSpecialNeedsPropertyFromMap": "", + "bodyStart": "{\n\t\tlet values = try decoder.container(keyedBy: CodingKeys.self)\n", + "bodyEnd": "\t}\n", + "fetchBasicTypePropertyFromMap": "\t\t = try values.decodeIfPresent(.self, forKey: .)\n", + "signature": "\tconvenience required init(from decoder: Decoder) throws ", + "fetchArrayOfCustomTypePropertyFromMap": "\t\t = try values.decodeIfPresent(.self, forKey: .)\n", + "comment": "", + "fetchCustomTypePropertyFromMap": "\t\t = try (from: decoder)\n" + } + ], + "modelDefinition": "\nclass : Object,Codable ", + "genericType": "String", + "getter": "", + "setter": "", + "fileExtension": "swift", + "arrayType": "[]", + "basicTypesWithSpecialFetchingNeeds": [ + ], + "displayLangName": "Swift - Codable - Realm", + "instanceVarDefinition": "\t@objc dynamic var : = ()\n", + "supportsFirstLineStatement": "false", + "modelEnd": "\n}", + "staticImports": "import Foundation \nimport RealmSwift", + "langName": "Swift" +}