├── .gitattributes ├── .gitignore ├── CHANGELOG.md ├── JSONExport.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── xcuserdata │ │ ├── Robin.xcuserdatad │ │ └── UserInterfaceState.xcuserstate │ │ ├── binaryboy.xcuserdatad │ │ └── UserInterfaceState.xcuserstate │ │ ├── narleiamoreira.xcuserdatad │ │ └── UserInterfaceState.xcuserstate │ │ ├── serhii-londar.xcuserdatad │ │ └── UserInterfaceState.xcuserstate │ │ └── zhangrunliang.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ ├── binaryboy.xcuserdatad │ └── xcschemes │ │ ├── JSONExport.xcscheme │ │ └── xcschememanagement.plist │ ├── narleiamoreira.xcuserdatad │ └── xcschemes │ │ └── xcschememanagement.plist │ ├── serhii-londar.xcuserdatad │ └── xcschemes │ │ └── xcschememanagement.plist │ └── zhangrunliang.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── JSONExport.xcscheme │ └── xcschememanagement.plist ├── JSONExport ├── AppDelegate.swift ├── Author.swift ├── Base.lproj │ └── Main.storyboard ├── Constructor.swift ├── DataType.swift ├── FileContentBuilder.swift ├── FilePreviewCell.swift ├── FileRepresenter.swift ├── HeaderFileData.swift ├── HeaderFileRepresenter.swift ├── Images.xcassets │ └── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── icon_128x128.png │ │ ├── icon_128x128@2x.png │ │ ├── icon_16x16.png │ │ ├── icon_16x16@2x.png │ │ ├── icon_256x256.png │ │ ├── icon_256x256@2x.png │ │ ├── icon_32x32.png │ │ ├── icon_32x32@2x.png │ │ ├── icon_512x512.png │ │ └── icon_512x512@2x.png ├── Info.plist ├── JSONExport-Bridging-Header.h ├── LangModel.swift ├── NoodleLineNumberMarker.h ├── NoodleLineNumberMarker.m ├── NoodleLineNumberView.h ├── NoodleLineNumberView.m ├── Property.swift ├── SharedConstants.swift ├── SharedUtilityMethods.swift ├── StringExtension.swift ├── Supported Languages │ ├── Java-Android Gson.json │ ├── Java-Android Realm.json │ ├── Java-Android.json │ ├── ObjectiveC-CoreData-iOS.json │ ├── ObjectiveC-Mac.json │ ├── ObjectiveC-Realm.json │ ├── ObjectiveC-iOS.json │ ├── Swift-Class.json │ ├── Swift-Codable.json │ ├── Swift-CoreData.json │ ├── Swift-Mappable.json │ ├── Swift-Outlaw.json │ ├── Swift-Realm.json │ ├── Swift-Struct-Gloss.json │ ├── Swift-Struct-Unbox.json │ ├── Swift-Struct.json │ ├── Swift3-Mappable.json │ └── SwiftyJSON-Class.json ├── Swift-Apollo Realm.json ├── Swift-Codable-Unwrapped.json ├── UtilityMethod.swift └── ViewController.swift ├── LICENSE └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | *.m linguist-language=Swift 2 | *.h linguist-language=Swift -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | JSONExport.xcodeproj/project.xcworkspace/xcshareddata/JSONExport.xccheckout 3 | JSONExport.xcodeproj/project.xcworkspace/xcuserdata/ahmed.xcuserdatad/UserInterfaceState.xcuserstate 4 | JSONExport.xcodeproj/xcuserdata/ahmed.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist 5 | JSONExport.xcodeproj/project.xcworkspace/xcuserdata/ahmedali.xcuserdatad/UserInterfaceState.xcuserstate 6 | JSONExport.xcodeproj/xcuserdata/ahmedali.xcuserdatad/xcschemes/JSONExport.xcscheme 7 | JSONExport.xcodeproj/xcuserdata/ahmedali.xcuserdatad/xcschemes/xcschememanagement.plist 8 | 9 | 10 | # OS X Finder 11 | .DS_Store 12 | .LSOverride 13 | 14 | # Xcode per-user config 15 | *.mode1 16 | *.mode1v3 17 | *.mode2v3 18 | *.perspective 19 | *.perspectivev3 20 | *.pbxuser 21 | #*.xcworkspace 22 | xcuserdata 23 | 24 | 25 | # Build products 26 | build/ 27 | *.o 28 | *.LinkFileList 29 | *.hmap 30 | 31 | # Automatic backup files 32 | *~.nib/ 33 | *.swp 34 | *~ 35 | *.dat 36 | *.dep 37 | 38 | Breakpoints.xcbkptlist 39 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | * Version 1.1.0 2 | - Merged PR #98 : fix a complier error in SwiftyJSON - Class. Thanks @superk589 3 | - Merged PR #99 : Migrate to Swift 4. Thanks @serhii-londar 4 | - Merged PR #101 : Added Codable Option to make Codable Structs with forced up-wrapped properties. Thanks @mumer92 5 | - Merged PR #106 : Fix Xcode build-time error : Change generic type from 'AnyObject' to 'String' -> Fixes #105. Thanks @ankushkushwaha 6 | - Merged PR #108 : Java Gson for Android: Fix method name. Thanks @ty0521-fss 7 | - Merged PR #119 : Suuport for Outlaw. Thanks @LifetimeCode 8 | - Merged PR #123 : Update to Swift 4.2. Thanks @BrychanOdlum 9 | - Fixed an issue with trying to figure the selected language from an UI element outside the UI thread 10 | 11 | 12 | * Version 1.0.9 13 | - Merged PR #88 : Fix minor typo in the README.MD file. Thanks to @AlexxNica 14 | - Merged PR #93 Changed app icon and fix upside down text. Thanks to @narlei 15 | - Merged PR #96 Adding support for Swift 4 Codable. Thanks to @kashifshaikh 16 | 17 | * Version 1.0.8 18 | - Merged PR #72 App now remembers what language user selected last time. Thanks to @TParizek 19 | - Merged PR #75 Fix Error for Swift in Xcode 8.2.1 and replace NSDictionary. Thanks to @dimohamdy 20 | - Merged PR #76 NSCoding protocol - swift 3 compatible. Thanks to @gajjartejas 21 | 22 | * Version 1.0.7 23 | - Merged PR #70 to update unbox JSON file for Swift 3 24 | - Fixed issue #71 by disabiliing the handling of smart quotes and also fixing the source of this issue in the JSON inpute text view. 25 | - Removed SBJson dependency. 26 | 27 | 28 | * Version 1.0.6 29 | - Merged PR #69 to fix some issues with SwiftyJSON generated files 30 | - Merged PR #59 to auto fill the root class name from the imported JSON file. 31 | * Version 1.0.5 32 | - Merged pull request #58 to update ObjectMapper generated files to for Swift 3 33 | * Version 1.0.4 34 | - Merged pull request #47 to add support to open .json file from the app (thanks to RobinChao) 35 | - Merged pull request #50 (thanks king129) 36 | - Merged pull request #54 to complete the Swift 3 and Xcode 8 support 37 | - Fixed issue #48 that causes the app to produce empty files 38 | - Fixed issue #53 to call copy instead of copyWithZone method for the NSCopying implementation 39 | 40 | * Version 1.0.3 41 | - Merged pull request #45 to add support Android GSON (Thanks to forestsoftjpdev) 42 | 43 | * Version 1.0.2 44 | - Merged pull request #43 to add support for Swift 3 for Mappable classes (Thanks to amolgupta) 45 | - Merged pull request #44 to add support for Unbox structures (Thanks to baroqueworksdev) 46 | 47 | * Version 1.0.1 48 | - Merged pull request #38 to add support to Gloss (Thanks to CodeEagle help) 49 | - Add "author" section in the lang files, so when you contribute by adding a definition of a language, you can add your "name", "email", "website" on top of every generated file of the language you added. See the Swift-Struct-Gloss.json" author key for an example. 50 | 51 | * Version 1.0.0 52 | - Merged pull requests #28 and #31 53 | - The app seems to be stable enough at this point 54 | 55 | * Version 0.0.9 56 | - Merged pull request #25 for support to Xcode 7 and Swift 2.0 57 | * Version 0.0.8 58 | - Added reserved keywords for each language; json keys that has one of these keywords (eg: {"false": "This is false value"}), will be handled approperiately. 59 | - Fix for issue #10, whcih prevented the creation of some classes/structs in some cases. 60 | - Added NSCoding support for the following language definitions: Swift-Classes, Swift-Mappable, SwiftyJSON, Swift-Realm, Objective-C iOS, Mac and Realm. 61 | 62 | * Version 0.0.7 63 | - Few changes by tomkidd for xCode 6.3 and Swift 1.2 64 | 65 | * Version 0.0.6 66 | - JSONExport will first remove any control characters before parsing the JSON object. So it will able to parse your JSON even if it has control characters. 67 | - Double check property names to avoid unwanted spaces (issue #5 thanks to falcon2010). 68 | - Processing JSON now happens in background queue for better responsiveness. 69 | - For Java (with and without Realm) parsing of array of strings (issue #6 thanks to falcon2010) 70 | 71 | * Version 0.0.5: 72 | - Fixed an issue where float values would be generated into Int property (Thanks to jmonroe). 73 | - Updated SiwftyJSON language definition to match the current version (Thanks to jmonroe). 74 | - Fixed typo in CGGFloat instead of CGFloat. 75 | - In Objective-C check against NSNull values. 76 | - Swift realm, initialize using class methods instead of initializers. 77 | - Swift perimitive types now casted directly instead of cating to NSString first. 78 | 79 | * Version 0.0.4: 80 | - Sync multible classes with the same name or have the same exact properties. 81 | - Support to parse JSON arrays of objects. 82 | 83 | * Version 0.0.3: 84 | - Added support for Realm with Android. 85 | - Added support to specify parent class for all generated classes. 86 | -------------------------------------------------------------------------------- /JSONExport.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /JSONExport.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /JSONExport.xcodeproj/project.xcworkspace/xcuserdata/Robin.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmed-Ali/JSONExport/9f1064fd05b6ed9b2e396147da9899071325a129/JSONExport.xcodeproj/project.xcworkspace/xcuserdata/Robin.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /JSONExport.xcodeproj/project.xcworkspace/xcuserdata/binaryboy.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmed-Ali/JSONExport/9f1064fd05b6ed9b2e396147da9899071325a129/JSONExport.xcodeproj/project.xcworkspace/xcuserdata/binaryboy.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /JSONExport.xcodeproj/project.xcworkspace/xcuserdata/narleiamoreira.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmed-Ali/JSONExport/9f1064fd05b6ed9b2e396147da9899071325a129/JSONExport.xcodeproj/project.xcworkspace/xcuserdata/narleiamoreira.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /JSONExport.xcodeproj/project.xcworkspace/xcuserdata/serhii-londar.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmed-Ali/JSONExport/9f1064fd05b6ed9b2e396147da9899071325a129/JSONExport.xcodeproj/project.xcworkspace/xcuserdata/serhii-londar.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /JSONExport.xcodeproj/project.xcworkspace/xcuserdata/zhangrunliang.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmed-Ali/JSONExport/9f1064fd05b6ed9b2e396147da9899071325a129/JSONExport.xcodeproj/project.xcworkspace/xcuserdata/zhangrunliang.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /JSONExport.xcodeproj/xcuserdata/binaryboy.xcuserdatad/xcschemes/JSONExport.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /JSONExport.xcodeproj/xcuserdata/binaryboy.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | JSONExport.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | E2FA87B41A059AC100648EB6 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /JSONExport.xcodeproj/xcuserdata/narleiamoreira.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | JSONExport.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /JSONExport.xcodeproj/xcuserdata/serhii-londar.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | JSONExport.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /JSONExport.xcodeproj/xcuserdata/zhangrunliang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /JSONExport.xcodeproj/xcuserdata/zhangrunliang.xcuserdatad/xcschemes/JSONExport.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /JSONExport.xcodeproj/xcuserdata/zhangrunliang.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | JSONExport.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | E2FA87B41A059AC100648EB6 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /JSONExport/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // JSONExport 4 | // 5 | // Created by Ahmed on 11/2/14. 6 | // Copyright (c) 2014 Ahmed Ali. Eng.Ahmed.Ali.Awad@gmail.com. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // 1. Redistributions of source code must retain the above copyright 13 | // notice, this list of conditions and the following disclaimer. 14 | // 2. Redistributions in binary form must reproduce the above copyright 15 | // notice, this list of conditions and the following disclaimer in the 16 | // documentation and/or other materials provided with the distribution. 17 | // 3. The name of the contributor can not be used to endorse or promote products derived from this software 18 | // without specific prior written permission. 19 | // 20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 24 | // THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 25 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 29 | // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 31 | // OF THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | import Cocoa 34 | 35 | @NSApplicationMain 36 | class AppDelegate: NSObject, NSApplicationDelegate { 37 | 38 | 39 | 40 | func applicationDidFinishLaunching(_ aNotification: Notification) { 41 | // Insert code here to initialize your application 42 | } 43 | 44 | func applicationWillTerminate(_ aNotification: Notification) { 45 | // Insert code here to tear down your application 46 | } 47 | 48 | 49 | } 50 | 51 | -------------------------------------------------------------------------------- /JSONExport/Author.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Author.swift 3 | // 4 | // Create by Ahmed Ali on 23/5/2016 5 | // Copyright © 2016. All rights reserved. 6 | // Model file Generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport 7 | 8 | import Foundation 9 | 10 | 11 | class Author : NSObject, NSCoding{ 12 | 13 | var website : String! 14 | var email : String! 15 | var name : String! 16 | 17 | 18 | /** 19 | * Instantiate the instance using the passed dictionary values to set the properties values 20 | */ 21 | init(fromDictionary dictionary: NSDictionary){ 22 | website = dictionary["website"] as? String 23 | email = dictionary["email"] as? String 24 | name = dictionary["name"] as? String 25 | } 26 | 27 | /** 28 | * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property 29 | */ 30 | func toDictionary() -> NSDictionary 31 | { 32 | let dictionary = NSMutableDictionary() 33 | if website != nil{ 34 | dictionary["website"] = website 35 | } 36 | if email != nil{ 37 | dictionary["email"] = email 38 | } 39 | if name != nil{ 40 | dictionary["name"] = name 41 | } 42 | return dictionary 43 | } 44 | 45 | /** 46 | * NSCoding required initializer. 47 | * Fills the data from the passed decoder 48 | */ 49 | @objc required init(coder aDecoder: NSCoder) 50 | { 51 | website = aDecoder.decodeObject(forKey: "website") as? String 52 | email = aDecoder.decodeObject(forKey: "email") as? String 53 | name = aDecoder.decodeObject(forKey: "name") as? String 54 | 55 | } 56 | 57 | /** 58 | * NSCoding required method. 59 | * Encodes mode properties into the decoder 60 | */ 61 | @objc func encode(with aCoder: NSCoder) 62 | { 63 | if website != nil{ 64 | aCoder.encode(website, forKey: "website") 65 | } 66 | if email != nil{ 67 | aCoder.encode(email, forKey: "email") 68 | } 69 | if name != nil{ 70 | aCoder.encode(name, forKey: "name") 71 | } 72 | 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /JSONExport/Constructor.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Constructor.swift 3 | // 4 | // Create by Ahmed Ali on 14/11/2014 5 | // Copyright (c) 2014 Mobile Developer. All rights reserved. 6 | // 7 | 8 | import Foundation 9 | 10 | class Constructor{ 11 | 12 | var bodyEnd : String! 13 | var bodyStart : String! 14 | var comment : String! 15 | var fetchArrayOfCustomTypePropertyFromMap : String! 16 | var fetchArrayOfBasicTypePropertyFromMap : String! 17 | var fetchBasicTypePropertyFromMap : String! 18 | var fetchBasicTypeWithSpecialNeedsPropertyFromMap : String! 19 | var fetchCustomTypePropertyFromMap : String! 20 | var signature : String! 21 | 22 | 23 | /** 24 | * Instantiate the instance using the passed dictionary values to set the properties values 25 | */ 26 | init(fromDictionary dictionary: NSDictionary){ 27 | bodyEnd = dictionary["bodyEnd"] as? String 28 | bodyStart = dictionary["bodyStart"] as? String 29 | comment = dictionary["comment"] as? String 30 | fetchArrayOfCustomTypePropertyFromMap = dictionary["fetchArrayOfCustomTypePropertyFromMap"] as? String 31 | fetchArrayOfBasicTypePropertyFromMap = dictionary["fetchArrayOfBasicTypePropertyFromMap"] as? String 32 | fetchBasicTypePropertyFromMap = dictionary["fetchBasicTypePropertyFromMap"] as? String 33 | fetchBasicTypeWithSpecialNeedsPropertyFromMap = dictionary["fetchBasicTypeWithSpecialNeedsPropertyFromMap"] as? String 34 | fetchCustomTypePropertyFromMap = dictionary["fetchCustomTypePropertyFromMap"] as? String 35 | signature = dictionary["signature"] as? String 36 | } 37 | 38 | 39 | } -------------------------------------------------------------------------------- /JSONExport/DataType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DataType.swift 3 | // 4 | // Create by Ahmed Ali on 14/11/2014 5 | // Copyright (c) 2014 Mobile Developer. All rights reserved. 6 | // 7 | 8 | import Foundation 9 | 10 | class DataType{ 11 | 12 | var boolType : String! 13 | var characterType : String! 14 | var doubleType : String! 15 | var floatType : String! 16 | var intType : String! 17 | var longType : String! 18 | var stringType : String! 19 | 20 | 21 | /** 22 | * Instantiate the instance using the passed dictionary values to set the properties values 23 | */ 24 | init(fromDictionary dictionary: NSDictionary){ 25 | boolType = dictionary["boolType"] as? String 26 | characterType = dictionary["characterType"] as? String 27 | doubleType = dictionary["doubleType"] as? String 28 | floatType = dictionary["floatType"] as? String 29 | intType = dictionary["intType"] as? String 30 | longType = dictionary["longType"] as? String 31 | stringType = dictionary["stringType"] as? String 32 | } 33 | 34 | /** 35 | * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property 36 | */ 37 | func toDictionary() -> NSDictionary 38 | { 39 | let dictionary = NSMutableDictionary() 40 | if boolType != nil{ 41 | dictionary["boolType"] = boolType 42 | } 43 | if characterType != nil{ 44 | dictionary["characterType"] = characterType 45 | } 46 | if doubleType != nil{ 47 | dictionary["doubleType"] = doubleType 48 | } 49 | if floatType != nil{ 50 | dictionary["floatType"] = floatType 51 | } 52 | if intType != nil{ 53 | dictionary["intType"] = intType 54 | } 55 | if longType != nil{ 56 | dictionary["longType"] = longType 57 | } 58 | if stringType != nil{ 59 | dictionary["stringType"] = stringType 60 | } 61 | return dictionary 62 | } 63 | 64 | } -------------------------------------------------------------------------------- /JSONExport/FilePreviewCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FilePreviewCell.swift 3 | // JSONExport 4 | // 5 | // Created by Ahmed on 11/10/14. 6 | // Copyright (c) 2014 Ahmed Ali. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | class FilePreviewCell: NSTableCellView, NSTextViewDelegate { 12 | 13 | 14 | @IBOutlet var classNameLabel: NSTextFieldCell! 15 | @IBOutlet var constructors: NSButton! 16 | @IBOutlet var utilities: NSButton! 17 | @IBOutlet var textView: NSTextView! 18 | @IBOutlet var scrollView: NSScrollView! 19 | 20 | 21 | var file: FileRepresenter!{ 22 | didSet{ 23 | if file != nil{ 24 | DispatchQueue.main.async { 25 | var fileName = self.file.className 26 | fileName += "." 27 | if self.file is HeaderFileRepresenter{ 28 | fileName += self.file.lang.headerFileData.headerFileExtension 29 | }else{ 30 | fileName += self.file.lang.fileExtension 31 | } 32 | self.classNameLabel.stringValue = fileName 33 | if(self.textView != nil){ 34 | self.textView.string = self.file.toString() 35 | } 36 | 37 | if self.file.includeConstructors{ 38 | self.constructors.state = NSControl.StateValue.on 39 | }else{ 40 | self.constructors.state = NSControl.StateValue.off 41 | } 42 | if self.file.includeUtilities{ 43 | self.utilities.state = NSControl.StateValue.on 44 | }else{ 45 | self.utilities.state = NSControl.StateValue.off 46 | } 47 | } 48 | }else{ 49 | classNameLabel.stringValue = "" 50 | } 51 | } 52 | } 53 | 54 | 55 | 56 | override func awakeFromNib() { 57 | super.awakeFromNib() 58 | if textView != nil{ 59 | textView.delegate = self 60 | DispatchQueue.main.async { 61 | self.setupNumberedTextView() 62 | } 63 | } 64 | } 65 | 66 | func setupNumberedTextView() 67 | { 68 | let lineNumberView = NoodleLineNumberView(scrollView: scrollView) 69 | scrollView.hasHorizontalRuler = false 70 | scrollView.hasVerticalRuler = true 71 | scrollView.verticalRulerView = lineNumberView 72 | scrollView.rulersVisible = true 73 | textView.font = NSFont.userFixedPitchFont(ofSize: NSFont.smallSystemFontSize) 74 | 75 | } 76 | 77 | @IBAction func toggleConstructors(_ sender: NSButtonCell) 78 | { 79 | if file != nil{ 80 | file.includeConstructors = (sender.state == NSControl.StateValue.off) 81 | textView.string = file.toString() 82 | 83 | } 84 | } 85 | 86 | @IBAction func toggleUtilityMethods(_ sender: NSButtonCell) 87 | { 88 | if file != nil{ 89 | file.includeUtilities = (sender.state == NSControl.StateValue.on) 90 | textView.string = file.toString() 91 | } 92 | } 93 | 94 | func textDidChange(_ notification: Notification) { 95 | file.fileContent = textView.string 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /JSONExport/HeaderFileData.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HeaderFileData.swift 3 | // 4 | // Create by Ahmed Ali on 23/11/2014 5 | // Copyright © 2014 Mobile Developer. All rights reserved. 6 | // 7 | 8 | import Foundation 9 | 10 | class HeaderFileData{ 11 | 12 | var constructorSignatures : [String]! 13 | var headerFileExtension : String! 14 | var importForEachCustomType : String! 15 | var importParentHeaderFile : String! 16 | var instanceVarDefinition : String! 17 | var instanceVarWithSpeicalDefinition : String! 18 | var modelDefinition : String! 19 | var modelDefinitionWithParent : String! 20 | var defaultParentWithUtilityMethods : String! 21 | var modelEnd : String! 22 | var modelStart : String! 23 | var staticImports : String! 24 | var typesNeedSpecialDefinition : [String]! 25 | var utilityMethodSignatures : [String]! 26 | 27 | 28 | /** 29 | * Instantiate the instance using the passed dictionary values to set the properties values 30 | */ 31 | init(fromDictionary dictionary: NSDictionary){ 32 | constructorSignatures = dictionary["constructorSignatures"] as? [String] 33 | headerFileExtension = dictionary["headerFileExtension"] as? String 34 | importForEachCustomType = dictionary["importForEachCustomType"] as? String 35 | importParentHeaderFile = dictionary["importParentHeaderFile"] as? String 36 | instanceVarDefinition = dictionary["instanceVarDefinition"] as? String 37 | 38 | instanceVarWithSpeicalDefinition = dictionary["instanceVarWithSpeicalDefinition"] as? String 39 | modelDefinition = dictionary["modelDefinition"] as? String 40 | modelDefinitionWithParent = dictionary["modelDefinitionWithParent"] as? String 41 | defaultParentWithUtilityMethods = dictionary["defaultParentWithUtilityMethods"] as? String 42 | modelEnd = dictionary["modelEnd"] as? String 43 | modelStart = dictionary["modelStart"] as? String 44 | staticImports = dictionary["staticImports"] as? String 45 | typesNeedSpecialDefinition = dictionary["typesNeedSpecialDefinition"] as? [String] 46 | utilityMethodSignatures = dictionary["utilityMethodSignatures"] as? [String] 47 | 48 | } 49 | 50 | } -------------------------------------------------------------------------------- /JSONExport/HeaderFileRepresenter.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HeaderFileRepresenter.swift 3 | // JSONExport 4 | // Created by Ahmed Ali on 11/23/14. 5 | // Copyright (c) 2014 Ahmed Ali. Eng.Ahmed.Ali.Awad@gmail.com. 6 | // 7 | // Redistribution and use in source and binary forms, with or without 8 | // modification, are permitted provided that the following conditions 9 | // are met: 10 | // 11 | // 1. Redistributions of source code must retain the above copyright 12 | // notice, this list of conditions and the following disclaimer. 13 | // 2. Redistributions in binary form must reproduce the above copyright 14 | // notice, this list of conditions and the following disclaimer in the 15 | // documentation and/or other materials provided with the distribution. 16 | // 3. The name of the contributor can not be used to endorse or promote products derived from this software 17 | // without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 22 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 23 | // THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 24 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 | // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 28 | // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 30 | // OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | 33 | import Foundation 34 | import AddressBook 35 | 36 | class HeaderFileRepresenter : FileRepresenter{ 37 | /** 38 | Generates the header file content and stores it in the fileContent property 39 | */ 40 | override func toString() -> String{ 41 | fileContent = "" 42 | appendCopyrights() 43 | appendStaticImports() 44 | appendImportParentHeader() 45 | appendCustomImports() 46 | 47 | //start the model defination 48 | var definition = "" 49 | if lang.headerFileData.modelDefinitionWithParent != nil && parentClassName.count > 0{ 50 | definition = lang.headerFileData.modelDefinitionWithParent.replacingOccurrences(of: modelName, with: className) 51 | definition = definition.replacingOccurrences(of: modelWithParentClassName, with: parentClassName) 52 | }else if includeUtilities && lang.defaultParentWithUtilityMethods != nil{ 53 | definition = lang.headerFileData.modelDefinitionWithParent.replacingOccurrences(of: modelName, with: className) 54 | definition = definition.replacingOccurrences(of: modelWithParentClassName, with: lang.headerFileData.defaultParentWithUtilityMethods) 55 | }else{ 56 | definition = lang.headerFileData.modelDefinition.replacingOccurrences(of: modelName, with: className) 57 | } 58 | 59 | fileContent += definition 60 | //start the model content body 61 | fileContent += "\(lang.modelStart)" 62 | 63 | appendProperties() 64 | appendInitializers() 65 | appendUtilityMethods() 66 | fileContent += lang.modelEnd 67 | return fileContent 68 | } 69 | 70 | 71 | 72 | /** 73 | Appends the lang.headerFileData.staticImports if any 74 | */ 75 | override func appendStaticImports() 76 | { 77 | if lang.headerFileData.staticImports != nil{ 78 | fileContent += lang.headerFileData.staticImports 79 | fileContent += "\n" 80 | } 81 | } 82 | 83 | func appendImportParentHeader() 84 | { 85 | if lang.headerFileData.importParentHeaderFile != nil && parentClassName.count > 0{ 86 | fileContent += lang.headerFileData.importParentHeaderFile.replacingOccurrences(of: modelWithParentClassName, with: parentClassName) 87 | } 88 | } 89 | 90 | /** 91 | Tries to access the address book in order to fetch basic information about the author so it can include a nice copyright statment 92 | */ 93 | override func appendCopyrights() 94 | { 95 | if let me = ABAddressBook.shared()?.me(){ 96 | fileContent += "//\n//\t\(self.className).\(lang.headerFileData.headerFileExtension!)\n" 97 | if let firstName = me.value(forProperty: kABFirstNameProperty as String) as? String{ 98 | fileContent += "//\n//\tCreate by \(firstName)" 99 | if let lastName = me.value(forProperty: kABLastNameProperty as String) as? String{ 100 | fileContent += " \(lastName)" 101 | } 102 | } 103 | 104 | 105 | fileContent += " on \(getTodayFormattedDay())\n//\tCopyright © \(getYear())" 106 | 107 | if let organization = me.value(forProperty: kABOrganizationProperty as String) as? String{ 108 | fileContent += " \(organization)" 109 | } 110 | 111 | fileContent += ". All rights reserved.\n//\n\n" 112 | //fileContent += "//\tModel file Generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport\n\n" 113 | } 114 | 115 | } 116 | 117 | 118 | /** 119 | Loops on all properties which has a custom type and appends the custom import from the lang.headerFileData's importForEachCustomType property 120 | 121 | */ 122 | override func appendCustomImports() 123 | { 124 | if lang.importForEachCustomType != nil{ 125 | for property in properties{ 126 | if property.isCustomClass{ 127 | fileContent += lang.headerFileData.importForEachCustomType.replacingOccurrences(of: modelName, with: property.type) 128 | }else if property.isArray{ 129 | //if it is an array of custom types 130 | if(property.elementsType != lang.genericType){ 131 | let basicTypes = lang.dataTypes.toDictionary().allValues as! [String] 132 | if basicTypes.index(of: property.elementsType) == nil{ 133 | fileContent += lang.headerFileData.importForEachCustomType.replacingOccurrences(of: modelName, with: property.elementsType) 134 | } 135 | } 136 | 137 | } 138 | } 139 | } 140 | } 141 | 142 | /** 143 | Appends all the properties using the Property.stringPresentation method 144 | */ 145 | override func appendProperties() 146 | { 147 | fileContent += "\n" 148 | for property in properties{ 149 | fileContent += property.toString(true) 150 | } 151 | } 152 | 153 | /** 154 | Appends all the defined constructors (aka initializers) in lang.constructors to the fileContent 155 | */ 156 | override func appendInitializers() 157 | { 158 | if !includeConstructors{ 159 | return 160 | } 161 | fileContent += "\n" 162 | for constructorSignature in lang.headerFileData.constructorSignatures{ 163 | 164 | fileContent += constructorSignature 165 | 166 | fileContent = fileContent.replacingOccurrences(of: modelName, with: className) 167 | } 168 | } 169 | 170 | 171 | /** 172 | Appends all the defined utility methods in lang.utilityMethods to the fileContent 173 | */ 174 | override func appendUtilityMethods() 175 | { 176 | if !includeUtilities{ 177 | return 178 | } 179 | fileContent += "\n" 180 | for methodSignature in lang.headerFileData.utilityMethodSignatures{ 181 | fileContent += methodSignature 182 | } 183 | } 184 | } 185 | -------------------------------------------------------------------------------- /JSONExport/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | }, 6 | "images" : [ 7 | { 8 | "filename" : "icon_16x16.png", 9 | "size" : "16x16", 10 | "idiom" : "mac", 11 | "scale" : "1x" 12 | }, 13 | { 14 | "filename" : "icon_16x16@2x.png", 15 | "size" : "16x16", 16 | "idiom" : "mac", 17 | "scale" : "2x" 18 | }, 19 | { 20 | "filename" : "icon_32x32.png", 21 | "size" : "32x32", 22 | "idiom" : "mac", 23 | "scale" : "1x" 24 | }, 25 | { 26 | "filename" : "icon_32x32@2x.png", 27 | "size" : "32x32", 28 | "idiom" : "mac", 29 | "scale" : "2x" 30 | }, 31 | { 32 | "filename" : "icon_128x128.png", 33 | "size" : "128x128", 34 | "idiom" : "mac", 35 | "scale" : "1x" 36 | }, 37 | { 38 | "filename" : "icon_128x128@2x.png", 39 | "size" : "128x128", 40 | "idiom" : "mac", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "filename" : "icon_256x256.png", 45 | "size" : "256x256", 46 | "idiom" : "mac", 47 | "scale" : "1x" 48 | }, 49 | { 50 | "filename" : "icon_256x256@2x.png", 51 | "size" : "256x256", 52 | "idiom" : "mac", 53 | "scale" : "2x" 54 | }, 55 | { 56 | "filename" : "icon_512x512.png", 57 | "size" : "512x512", 58 | "idiom" : "mac", 59 | "scale" : "1x" 60 | }, 61 | { 62 | "filename" : "icon_512x512@2x.png", 63 | "size" : "512x512", 64 | "idiom" : "mac", 65 | "scale" : "2x" 66 | } 67 | ] 68 | } -------------------------------------------------------------------------------- /JSONExport/Images.xcassets/AppIcon.appiconset/icon_128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmed-Ali/JSONExport/9f1064fd05b6ed9b2e396147da9899071325a129/JSONExport/Images.xcassets/AppIcon.appiconset/icon_128x128.png -------------------------------------------------------------------------------- /JSONExport/Images.xcassets/AppIcon.appiconset/icon_128x128@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmed-Ali/JSONExport/9f1064fd05b6ed9b2e396147da9899071325a129/JSONExport/Images.xcassets/AppIcon.appiconset/icon_128x128@2x.png -------------------------------------------------------------------------------- /JSONExport/Images.xcassets/AppIcon.appiconset/icon_16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmed-Ali/JSONExport/9f1064fd05b6ed9b2e396147da9899071325a129/JSONExport/Images.xcassets/AppIcon.appiconset/icon_16x16.png -------------------------------------------------------------------------------- /JSONExport/Images.xcassets/AppIcon.appiconset/icon_16x16@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmed-Ali/JSONExport/9f1064fd05b6ed9b2e396147da9899071325a129/JSONExport/Images.xcassets/AppIcon.appiconset/icon_16x16@2x.png -------------------------------------------------------------------------------- /JSONExport/Images.xcassets/AppIcon.appiconset/icon_256x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmed-Ali/JSONExport/9f1064fd05b6ed9b2e396147da9899071325a129/JSONExport/Images.xcassets/AppIcon.appiconset/icon_256x256.png -------------------------------------------------------------------------------- /JSONExport/Images.xcassets/AppIcon.appiconset/icon_256x256@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmed-Ali/JSONExport/9f1064fd05b6ed9b2e396147da9899071325a129/JSONExport/Images.xcassets/AppIcon.appiconset/icon_256x256@2x.png -------------------------------------------------------------------------------- /JSONExport/Images.xcassets/AppIcon.appiconset/icon_32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmed-Ali/JSONExport/9f1064fd05b6ed9b2e396147da9899071325a129/JSONExport/Images.xcassets/AppIcon.appiconset/icon_32x32.png -------------------------------------------------------------------------------- /JSONExport/Images.xcassets/AppIcon.appiconset/icon_32x32@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmed-Ali/JSONExport/9f1064fd05b6ed9b2e396147da9899071325a129/JSONExport/Images.xcassets/AppIcon.appiconset/icon_32x32@2x.png -------------------------------------------------------------------------------- /JSONExport/Images.xcassets/AppIcon.appiconset/icon_512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmed-Ali/JSONExport/9f1064fd05b6ed9b2e396147da9899071325a129/JSONExport/Images.xcassets/AppIcon.appiconset/icon_512x512.png -------------------------------------------------------------------------------- /JSONExport/Images.xcassets/AppIcon.appiconset/icon_512x512@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmed-Ali/JSONExport/9f1064fd05b6ed9b2e396147da9899071325a129/JSONExport/Images.xcassets/AppIcon.appiconset/icon_512x512@2x.png -------------------------------------------------------------------------------- /JSONExport/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0.8 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | $(MACOSX_DEPLOYMENT_TARGET) 27 | NSHumanReadableCopyright 28 | Copyright © 2014 Ahmed Ali. All rights reserved. 29 | NSMainStoryboardFile 30 | Main 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /JSONExport/JSONExport-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | 5 | #import "NoodleLineNumberView.h" 6 | -------------------------------------------------------------------------------- /JSONExport/LangModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LangModel.swift 3 | // 4 | // Create by Ahmed Ali on 14/11/2014 5 | // Copyright (c) 2014 Mobile Developer. All rights reserved. 6 | // 7 | 8 | import Foundation 9 | 10 | class LangModel{ 11 | 12 | var arrayType : String! 13 | var basicTypesWithSpecialFetchingNeeds : [String]! 14 | var basicTypesWithSpecialFetchingNeedsReplacements : [String]! 15 | var basicTypesWithSpecialFetchingNeedsTypeCast : [String]! 16 | var basicTypesWithSpecialStoringNeeds : [String]! 17 | var booleanGetter : String! 18 | var briefDescription : String! 19 | var constructors : [Constructor]! 20 | var dataTypes : DataType! 21 | var displayLangName : String! 22 | var fileExtension : String = "" 23 | var genericType : String! 24 | var getter : String! 25 | var importForEachCustomType : String! 26 | var importHeaderFile : String! 27 | var instanceVarDefinition : String! 28 | var instanceVarWithSpeicalDefinition : String! 29 | var typesNeedSpecialDefinition : [String]! 30 | var langName : String = "" 31 | var constVarDefinition : String! 32 | var modelDefinition : String! 33 | var modelDefinitionWithParent : String! 34 | var defaultParentWithUtilityMethods : String! 35 | var modelEnd : String! 36 | var modelStart : String = "" 37 | var setter : String! 38 | var staticImports : String! 39 | var supportsFirstLineStatement : Bool! 40 | var firstLineHint : String! 41 | var utilityMethods : [UtilityMethod]! 42 | var reservedKeywords : [String]! 43 | var wordsToRemoveToGetArrayElementsType : [String]! 44 | var headerFileData : HeaderFileData! 45 | var supportMutualRelationships : Bool! 46 | var author : Author! 47 | /** 48 | * Instantiate the instance using the passed dictionary values to set the properties values 49 | */ 50 | init(fromDictionary dictionary: NSDictionary){ 51 | arrayType = dictionary["arrayType"] as? String 52 | basicTypesWithSpecialFetchingNeeds = dictionary["basicTypesWithSpecialFetchingNeeds"] as? [String] 53 | basicTypesWithSpecialFetchingNeedsReplacements = dictionary["basicTypesWithSpecialFetchingNeedsReplacements"] as? [String] 54 | basicTypesWithSpecialFetchingNeedsTypeCast = dictionary["basicTypesWithSpecialFetchingNeedsTypeCast"] as? [String] 55 | basicTypesWithSpecialStoringNeeds = dictionary["basicTypesWithSpecialStoringNeeds"] as? [String] 56 | booleanGetter = dictionary["booleanGetter"] as? String 57 | briefDescription = dictionary["briefDescription"] as? String 58 | 59 | constructors = [Constructor]() 60 | if let constructorsArray = dictionary["constructors"] as? [NSDictionary]{ 61 | for dic in constructorsArray{ 62 | let value = Constructor(fromDictionary: dic) 63 | constructors.append(value) 64 | } 65 | } 66 | if let dataTypesData = dictionary["dataTypes"] as? NSDictionary{ 67 | dataTypes = DataType(fromDictionary: dataTypesData) 68 | } 69 | importHeaderFile = dictionary["importHeaderFile"] as? String 70 | displayLangName = dictionary["displayLangName"] as? String 71 | fileExtension = dictionary["fileExtension"] as! String 72 | genericType = dictionary["genericType"] as? String 73 | getter = dictionary["getter"] as? String 74 | importForEachCustomType = dictionary["importForEachCustomType"] as? String 75 | instanceVarDefinition = dictionary["instanceVarDefinition"] as? String 76 | instanceVarWithSpeicalDefinition = dictionary["instanceVarWithSpeicalDefinition"] as? String 77 | typesNeedSpecialDefinition = dictionary["typesNeedSpecialDefinition"] as? [String] 78 | 79 | langName = dictionary["langName"] as! String 80 | constVarDefinition = dictionary["constVarDefinition"] as? String 81 | modelDefinition = dictionary["modelDefinition"] as? String 82 | modelDefinitionWithParent = dictionary["modelDefinitionWithParent"] as? String 83 | defaultParentWithUtilityMethods = dictionary["defaultParentWithUtilityMethods"] as? String 84 | modelEnd = dictionary["modelEnd"] as? String 85 | if let mStart = dictionary["modelStart"] as? String{ 86 | modelStart = mStart 87 | } 88 | 89 | setter = dictionary["setter"] as? String 90 | staticImports = dictionary["staticImports"] as? String 91 | supportsFirstLineStatement = (dictionary["supportsFirstLineStatement"] as? NSString)?.boolValue 92 | firstLineHint = dictionary["firstLineHint"] as? String 93 | utilityMethods = [UtilityMethod]() 94 | if let utilityMethodsArray = dictionary["utilityMethods"] as? [NSDictionary]{ 95 | for dic in utilityMethodsArray{ 96 | let value = UtilityMethod(fromDictionary: dic) 97 | utilityMethods.append(value) 98 | } 99 | } 100 | reservedKeywords = dictionary["reservedKeywords"] as? [String] 101 | wordsToRemoveToGetArrayElementsType = dictionary["wordsToRemoveToGetArrayElementsType"] as? [String] 102 | 103 | if let headerFileDataData = dictionary["headerFileData"] as? NSDictionary{ 104 | headerFileData = HeaderFileData(fromDictionary: headerFileDataData) 105 | } 106 | 107 | supportMutualRelationships = (dictionary["supportMutualRelationships"] as? NSString)?.boolValue 108 | if let authorDictionary = dictionary["author"] as? NSDictionary{ 109 | author = Author(fromDictionary: authorDictionary) 110 | } 111 | } 112 | 113 | 114 | 115 | } 116 | -------------------------------------------------------------------------------- /JSONExport/NoodleLineNumberMarker.h: -------------------------------------------------------------------------------- 1 | // 2 | // NoodleLineNumberMarker.h 3 | // NoodleKit 4 | // 5 | // Created by Paul Kim on 9/30/08. 6 | // Copyright (c) 2008 Noodlesoft, LLC. All rights reserved. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the "Software"), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | #import 31 | 32 | /* 33 | Marker for NoodleLineNumberView. 34 | 35 | For more details, see the related blog post at: http://www.noodlesoft.com/blog/2008/10/05/displaying-line-numbers-with-nstextview/ 36 | */ 37 | 38 | @interface NoodleLineNumberMarker : NSRulerMarker 39 | { 40 | NSUInteger _lineNumber; 41 | } 42 | 43 | - (id)initWithRulerView:(NSRulerView *)aRulerView lineNumber:(CGFloat)line image:(NSImage *)anImage imageOrigin:(NSPoint)imageOrigin; 44 | 45 | - (void)setLineNumber:(NSUInteger)line; 46 | - (NSUInteger)lineNumber; 47 | 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /JSONExport/NoodleLineNumberMarker.m: -------------------------------------------------------------------------------- 1 | // 2 | // NoodleLineNumberMarker.m 3 | // NoodleKit 4 | // 5 | // Created by Paul Kim on 9/30/08. 6 | // Copyright (c) 2008 Noodlesoft, LLC. All rights reserved. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the "Software"), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | #import "NoodleLineNumberMarker.h" 31 | 32 | 33 | @implementation NoodleLineNumberMarker 34 | 35 | - (id)initWithRulerView:(NSRulerView *)aRulerView lineNumber:(CGFloat)line image:(NSImage *)anImage imageOrigin:(NSPoint)imageOrigin 36 | { 37 | if ((self = [super initWithRulerView:aRulerView markerLocation:0.0 image:anImage imageOrigin:imageOrigin]) != nil) 38 | { 39 | _lineNumber = line; 40 | } 41 | return self; 42 | } 43 | 44 | - (void)setLineNumber:(NSUInteger)line 45 | { 46 | _lineNumber = line; 47 | } 48 | 49 | - (NSUInteger)lineNumber 50 | { 51 | return _lineNumber; 52 | } 53 | 54 | #pragma mark NSCoding methods 55 | 56 | #define NOODLE_LINE_CODING_KEY @"line" 57 | 58 | - (id)initWithCoder:(NSCoder *)decoder 59 | { 60 | if ((self = [super initWithCoder:decoder]) != nil) 61 | { 62 | if ([decoder allowsKeyedCoding]) 63 | { 64 | _lineNumber = [[decoder decodeObjectForKey:NOODLE_LINE_CODING_KEY] unsignedIntegerValue]; 65 | } 66 | else 67 | { 68 | _lineNumber = [[decoder decodeObject] unsignedIntegerValue]; 69 | } 70 | } 71 | return self; 72 | } 73 | 74 | - (void)encodeWithCoder:(NSCoder *)encoder 75 | { 76 | [super encodeWithCoder:encoder]; 77 | 78 | if ([encoder allowsKeyedCoding]) 79 | { 80 | [encoder encodeObject:[NSNumber numberWithUnsignedInteger:_lineNumber] forKey:NOODLE_LINE_CODING_KEY]; 81 | } 82 | else 83 | { 84 | [encoder encodeObject:[NSNumber numberWithUnsignedInteger:_lineNumber]]; 85 | } 86 | } 87 | 88 | 89 | #pragma mark NSCopying methods 90 | 91 | - (id)copyWithZone:(NSZone *)zone 92 | { 93 | id copy; 94 | 95 | copy = [super copyWithZone:zone]; 96 | [copy setLineNumber:_lineNumber]; 97 | 98 | return copy; 99 | } 100 | 101 | 102 | @end 103 | -------------------------------------------------------------------------------- /JSONExport/NoodleLineNumberView.h: -------------------------------------------------------------------------------- 1 | // 2 | // NoodleLineNumberView.h 3 | // NoodleKit 4 | // 5 | // Created by Paul Kim on 9/28/08. 6 | // Copyright (c) 2008-2012 Noodlesoft, LLC. All rights reserved. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the "Software"), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | #import 31 | 32 | /* 33 | Displays line numbers for an NSTextView. 34 | 35 | For more details, see the related blog post at: http://www.noodlesoft.com/blog/2008/10/05/displaying-line-numbers-with-nstextview/ 36 | */ 37 | 38 | @class NoodleLineNumberMarker; 39 | 40 | @interface NoodleLineNumberView : NSRulerView 41 | { 42 | // Array of character indices for the beginning of each line 43 | NSMutableArray *_lineIndices; 44 | // When text is edited, this is the start of the editing region. All line calculations after this point are invalid 45 | // and need to be recalculated. 46 | NSUInteger _invalidCharacterIndex; 47 | 48 | // Maps line numbers to markers 49 | NSMutableDictionary *_linesToMarkers; 50 | 51 | NSFont *_font; 52 | NSColor *_textColor; 53 | NSColor *_alternateTextColor; 54 | NSColor *_backgroundColor; 55 | } 56 | 57 | @property (readwrite, retain) NSFont *font; 58 | @property (readwrite, retain) NSColor *textColor; 59 | @property (readwrite, retain) NSColor *alternateTextColor; 60 | @property (readwrite, retain) NSColor *backgroundColor; 61 | 62 | - (id)initWithScrollView:(NSScrollView *)aScrollView; 63 | 64 | - (NSUInteger)lineNumberForLocation:(CGFloat)location; 65 | - (NoodleLineNumberMarker *)markerAtLine:(NSUInteger)line; 66 | 67 | @end 68 | -------------------------------------------------------------------------------- /JSONExport/Property.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PropertyPresenter.swift 3 | // JSONExport 4 | // 5 | // Created by Ahmed on 11/2/14. 6 | // Copyright (c) 2014 Ahmed Ali. Eng.Ahmed.Ali.Awad@gmail.com. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // 1. Redistributions of source code must retain the above copyright 13 | // notice, this list of conditions and the following disclaimer. 14 | // 2. Redistributions in binary form must reproduce the above copyright 15 | // notice, this list of conditions and the following disclaimer in the 16 | // documentation and/or other materials provided with the distribution. 17 | // 3. The name of the contributor can not be used to endorse or promote products derived from this software 18 | // without specific prior written permission. 19 | // 20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 24 | // THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 25 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 29 | // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 31 | // OF THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | import Foundation 34 | 35 | /** 36 | Represents all the meta data needed to export a JSON property in a valid syntax for the target language 37 | */ 38 | class Property : Equatable{ 39 | 40 | /** 41 | The native name that is suitable to export the JSON property in the target language 42 | */ 43 | var nativeName : String 44 | 45 | /** 46 | The JSON property name to fetch the value of this property from a JSON object 47 | */ 48 | var jsonName : String 49 | 50 | var constName : String? 51 | 52 | /** 53 | The string representation for the property type 54 | */ 55 | var type : String 56 | 57 | /** 58 | Whether the property represents a custom type 59 | */ 60 | var isCustomClass : Bool 61 | 62 | /** 63 | Whether the property represents an array 64 | */ 65 | var isArray : Bool 66 | 67 | /** 68 | The target language model 69 | */ 70 | var lang : LangModel 71 | 72 | /** 73 | A sample value which this property represents 74 | */ 75 | var sampleValue : AnyObject! 76 | 77 | 78 | /** 79 | If this property is an array, this property should contain the type for its elements 80 | */ 81 | var elementsType = "" 82 | 83 | /** 84 | For array properties, depetermines if the elements type is a custom type 85 | */ 86 | var elementsAreOfCustomType = false 87 | 88 | /** 89 | Returns a valid property declaration using the LangModel.instanceVarDefinition value 90 | */ 91 | func toString(_ forHeaderFile: Bool = false) -> String 92 | { 93 | var string : String! 94 | if forHeaderFile{ 95 | if lang.headerFileData.instanceVarWithSpeicalDefinition != nil && lang.headerFileData.typesNeedSpecialDefinition.index(of: type) != nil{ 96 | string = lang.headerFileData.instanceVarWithSpeicalDefinition 97 | }else{ 98 | string = lang.headerFileData.instanceVarDefinition 99 | } 100 | 101 | 102 | }else{ 103 | if lang.instanceVarWithSpeicalDefinition != nil && lang.typesNeedSpecialDefinition.index(of: type) != nil{ 104 | string = lang.instanceVarWithSpeicalDefinition 105 | }else{ 106 | string = lang.instanceVarDefinition 107 | } 108 | } 109 | let typeName = isArray ? type : "\(type)?" 110 | string = string.replacingOccurrences(of: optionalVarType, with: typeName) 111 | string = string.replacingOccurrences(of: varType, with: type) 112 | string = string.replacingOccurrences(of: varName, with: nativeName) 113 | string = string.replacingOccurrences(of: jsonKeyName, with: jsonName) 114 | return string 115 | } 116 | 117 | func toConstVar(_ className: String) -> String 118 | { 119 | var string : String! 120 | if lang.constVarDefinition != nil { 121 | string = lang.constVarDefinition 122 | } else { 123 | string = "" 124 | } 125 | self.constName = "k"+className+nativeName.uppercaseFirstChar() 126 | 127 | string = string.replacingOccurrences(of: constKeyName, with: constName!) 128 | string = string.replacingOccurrences(of: jsonKeyName, with: jsonName) 129 | return string 130 | } 131 | 132 | 133 | /** 134 | The designated initializer for the class 135 | */ 136 | init(jsonName: String, nativeName: String, type: String, isArray: Bool, isCustomClass: Bool, lang: LangModel) 137 | { 138 | self.jsonName = jsonName.replacingOccurrences(of: " ", with: "") 139 | self.nativeName = nativeName.replacingOccurrences(of: " ", with: "") 140 | self.type = type 141 | self.isArray = isArray 142 | self.isCustomClass = isCustomClass 143 | self.lang = lang 144 | } 145 | 146 | 147 | /** 148 | Convenience initializer which calls the designated initializer with isArray = false and isCustomClass = false 149 | */ 150 | convenience init(jsonName: String, nativeName: String, type: String, lang: LangModel){ 151 | self.init(jsonName: jsonName, nativeName: nativeName, type: type, isArray: false, isCustomClass: false, lang: lang) 152 | } 153 | 154 | 155 | 156 | 157 | } 158 | 159 | //For Equatable implementation 160 | func ==(lhs: Property, rhs: Property) -> Bool 161 | { 162 | var matched = ObjectIdentifier(lhs) == ObjectIdentifier(rhs) 163 | if !matched{ 164 | matched = (lhs.nativeName == rhs.nativeName && lhs.jsonName == rhs.jsonName && lhs.type == rhs.type && lhs.isCustomClass == rhs.isCustomClass && lhs.isArray == rhs.isArray && lhs.elementsType == rhs.elementsType && lhs.elementsAreOfCustomType == rhs.elementsAreOfCustomType) 165 | } 166 | return matched 167 | } 168 | -------------------------------------------------------------------------------- /JSONExport/SharedConstants.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SharedConstants.swift 3 | // JSONExport 4 | // 5 | // Created by Ahmed on 11/7/14. 6 | // Copyright (c) 2014 Ahmed Ali. Eng.Ahmed.Ali.Awad@gmail.com. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // 1. Redistributions of source code must retain the above copyright 13 | // notice, this list of conditions and the following disclaimer. 14 | // 2. Redistributions in binary form must reproduce the above copyright 15 | // notice, this list of conditions and the following disclaimer in the 16 | // documentation and/or other materials provided with the distribution. 17 | // 3. The name of the contributor can not be used to endorse or promote products derived from this software 18 | // without specific prior written permission. 19 | // 20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 24 | // THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 25 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 29 | // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 31 | // OF THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | import Foundation 34 | 35 | let elementType = "" 36 | let modelName = "" 37 | let modelWithParentClassName = "" 38 | let varName = "" 39 | let capitalizedVarName = "" 40 | let varType = "" 41 | let optionalVarType = "" 42 | let varTypeReplacement = "" 43 | let varTypeCast = "" 44 | let capitalizedVarType = "" 45 | let lowerCaseVarType = "" 46 | let lowerCaseModelName = "" 47 | let jsonKeyName = "" 48 | let constKeyName = "" 49 | let additionalCustomTypeProperty = "" 50 | 51 | -------------------------------------------------------------------------------- /JSONExport/SharedUtilityMethods.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SharedUtilityMethods.swift 3 | // JSONExport 4 | // 5 | // Created by Ahmed Ali on 11/23/14. 6 | // Copyright (c) 2014 Ahmed Ali. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | 12 | /** 13 | Creats and returns the type name for the passed value 14 | 15 | - parameter value: example value to figure out its type 16 | - returns: the type name 17 | */ 18 | func propertyTypeName(_ value : AnyObject, lang: LangModel) -> String 19 | { 20 | var name = "" 21 | if value is NSArray{ 22 | name = typeNameForArrayOfElements(value as! NSArray, lang:lang) 23 | }else if value is NSNumber{ 24 | name = typeForNumber(value as! NSNumber, lang: lang) 25 | }else if value is NSString{ 26 | let booleans : [String] = ["True", "true", "TRUE", "False", "false", "FALSE"] 27 | if booleans.index(of: (value as! String)) != nil{ 28 | name = lang.dataTypes.boolType 29 | }else{ 30 | name = lang.dataTypes.stringType 31 | } 32 | }else if value is NSNull{ 33 | name = lang.genericType 34 | } 35 | 36 | return name 37 | } 38 | 39 | /** 40 | Tries to figur out the type of the elements of the passed array and returns the type that can be used as the type of any element in the array 41 | 42 | - parameter elements: array to try to find out which type is suitable for its elements 43 | 44 | - returns: typeName the type name as String 45 | */ 46 | 47 | func typeNameForArrayElements(_ elements: NSArray, lang: LangModel) -> String{ 48 | var typeName : String! 49 | let genericType = lang.genericType 50 | if elements.count == 0{ 51 | typeName = genericType 52 | } 53 | for element in elements{ 54 | let currElementTypeName = propertyTypeName(element as AnyObject, lang: lang) 55 | 56 | if typeName == nil{ 57 | typeName = currElementTypeName 58 | 59 | }else{ 60 | if typeName != currElementTypeName{ 61 | typeName = genericType 62 | break 63 | } 64 | } 65 | } 66 | 67 | return typeName 68 | } 69 | 70 | /** 71 | Tries to figur out the type of the elements of the passed array and returns the type of the array that can hold these values 72 | 73 | - parameter elements: array to try to find out which type is suitable for its elements 74 | 75 | - returns: the type name 76 | */ 77 | func typeNameForArrayOfElements(_ elements: NSArray, lang: LangModel) -> String{ 78 | var typeName : String! 79 | let genericType = lang.arrayType.replacingOccurrences(of: elementType, with: lang.genericType) 80 | if elements.count == 0{ 81 | typeName = genericType 82 | } 83 | for element in elements{ 84 | let currElementTypeName = propertyTypeName(element as AnyObject, lang: lang) 85 | 86 | let arrayTypeName = lang.arrayType.replacingOccurrences(of: elementType, with: currElementTypeName) 87 | 88 | if typeName == nil{ 89 | typeName = arrayTypeName 90 | 91 | }else{ 92 | if typeName != arrayTypeName{ 93 | typeName = genericType 94 | break 95 | } 96 | } 97 | } 98 | 99 | return typeName 100 | } 101 | 102 | /** 103 | Returns one of the possible types for any numeric value (int, float, double, etc...) 104 | 105 | - parameter number: the numeric value 106 | - returns: the type name 107 | */ 108 | func typeForNumber(_ number : NSNumber, lang: LangModel) -> String 109 | { 110 | let numberType = CFNumberGetType(number as CFNumber) 111 | 112 | var typeName : String! 113 | switch numberType{ 114 | case .charType: 115 | if (number.int32Value == 0 || number.int32Value == 1){ 116 | //it seems to be boolean 117 | typeName = lang.dataTypes.boolType 118 | }else{ 119 | typeName = lang.dataTypes.characterType 120 | } 121 | case .shortType, .intType: 122 | typeName = lang.dataTypes.intType 123 | case .floatType, .float32Type, .float64Type: 124 | typeName = lang.dataTypes.floatType 125 | case .doubleType: 126 | typeName = lang.dataTypes.doubleType 127 | case .longType, .longLongType: 128 | typeName = lang.dataTypes.longType 129 | default: 130 | typeName = lang.dataTypes.intType 131 | } 132 | 133 | return typeName 134 | } 135 | 136 | 137 | /** 138 | Creates and returns a dictionary who is built up by combining all the dictionary elements in the passed array. 139 | 140 | - parameter array: array of dictionaries. 141 | - returns: dictionary that combines all the dictionary elements in the array. 142 | */ 143 | func unionDictionaryFromArrayElements(_ array: NSArray) -> NSDictionary 144 | { 145 | let dictionary = NSMutableDictionary() 146 | for item in array{ 147 | if let dic = item as? NSDictionary{ 148 | //loop all over its keys 149 | for key in dic.allKeys as! [String]{ 150 | dictionary[key] = dic[key] 151 | } 152 | } 153 | } 154 | return dictionary 155 | } 156 | 157 | 158 | 159 | 160 | /** 161 | Cleans up the passed string from any control characters. 162 | 163 | - parameter string: the string to be cleaned up 164 | - returns: a clean version of the passed string 165 | */ 166 | 167 | func stringByRemovingControlCharacters(_ string: String) -> String 168 | { 169 | let controlChars = CharacterSet.controlCharacters 170 | var range = string.rangeOfCharacter(from: controlChars) 171 | var cleanString = string; 172 | while range != nil && !range!.isEmpty{ 173 | cleanString = cleanString.replacingCharacters(in: range!, with: "") 174 | range = cleanString.rangeOfCharacter(from: controlChars) 175 | } 176 | 177 | return cleanString 178 | 179 | } 180 | 181 | 182 | 183 | func runOnBackground(_ task: @escaping () -> Void) 184 | { 185 | DispatchQueue.global(qos: DispatchQoS.QoSClass.default).async { 186 | task(); 187 | } 188 | } 189 | 190 | func runOnUiThread(_ task: @escaping () -> Void) 191 | { 192 | DispatchQueue.main.async(execute: { () -> Void in 193 | task(); 194 | }) 195 | } 196 | 197 | -------------------------------------------------------------------------------- /JSONExport/StringExtension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // StringExtension.swift 3 | // JSONExport 4 | // 5 | // Created by Ahmed on 11/8/14. 6 | // Copyright (c) 2014 Ahmed Ali. Eng.Ahmed.Ali.Awad@gmail.com. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // 1. Redistributions of source code must retain the above copyright 13 | // notice, this list of conditions and the following disclaimer. 14 | // 2. Redistributions in binary form must reproduce the above copyright 15 | // notice, this list of conditions and the following disclaimer in the 16 | // documentation and/or other materials provided with the distribution. 17 | // 3. The name of the contributor can not be used to endorse or promote products derived from this software 18 | // without specific prior written permission. 19 | // 20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 24 | // THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 25 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 29 | // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 31 | // OF THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | import Foundation 34 | 35 | extension String{ 36 | /** 37 | Very simple method converts the last characters of a string to convert from plural to singular. For example "parties" will be changed to "party" and "stars" will be changed to "star" 38 | The method does not handle any special cases, like uncountable name i.e "people" will not be converted to "person" 39 | */ 40 | func toSingular() -> String 41 | { 42 | var singular = self 43 | let length = self.count 44 | if length > 3 { 45 | let range = self.index(self.endIndex, offsetBy: -3).. 2 { 55 | let range = self.index(self.endIndex, offsetBy: -1).. String{ 72 | if self.count > 0 { 73 | let range = self.startIndex.. String{ 90 | if self.count > 0 { 91 | let range = startIndex..[]", 8 | "dataTypes": { 9 | "intType": "int", 10 | "boolType": "boolean", 11 | "characterType": "char", 12 | "floatType": "float", 13 | "longType": "long", 14 | "doubleType": "double", 15 | "stringType": "String" 16 | }, 17 | "supportsFirstLineStatement" : "true", 18 | "firstLineHint" : "Package name", 19 | "staticImports": "import org.json.*;\nimport java.util.*;\nimport com.google.gson.annotations.SerializedName;\n", 20 | "importForEachCustomType": "", 21 | "modelDefinition": "\npublic class ", 22 | "modelDefinitionWithParent" : "\npublic class extends ", 23 | "modelStart": "{\n", 24 | "modelEnd": "\n}", 25 | "instanceVarDefinition": "\t@SerializedName(\"\")\n\tprivate ;\n", 26 | "setter" : "\tpublic void set( ){\n\t\tthis. = ;\n\t}\n", 27 | "getter" : "\tpublic get(){\n\t\treturn this.;\n\t}\n", 28 | "booleanGetter" : "\tpublic is()\n\t{\n\t\treturn this.;\n\t}\n", 29 | "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"], 30 | "wordsToRemoveToGetArrayElementsType": [ 31 | "[", 32 | "]" 33 | ], 34 | "basicTypesWithSpecialFetchingNeeds" : [ 35 | "Object", 36 | "String", 37 | "float" 38 | ], 39 | "basicTypesWithSpecialFetchingNeedsReplacements" : [ 40 | "", 41 | "String", 42 | "Double" 43 | ], 44 | "basicTypesWithSpecialFetchingNeedsTypeCast" : [ 45 | "", 46 | "", 47 | "float" 48 | ], 49 | "constructors": [ 50 | { 51 | "comment": "\t/**\n\t * Instantiate the instance using the passed jsonObject to set the properties values\n\t */\n", 52 | "signature": "\tpublic (JSONObject jsonObject)", 53 | "bodyStart": "{\n\t\tif(jsonObject == null){\n\t\t\treturn;\n\t\t}\n", 54 | "bodyEnd": "\t}\n", 55 | "fetchBasicTypePropertyFromMap": "\t\t = jsonObject.opt(\"\");\n", 56 | "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", 57 | "fetchBasicTypeWithSpecialNeedsPropertyFromMap": "\t\t = jsonObject.opt(\"\");\n", 58 | "fetchCustomTypePropertyFromMap": "\t\t = new (jsonObject.optJSONObject(\"\"));\n", 59 | "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}" 60 | } 61 | ], 62 | "utilityMethods": [ 63 | { 64 | "comment": "\t/**\n\t * Returns all the available property values in the form of JSONObject instance where the key is the approperiate json key and the value is the value of the corresponding field\n\t */\n", 65 | "signature": "\tpublic JSONObject toJsonObject()", 66 | "bodyStart": "\n\t{\n", 67 | "bodyEnd": "\t}\n", 68 | "body": "\t\tJSONObject jsonObject = new JSONObject();\n\t\ttry {\n", 69 | "forEachProperty": "\t\t\tjsonObject.put(\"\", );\n", 70 | "forEachCustomTypeProperty" : "\t\t\tjsonObject.put(\"\", .toJsonObject());\n", 71 | 72 | "forEachArrayOfCustomTypeProperty": "\t\t\tif( != null && .length > 0){\n\t\t\t\tJSONArray JsonArray = new JSONArray();\n\t\t\t\tfor( Element : ){\n\t\t\t\t\tJsonArray.put(Element.toJsonObject());\n\t\t\t\t}\n\t\t\t\tjsonObject.put(\"\", JsonArray);\n\t\t\t}\n", 73 | "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" 74 | } 75 | ] 76 | } 77 | -------------------------------------------------------------------------------- /JSONExport/Supported Languages/Java-Android Realm.json: -------------------------------------------------------------------------------- 1 | { 2 | "langName": "Java-Realm", 3 | "displayLangName": "Java Realm for Android", 4 | "briefDescription" : "Defines how your JSON objects can be mapped to Java classes using Android's org.json JSONObject with support to Realm.", 5 | "fileExtension": "java", 6 | "genericType": "Object", 7 | "arrayType": "RealmList<>", 8 | "dataTypes": { 9 | "intType": "int", 10 | "boolType": "boolean", 11 | "characterType": "char", 12 | "floatType": "float", 13 | "longType": "long", 14 | "doubleType": "double", 15 | "stringType": "String" 16 | }, 17 | "supportsFirstLineStatement" : "true", 18 | "firstLineHint" : "Package name", 19 | "staticImports": "import org.json.*;\nimport io.realm.*;\nimport io.realm.annotations.*;\n", 20 | "importForEachCustomType": "", 21 | "modelDefinition": "\n@RealmClass\npublic class extends RealmObject", 22 | "modelDefinitionWithParent" : "\npublic class extends ", 23 | "modelStart": "{\n", 24 | "modelEnd": "\n}", 25 | "instanceVarDefinition": "\tprivate ;\n", 26 | "setter" : "\tpublic void set( ){\n\t\tthis. = ;\n\t}\n", 27 | "getter" : "\tpublic get(){\n\t\treturn this.;\n\t}\n", 28 | "booleanGetter" : "\tpublic is()\n\t{\n\t\treturn this.;\n\t}\n", 29 | "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"], 30 | "wordsToRemoveToGetArrayElementsType": [ 31 | "RealmList", 32 | "<", 33 | ">" 34 | ], 35 | "basicTypesWithSpecialFetchingNeeds" : [ 36 | "Object", "String" 37 | ], 38 | "basicTypesWithSpecialFetchingNeedsReplacements" : [ 39 | 40 | "", "" 41 | ], 42 | "constructors": [ 43 | { 44 | "comment": "\t/**\n\t * Creates instance using the passed realm and jsonObject to set the properties values\n\t */\n", 45 | "signature": "\tpublic static fromJson(Realm realm, JSONObject jsonObject)", 46 | "bodyStart": "{\n\t\tif(jsonObject == null){\n\t\t\treturn null;\n\t\t}\n\t\t = realm.createObject(.class);\n", 47 | "bodyEnd": "\t\treturn ;\n\t}\n", 48 | "fetchBasicTypePropertyFromMap": "\t\t. = jsonObject.opt(\"\");\n", 49 | "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", 50 | "fetchBasicTypeWithSpecialNeedsPropertyFromMap": "\t\t. = jsonObject.opt(\"\");\n", 51 | "fetchCustomTypePropertyFromMap": "\t\t. = .fromJson(realm, jsonObject.optJSONObject(\"\"));\n", 52 | "fetchArrayOfCustomTypePropertyFromMap": "\t\tJSONArray JsonArray = jsonObject.optJSONArray(\"\");\n\t\tif(JsonArray != null){\n\t\t\tfor (int i = 0; i < JsonArray.length(); i++) {\n\t\t\t\tJSONObject Object = JsonArray.optJSONObject(i);\n\t\t\t\t Value = .fromJson(realm, Object);\n\t\t\t\tif(Value != null){\n\t\t\t\t\t.get().add(Value);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n" 53 | } 54 | ], 55 | "utilityMethods": [ 56 | { 57 | "comment": "\t/**\n\t * Returns all the available property values in the form of JSONObject instance where the key is the approperiate json key and the value is the value of the corresponding field\n\t */\n", 58 | "signature": "\tpublic static JSONObject toJsonObject( )", 59 | "bodyStart": "\n\t{\n", 60 | "bodyEnd": "\t}\n", 61 | "body": "\t\tJSONObject jsonObject = new JSONObject();\n\t\ttry {\n", 62 | "forEachProperty": "\t\t\tjsonObject.put(\"\", .);\n", 63 | "forEachCustomTypeProperty" : "\t\t\tjsonObject.put(\"\", .toJsonObject(.));\n", 64 | 65 | "forEachArrayOfCustomTypeProperty": "\t\t\tif(. != null && ..size() > 0){\n\t\t\t\tJSONArray JsonArray = new JSONArray();\n\t\t\t\tfor( Element : .){\n\t\t\t\t\tJsonArray.put(.toJsonObject(Element));\n\t\t\t\t}\n\t\t\t\tjsonObject.put(\"\", JsonArray);\n\t\t\t}\n", 66 | "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" 67 | } 68 | ] 69 | } -------------------------------------------------------------------------------- /JSONExport/Supported Languages/Java-Android.json: -------------------------------------------------------------------------------- 1 | { 2 | "langName": "Java", 3 | "displayLangName": "Java for Android", 4 | "briefDescription" : "Defines how your JSON objects can be mapped to Java classes using Android's org.json JSONObject.", 5 | "fileExtension": "java", 6 | "genericType": "Object", 7 | "arrayType": "[]", 8 | "dataTypes": { 9 | "intType": "int", 10 | "boolType": "boolean", 11 | "characterType": "char", 12 | "floatType": "float", 13 | "longType": "long", 14 | "doubleType": "double", 15 | "stringType": "String" 16 | }, 17 | "supportsFirstLineStatement" : "true", 18 | "firstLineHint" : "Package name", 19 | "staticImports": "import org.json.*;\nimport java.util.*;\n", 20 | "importForEachCustomType": "", 21 | "modelDefinition": "\npublic class ", 22 | "modelDefinitionWithParent" : "\npublic class extends ", 23 | "modelStart": "{\n", 24 | "modelEnd": "\n}", 25 | "instanceVarDefinition": "\tprivate ;\n", 26 | "setter" : "\tpublic void set( ){\n\t\tthis. = ;\n\t}\n", 27 | "getter" : "\tpublic get(){\n\t\treturn this.;\n\t}\n", 28 | "booleanGetter" : "\tpublic is()\n\t{\n\t\treturn this.;\n\t}\n", 29 | "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"], 30 | "wordsToRemoveToGetArrayElementsType": [ 31 | "[", 32 | "]" 33 | ], 34 | "basicTypesWithSpecialFetchingNeeds" : [ 35 | "Object", 36 | "String" 37 | ], 38 | "basicTypesWithSpecialFetchingNeedsReplacements" : [ 39 | 40 | "","" 41 | ], 42 | "constructors": [ 43 | { 44 | "comment": "\t/**\n\t * Instantiate the instance using the passed jsonObject to set the properties values\n\t */\n", 45 | "signature": "\tpublic (JSONObject jsonObject)", 46 | "bodyStart": "{\n\t\tif(jsonObject == null){\n\t\t\treturn;\n\t\t}\n", 47 | "bodyEnd": "\t}\n", 48 | "fetchBasicTypePropertyFromMap": "\t\t = jsonObject.opt(\"\");\n", 49 | "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", 50 | "fetchBasicTypeWithSpecialNeedsPropertyFromMap": "\t\t = jsonObject.opt(\"\");\n", 51 | "fetchCustomTypePropertyFromMap": "\t\t = new (jsonObject.optJSONObject(\"\"));\n", 52 | "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}" 53 | } 54 | ], 55 | "utilityMethods": [ 56 | { 57 | "comment": "\t/**\n\t * Returns all the available property values in the form of JSONObject instance where the key is the approperiate json key and the value is the value of the corresponding field\n\t */\n", 58 | "signature": "\tpublic JSONObject toJsonObject()", 59 | "bodyStart": "\n\t{\n", 60 | "bodyEnd": "\t}\n", 61 | "body": "\t\tJSONObject jsonObject = new JSONObject();\n\t\ttry {\n", 62 | "forEachProperty": "\t\t\tjsonObject.put(\"\", );\n", 63 | "forEachCustomTypeProperty" : "\t\t\tjsonObject.put(\"\", .toJsonObject());\n", 64 | 65 | "forEachArrayOfCustomTypeProperty": "\t\t\tif( != null && .length > 0){\n\t\t\t\tJSONArray JsonArray = new JSONArray();\n\t\t\t\tfor( Element : ){\n\t\t\t\t\tJsonArray.put(Element.toJsonObject());\n\t\t\t\t}\n\t\t\t\tjsonObject.put(\"\", JsonArray);\n\t\t\t}\n", 66 | "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" 67 | } 68 | ] 69 | } -------------------------------------------------------------------------------- /JSONExport/Supported Languages/ObjectiveC-CoreData-iOS.json: -------------------------------------------------------------------------------- 1 | { 2 | "langName": "ObjectiveC-CD-iOS", 3 | "displayLangName": "ObjectiveC - CoreData", 4 | "briefDescription": "Defines how your JSON objects can be mapped to Objective-c NSManagedObject subclasses using the built-in NSJSONSerialization class", 5 | "fileExtension": "m", 6 | "genericType": "NSObject", 7 | "arrayType": "NSSet", 8 | "dataTypes": { 9 | "intType": "NSInteger", 10 | "boolType": "BOOL", 11 | "characterType": "char", 12 | "floatType": "float", 13 | "longType": "long", 14 | "doubleType": "double", 15 | "stringType": "NSString" 16 | }, 17 | "supportsFirstLineStatement": "false", 18 | "supportMutualRelationships" : "true", 19 | "staticImports": "", 20 | "importForEachCustomType": "#import \".h\"\n", 21 | "importHeaderFile": "#import \".h\"\n", 22 | "modelDefinition": "\n@interface ()\n@end\n@implementation \n", 23 | "modelStart": "", 24 | "modelEnd": "@end", 25 | "instanceVarDefinition": "@dynamic ;\n", 26 | "hasHeaderFile": true, 27 | "headerFileData": { 28 | "staticImports": "#import ", 29 | "importForEachCustomType": "@class ;\n", 30 | "importParentHeaderFile" : "#import \".h\"\n", 31 | "modelDefinition": "\n@interface : NSManagedObject\n", 32 | "modelDefinitionWithParent" : "\n@interface : \n", 33 | "modelStart": "", 34 | "modelEnd": "@end", 35 | "instanceVarDefinition": "@property (nonatomic, strong) * ;\n", 36 | "instanceVarWithSpeicalDefinition": "@property (nonatomic, assign) ;\n", 37 | "typesNeedSpecialDefinition" : [ 38 | "NSInteger", 39 | "BOOL", 40 | "char", 41 | "float", 42 | "double", 43 | "long" 44 | ], 45 | 46 | "headerFileExtension": "h", 47 | "constructorSignatures": [ 48 | "-(instancetype)initWithDictionary:(NSDictionary *)dictionary context:(NSManagedObjectContext *)context;\n" 49 | ], 50 | "utilityMethodSignatures": [ 51 | "-(NSDictionary *)toDictionary;\n" 52 | ] 53 | }, 54 | "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", "id", "class", "description"], 55 | "wordsToRemoveToGetArrayElementsType": [ 56 | "NSSet", 57 | "NSMutableSet" 58 | ], 59 | "basicTypesWithSpecialFetchingNeeds": [ 60 | "NSInteger", 61 | "BOOL", 62 | "char", 63 | "float", 64 | "double", 65 | "long" 66 | ], 67 | "basicTypesWithSpecialFetchingNeedsReplacements": [ 68 | "integerValue", 69 | "boolValue", 70 | "charValue", 71 | "floatValue", 72 | "doubleValue", 73 | "longValue" 74 | ], 75 | "basicTypesWithSpecialStoringNeeds": [ 76 | "NSInteger", 77 | "BOOL", 78 | "char", 79 | "float", 80 | "double", 81 | "long" 82 | ], 83 | "constructors": [ 84 | { 85 | "comment": "\n/**\n * Instantiate the instance using the passed dictionary values to set the properties values\n */\n", 86 | "signature": "\n-(instancetype)initWithDictionary:(NSDictionary *)dictionary context:(NSManagedObjectContext *)context\n", 87 | "bodyStart": "{\n\tif(dictionary == nil || [dictionary isKindOfClass:[NSNull class]]){\n\t\treturn nil;\n\t}\n\tNSEntityDescription * entityDescription = [NSEntityDescription entityForName:@\"\" inManagedObjectContext:context];\n\tself = [super initWithEntity:entityDescription insertIntoManagedObjectContext:context];\n", 88 | "bodyEnd": "\n\treturn self;\n}\n", 89 | "fetchBasicTypePropertyFromMap": "\n\tif(![dictionary[@\"\"] isKindOfClass:[NSNull class]]){\n\t\tself. = dictionary[@\"\"];\n\t}\n", 90 | "fetchBasicTypeWithSpecialNeedsPropertyFromMap": "\n\tif(![dictionary[@\"\"] isKindOfClass:[NSNull class]]){\n\t\tself. = [dictionary[@\"\"] ];\n\t}\n", 91 | "fetchCustomTypePropertyFromMap": "\n\tif(![dictionary[@\"\"] isKindOfClass:[NSNull class]]){\n\t\tself. = [[ alloc] initWithDictionary:dictionary[@\"\"] context:context];\n\t}\n", 92 | "fetchArrayOfCustomTypePropertyFromMap": "\n\tif(dictionary[@\"\"] != nil && [dictionary[@\"\"] isKindOfClass:[NSNull class]]){\n\t\tNSArray * Dictionaries = dictionary[@\"\"];\n\t\tNSMutableSet * Items = [NSMutableSet set];\n\t\tfor(NSDictionary * Dictionary in Dictionaries){\n\t\t\t * Item = [[ alloc] initWithDictionary:Dictionary context:context];\n\t\t\t[Items addObject:Item];\n\t\t}\n\t\tself. = Items;\n\t}" 93 | } 94 | ], 95 | "utilityMethods": [ 96 | { 97 | "comment": "\n/**\n * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property\n */\n", 98 | "signature": "-(NSDictionary *)toDictionary", 99 | "bodyStart": "\n{\n", 100 | "bodyEnd": "\n}\n", 101 | "body": "\tNSMutableDictionary * dictionary = [NSMutableDictionary dictionary];\n", 102 | "forEachPropertyWithSpecialStoringNeeds": "\tdictionary[@\"\"] = @(self.);\n", 103 | "forEachProperty": "\tif(self. != nil){\n\t\tdictionary[@\"\"] = self.;\n\t}\n", 104 | "forEachCustomTypeProperty": "\tif(self. != nil){\n\t\tdictionary[@\"\"] = [self. toDictionary];\n\t}\n", 105 | "forEachArrayOfCustomTypeProperty": "\tif(self. != nil){\n\t\tNSMutableArray * dictionaryElements = [NSMutableArray array];\n\t\tfor( * Element in self.){\n\t\t\t[dictionaryElements addObject:[Element toDictionary]];\n\t\t}\n\t\tdictionary[@\"\"] = dictionaryElements;\n\t}\n", 106 | "returnStatement": "\treturn dictionary;\n" 107 | } 108 | ] 109 | } -------------------------------------------------------------------------------- /JSONExport/Supported Languages/ObjectiveC-Mac.json: -------------------------------------------------------------------------------- 1 | { 2 | "langName": "ObjectiveC - Mac", 3 | "displayLangName": "ObjectiveC - Mac", 4 | "briefDescription": "Defines how your JSON objects can be mapped to Objective-c classes using the built-in NSJSONSerialization class", 5 | "fileExtension": "m", 6 | "genericType": "NSObject", 7 | "arrayType": "NSArray", 8 | "dataTypes": { 9 | "intType": "NSInteger", 10 | "boolType": "BOOL", 11 | "characterType": "char", 12 | "floatType": "CGFloat", 13 | "longType": "long", 14 | "doubleType": "double", 15 | "stringType": "NSString" 16 | }, 17 | "supportsFirstLineStatement": "false", 18 | "staticImports": "", 19 | "importForEachCustomType": "", 20 | "importHeaderFile": "#import \".h\"\n", 21 | "constVarDefinition": "NSString *const = @\"\";\n", 22 | "modelDefinition": "\n@interface ()\n@end\n@implementation \n", 23 | "modelStart": "", 24 | "modelEnd": "@end", 25 | "instanceVarDefinition": "", 26 | "hasHeaderFile": true, 27 | "headerFileData": { 28 | "staticImports": "#import ", 29 | "importForEachCustomType": "#import \".h\"\n", 30 | "importParentHeaderFile": "#import \".h\"\n", 31 | "modelDefinition": "\n@interface : NSObject\n", 32 | "modelDefinitionWithParent": "\n@interface : \n", 33 | "modelStart": "", 34 | "modelEnd": "@end", 35 | "instanceVarDefinition": "@property (nonatomic, strong) * ;\n", 36 | "instanceVarWithSpeicalDefinition": "@property (nonatomic, assign) ;\n", 37 | "typesNeedSpecialDefinition": [ 38 | "NSInteger", 39 | "BOOL", 40 | "char", 41 | "CGFloat", 42 | "double", 43 | "long" 44 | ], 45 | "headerFileExtension": "h", 46 | "constructorSignatures": [ 47 | "-(instancetype)initWithDictionary:(NSDictionary *)dictionary;\n" 48 | ], 49 | "utilityMethodSignatures": [ 50 | "-(NSDictionary *)toDictionary;\n" 51 | ] 52 | }, 53 | "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", "id", "class", "description"], 54 | "wordsToRemoveToGetArrayElementsType": [ 55 | "NSArray", 56 | "NSMutableArray" 57 | ], 58 | "basicTypesWithSpecialFetchingNeeds": [ 59 | "NSInteger", 60 | "BOOL", 61 | "char", 62 | "CGFloat", 63 | "double", 64 | "long" 65 | ], 66 | "basicTypesWithSpecialFetchingNeedsReplacements": [ 67 | "integerValue", 68 | "boolValue", 69 | "charValue", 70 | "floatValue", 71 | "doubleValue", 72 | "longValue" 73 | ], 74 | "basicTypesWithSpecialStoringNeeds": [ 75 | "NSInteger", 76 | "BOOL", 77 | "char", 78 | "CGFloat", 79 | "double", 80 | "long" 81 | ], 82 | "constructors": [ 83 | { 84 | "comment": "\n/**\n * Instantiate the instance using the passed dictionary values to set the properties values\n */\n", 85 | "signature": "\n-(instancetype)initWithDictionary:(NSDictionary *)dictionary\n", 86 | "bodyStart": "{\n\tself = [super init];", 87 | "bodyEnd": "\n\treturn self;\n}\n", 88 | "fetchBasicTypePropertyFromMap": "\n\tif(![dictionary[] isKindOfClass:[NSNull class]]){\n\t\tself. = dictionary[];\n\t}\n", 89 | "fetchBasicTypeWithSpecialNeedsPropertyFromMap": "\n\tif(![dictionary[] isKindOfClass:[NSNull class]]){\n\t\tself. = [dictionary[] ];\n\t}\n", 90 | "fetchCustomTypePropertyFromMap": "\n\tif(![dictionary[] isKindOfClass:[NSNull class]]){\n\t\tself. = [[ alloc] initWithDictionary:dictionary[]];\n\t}\n", 91 | "fetchArrayOfCustomTypePropertyFromMap": "\n\tif(dictionary[] != nil && [dictionary[] isKindOfClass:[NSArray class]]){\n\t\tNSArray * Dictionaries = dictionary[];\n\t\tNSMutableArray * Items = [NSMutableArray array];\n\t\tfor(NSDictionary * Dictionary in Dictionaries){\n\t\t\t * Item = [[ alloc] initWithDictionary:Dictionary];\n\t\t\t[Items addObject:Item];\n\t\t}\n\t\tself. = Items;\n\t}" 92 | } 93 | ], 94 | "utilityMethods": [ 95 | { 96 | "comment": "\n/**\n * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property\n */\n", 97 | "signature": "-(NSDictionary *)toDictionary", 98 | "bodyStart": "\n{\n", 99 | "bodyEnd": "\n}\n", 100 | "body": "\tNSMutableDictionary * dictionary = [NSMutableDictionary dictionary];\n", 101 | "forEachPropertyWithSpecialStoringNeeds": "\tdictionary[] = @(self.);\n", 102 | "forEachProperty": "\tif(self. != nil){\n\t\tdictionary[] = self.;\n\t}\n", 103 | "forEachCustomTypeProperty": "\tif(self. != nil){\n\t\tdictionary[] = [self. toDictionary];\n\t}\n", 104 | "forEachArrayOfCustomTypeProperty": "\tif(self. != nil){\n\t\tNSMutableArray * dictionaryElements = [NSMutableArray array];\n\t\tfor( * Element in self.){\n\t\t\t[dictionaryElements addObject:[Element toDictionary]];\n\t\t}\n\t\tdictionary[] = dictionaryElements;\n\t}\n", 105 | "returnStatement": "\treturn dictionary;\n" 106 | }, 107 | { 108 | "forEachProperty": "\tif(self. != nil){\n\t\t[aCoder encodeObject:self. forKey:];\n\t}\n", 109 | "bodyEnd": "\n}\n", 110 | "signature": "- (void)encodeWithCoder:(NSCoder *)aCoder", 111 | "forEachPropertyWithSpecialStoringNeeds": "\t[aCoder encodeObject:@(self.) forKey:];", 112 | "forEachArrayOfCustomTypeProperty": "\tif(self. != nil){\n\t\t[aCoder encodeObject:self. forKey:];\n\t}\n", 113 | "forEachCustomTypeProperty": "\tif(self. != nil){\n\t\t[aCoder encodeObject:self. forKey:];\n\t}\n", 114 | "returnStatement": "", 115 | "body": "", 116 | "comment": "\n/**\n * Implementation of NSCoding encoding method\n */\n/**\n * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property\n */\n", 117 | "bodyStart": "\n{\n" 118 | }, 119 | { 120 | "forEachProperty": "\tself. = [aDecoder decodeObjectForKey:];\n", 121 | "bodyEnd": "\n}\n", 122 | "signature": "- (instancetype)initWithCoder:(NSCoder *)aDecoder", 123 | "forEachPropertyWithSpecialStoringNeeds": "\tself. = [[aDecoder decodeObjectForKey:] ];\n", 124 | "forEachArrayOfCustomTypeProperty": "\tself. = [aDecoder decodeObjectForKey:];\n", 125 | "forEachCustomTypeProperty": "\tself. = [aDecoder decodeObjectForKey:];\n", 126 | "returnStatement": "\treturn self;\n", 127 | "body": "\tself = [super init];\n", 128 | "comment": "\n/**\n * Implementation of NSCoding initWithCoder: method\n */\n", 129 | "bodyStart": "\n{\n" 130 | }, 131 | { 132 | "forEachProperty": "\tcopy. = [self. copy];\n", 133 | "bodyEnd": "\n}\n", 134 | "signature": "- (instancetype)copyWithZone:(NSZone *)zone", 135 | "forEachPropertyWithSpecialStoringNeeds": "\tcopy. = self.;\n", 136 | "forEachArrayOfCustomTypeProperty": "\tcopy. = [self. copy];\n", 137 | "forEachCustomTypeProperty": "\tcopy. = [self. copy];\n", 138 | "returnStatement": "\n\treturn copy;", 139 | "body": "\t *copy = [ new];\n\n", 140 | "comment": "\n/**\n * Implementation of NSCopying copyWithZone: method\n */\n", 141 | "bodyStart": "\n{\n" 142 | } 143 | ] 144 | } 145 | -------------------------------------------------------------------------------- /JSONExport/Supported Languages/ObjectiveC-iOS.json: -------------------------------------------------------------------------------- 1 | { 2 | "langName": "ObjectiveC - iOS", 3 | "hasHeaderFile": true, 4 | "modelStart": "", 5 | "basicTypesWithSpecialFetchingNeedsReplacements": [ 6 | "integerValue", 7 | "boolValue", 8 | "charValue", 9 | "floatValue", 10 | "doubleValue", 11 | "longValue" 12 | ], 13 | "basicTypesWithSpecialStoringNeeds": [ 14 | "NSInteger", 15 | "BOOL", 16 | "char", 17 | "CGFloat", 18 | "double", 19 | "long" 20 | ], 21 | "importForEachCustomType": "", 22 | "reservedKeywords": [ 23 | "abstract", 24 | "assert", 25 | "boolean", 26 | "break", 27 | "byte", 28 | "case", 29 | "catch", 30 | "char", 31 | "class", 32 | "const", 33 | "continue", 34 | "default", 35 | "do", 36 | "double", 37 | "else", 38 | "enum", 39 | "extends", 40 | "false", 41 | "final", 42 | "finally", 43 | "float", 44 | "for", 45 | "goto", 46 | "if", 47 | "implements", 48 | "import", 49 | "instanceof", 50 | "int", 51 | "interface", 52 | "long", 53 | "native", 54 | "new", 55 | "null", 56 | "package", 57 | "private", 58 | "protected", 59 | "public", 60 | "return", 61 | "short", 62 | "static", 63 | "strictfp", 64 | "super", 65 | "switch", 66 | "synchronized", 67 | "this", 68 | "throw", 69 | "throws", 70 | "transient", 71 | "true", 72 | "try", 73 | "void", 74 | "volatile", 75 | "while", 76 | "id", 77 | "class", 78 | "description" 79 | ], 80 | "briefDescription": "Defines how your JSON objects can be mapped to Objective-c classes using the built-in NSJSONSerialization class", 81 | "utilityMethods": [ 82 | { 83 | "forEachProperty": "\tif(self. != nil){\n\t\tdictionary[] = self.;\n\t}\n", 84 | "bodyEnd": "\n}\n", 85 | "signature": "-(NSDictionary *)toDictionary", 86 | "forEachPropertyWithSpecialStoringNeeds": "\tdictionary[] = @(self.);\n", 87 | "forEachArrayOfCustomTypeProperty": "\tif(self. != nil){\n\t\tNSMutableArray * dictionaryElements = [NSMutableArray array];\n\t\tfor( * Element in self.){\n\t\t\t[dictionaryElements addObject:[Element toDictionary]];\n\t\t}\n\t\tdictionary[] = dictionaryElements;\n\t}\n", 88 | "forEachCustomTypeProperty": "\tif(self. != nil){\n\t\tdictionary[] = [self. toDictionary];\n\t}\n", 89 | "returnStatement": "\treturn dictionary;\n", 90 | "body": "\tNSMutableDictionary * dictionary = [NSMutableDictionary dictionary];\n", 91 | "comment": "\n/**\n * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property\n */\n", 92 | "bodyStart": "\n{\n" 93 | }, 94 | { 95 | "forEachProperty": "\tif(self. != nil){\n\t\t[aCoder encodeObject:self. forKey:];\n\t}\n", 96 | "bodyEnd": "\n}\n", 97 | "signature": "- (void)encodeWithCoder:(NSCoder *)aCoder", 98 | "forEachPropertyWithSpecialStoringNeeds": "\t[aCoder encodeObject:@(self.) forKey:];", 99 | "forEachArrayOfCustomTypeProperty": "\tif(self. != nil){\n\t\t[aCoder encodeObject:self. forKey:];\n\t}\n", 100 | "forEachCustomTypeProperty": "\tif(self. != nil){\n\t\t[aCoder encodeObject:self. forKey:];\n\t}\n", 101 | "returnStatement": "", 102 | "body": "", 103 | "comment": "\n/**\n * Implementation of NSCoding encoding method\n */\n/**\n * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property\n */\n", 104 | "bodyStart": "\n{\n" 105 | }, 106 | { 107 | "forEachProperty": "\tself. = [aDecoder decodeObjectForKey:];\n", 108 | "bodyEnd": "\n}\n", 109 | "signature": "- (instancetype)initWithCoder:(NSCoder *)aDecoder", 110 | "forEachPropertyWithSpecialStoringNeeds": "\tself. = [[aDecoder decodeObjectForKey:] ];\n", 111 | "forEachArrayOfCustomTypeProperty": "\tself. = [aDecoder decodeObjectForKey:];\n", 112 | "forEachCustomTypeProperty": "\tself. = [aDecoder decodeObjectForKey:];\n", 113 | "returnStatement": "\treturn self;\n", 114 | "body": "\tself = [super init];\n", 115 | "comment": "\n/**\n * Implementation of NSCoding initWithCoder: method\n */\n", 116 | "bodyStart": "\n{\n" 117 | }, 118 | { 119 | "forEachProperty": "\tcopy. = [self. copy];\n", 120 | "bodyEnd": "\n}\n", 121 | "signature": "- (instancetype)copyWithZone:(NSZone *)zone", 122 | "forEachPropertyWithSpecialStoringNeeds": "\tcopy. = self.;\n", 123 | "forEachArrayOfCustomTypeProperty": "\tcopy. = [self. copy];\n", 124 | "forEachCustomTypeProperty": "\tcopy. = [self. copy];\n", 125 | "returnStatement": "\n\treturn copy;", 126 | "body": "\t *copy = [ new];\n\n", 127 | "comment": "\n/**\n * Implementation of NSCopying copyWithZone: method\n */\n", 128 | "bodyStart": "\n{\n" 129 | } 130 | ], 131 | "dataTypes": { 132 | "stringType": "NSString", 133 | "boolType": "BOOL", 134 | "floatType": "CGFloat", 135 | "doubleType": "double", 136 | "characterType": "char", 137 | "longType": "long", 138 | "intType": "NSInteger" 139 | }, 140 | "wordsToRemoveToGetArrayElementsType": [ 141 | "NSArray", 142 | "NSMutableArray" 143 | ], 144 | "constructors": [ 145 | { 146 | "fetchBasicTypeWithSpecialNeedsPropertyFromMap": "\n\tif(![dictionary[] isKindOfClass:[NSNull class]]){\n\t\tself. = [dictionary[] ];\n\t}\n", 147 | "fetchCustomTypePropertyFromMap": "\n\tif(![dictionary[] isKindOfClass:[NSNull class]]){\n\t\tself. = [[ alloc] initWithDictionary:dictionary[]];\n\t}\n", 148 | "bodyEnd": "\n\treturn self;\n}\n", 149 | "fetchBasicTypePropertyFromMap": "\n\tif(![dictionary[] isKindOfClass:[NSNull class]]){\n\t\tself. = dictionary[];\n\t}\t", 150 | "signature": "\n-(instancetype)initWithDictionary:(NSDictionary *)dictionary\n", 151 | "fetchArrayOfCustomTypePropertyFromMap": "\n\tif(dictionary[] != nil && [dictionary[] isKindOfClass:[NSArray class]]){\n\t\tNSArray * Dictionaries = dictionary[];\n\t\tNSMutableArray * Items = [NSMutableArray array];\n\t\tfor(NSDictionary * Dictionary in Dictionaries){\n\t\t\t * Item = [[ alloc] initWithDictionary:Dictionary];\n\t\t\t[Items addObject:Item];\n\t\t}\n\t\tself. = Items;\n\t}", 152 | "comment": "\n/**\n * Instantiate the instance using the passed dictionary values to set the properties values\n */\n", 153 | "bodyStart": "{\n\tself = [super init];" 154 | } 155 | ], 156 | "constVarDefinition": "NSString *const = @\"\";\n", 157 | "modelDefinition": "\n@interface ()\n@end\n@implementation \n", 158 | "genericType": "NSObject", 159 | "headerFileData": { 160 | "modelDefinitionWithParent": "\n@interface : \n", 161 | "modelEnd": "@end", 162 | "instanceVarDefinition": "@property (nonatomic, strong) * ;\n", 163 | "utilityMethodSignatures": [ 164 | "-(NSDictionary *)toDictionary;\n" 165 | ], 166 | "constructorSignatures": [ 167 | "-(instancetype)initWithDictionary:(NSDictionary *)dictionary;\n" 168 | ], 169 | "typesNeedSpecialDefinition": [ 170 | "NSInteger", 171 | "BOOL", 172 | "char", 173 | "CGFloat", 174 | "double", 175 | "long" 176 | ], 177 | "modelStart": "", 178 | "importParentHeaderFile": "#import \".h\"\n", 179 | "headerFileExtension": "h", 180 | "modelDefinition": "\n@interface : NSObject\n", 181 | "importForEachCustomType": "#import \".h\"\n", 182 | "instanceVarWithSpeicalDefinition": "@property (nonatomic, assign) ;\n", 183 | "staticImports": "#import " 184 | }, 185 | "fileExtension": "m", 186 | "arrayType": "NSArray", 187 | "basicTypesWithSpecialFetchingNeeds": [ 188 | "NSInteger", 189 | "BOOL", 190 | "char", 191 | "CGFloat", 192 | "double", 193 | "long" 194 | ], 195 | "displayLangName": "ObjectiveC - iOS", 196 | "instanceVarDefinition": "", 197 | "supportsFirstLineStatement": "false", 198 | "modelEnd": "@end", 199 | "staticImports": "", 200 | "importHeaderFile": "#import \".h\"\n" 201 | } 202 | -------------------------------------------------------------------------------- /JSONExport/Supported Languages/Swift-Class.json: -------------------------------------------------------------------------------- 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 classes using the built-in NSJSONSerialization class", 63 | "utilityMethods": [ 64 | { 65 | "forEachProperty": "\t\tif != nil{\n\t\t\tdictionary[\"\"] = \n\t\t}\n", 66 | "bodyEnd": "\t}\n", 67 | "signature": "\tfunc toDictionary() -> [String:Any]", 68 | "forEachCustomTypeProperty": "\t\tif != nil{\n\t\t\tdictionary[\"\"] = .toDictionary()\n\t\t}\n", 69 | "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", 70 | "returnStatement": "\t\treturn dictionary\n", 71 | "body": "\t\tvar dictionary = [String:Any]()\n", 72 | "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", 73 | "bodyStart": "\n\t{\n" 74 | }, 75 | { 76 | "forEachProperty": " = aDecoder.decodeObject(forKey: \"\") as? \n", 77 | "bodyEnd": "\n\t}\n", 78 | "signature": " @objc required init(coder aDecoder: NSCoder)", 79 | "forEachCustomTypeProperty": " = aDecoder.decodeObject(forKey: \"\") as? \n", 80 | "forEachArrayOfCustomTypeProperty": " = aDecoder.decodeObject(forKey :\"\") as? \n", 81 | "returnStatement": "", 82 | "body": "", 83 | "comment": "\n /**\n * NSCoding required initializer.\n * Fills the data from the passed decoder\n */\n", 84 | "bodyStart": "\n\t{\n" 85 | }, 86 | { 87 | "forEachProperty": "\t\tif != nil{\n\t\t\taCoder.encode(, forKey: \"\")\n\t\t}\n", 88 | "bodyEnd": "\n\t}\n", 89 | "signature": " @objc func encode(with aCoder: NSCoder)", 90 | "forEachCustomTypeProperty": "\t\tif != nil{\n\t\t\taCoder.encode(, forKey: \"\")\n\t\t}\n", 91 | "forEachArrayOfCustomTypeProperty": "\t\tif != nil{\n\t\t\taCoder.encode(, forKey: \"\")\n\t\t}\n", 92 | "returnStatement": "", 93 | "body": "", 94 | "comment": "\n /**\n * NSCoding required method.\n * Encodes mode properties into the decoder\n */\n", 95 | "bodyStart": "\n\t{\n" 96 | } 97 | ], 98 | "dataTypes": { 99 | "stringType": "String", 100 | "boolType": "Bool", 101 | "floatType": "Float", 102 | "doubleType": "Double", 103 | "characterType": "Character", 104 | "longType": "Double", 105 | "intType": "Int" 106 | }, 107 | "wordsToRemoveToGetArrayElementsType": [ 108 | "[", 109 | "]" 110 | ], 111 | "defaultParentWithUtilityMethods": "NSObject, NSCoding", 112 | "constructors": [ 113 | { 114 | "fetchBasicTypeWithSpecialNeedsPropertyFromMap": "", 115 | "fetchCustomTypePropertyFromMap": "\t\tif let Data = dictionary[\"\"] as? [String:Any]{\n\t\t\t = (fromDictionary: Data)\n\t\t}\n", 116 | "bodyEnd": "\t}\n", 117 | "fetchBasicTypePropertyFromMap": "\t\t = dictionary[\"\"] as? \n", 118 | "signature": "\tinit(fromDictionary dictionary: [String:Any])", 119 | "fetchArrayOfCustomTypePropertyFromMap": "\t\t = ()\n\t\tif let Array = dictionary[\"\"] as? [[String:Any]]{\n\t\t\tfor dic in Array{\n\t\t\t\tlet value = (fromDictionary: dic)\n\t\t\t\t.append(value)\n\t\t\t}\n\t\t}\n", 120 | "comment": "\t/**\n\t * Instantiate the instance using the passed dictionary values to set the properties values\n\t */\n", 121 | "bodyStart": "{\n" 122 | } 123 | ], 124 | "modelDefinition": "\nclass ", 125 | "genericType": "AnyObject", 126 | "getter": "", 127 | "setter": "", 128 | "displayLangName": "Swift - Class", 129 | "fileExtension": "swift", 130 | "basicTypesWithSpecialFetchingNeeds": [ 131 | ], 132 | "arrayType": "[]", 133 | "modelDefinitionWithParent": "\n\nclass : ", 134 | "instanceVarDefinition": "\tvar : !\n", 135 | "supportsFirstLineStatement": "false", 136 | "modelEnd": "\n}", 137 | "staticImports": "import Foundation", 138 | "langName": "Swift" 139 | } 140 | -------------------------------------------------------------------------------- /JSONExport/Supported Languages/Swift-Codable.json: -------------------------------------------------------------------------------- 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 = \"\"\n", 85 | "signature": "\tenum CodingKeys: String, CodingKey ", 86 | "fetchArrayOfCustomTypePropertyFromMap": "\t\tcase = \"\"\n", 87 | "comment": "", 88 | "fetchCustomTypePropertyFromMap": "\t\tcase \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 = try values.decodeIfPresent(.self, forKey: .)\n", 95 | "signature": "\tinit(from decoder: Decoder) throws ", 96 | "fetchArrayOfCustomTypePropertyFromMap": "\t\t = try values.decodeIfPresent(.self, forKey: .)\n", 97 | "comment": "", 98 | "fetchCustomTypePropertyFromMap": "\t\t = try (from: decoder)\n" 99 | } 100 | ], 101 | "modelDefinition": "\nstruct : Codable ", 102 | "genericType": "String", 103 | "getter": "", 104 | "setter": "", 105 | "fileExtension": "swift", 106 | "arrayType": "[]", 107 | "basicTypesWithSpecialFetchingNeeds": [ 108 | ], 109 | "displayLangName": "Swift - Struct - Codable", 110 | "instanceVarDefinition": "\tlet : ?\n", 111 | "supportsFirstLineStatement": "false", 112 | "modelEnd": "\n}", 113 | "staticImports": "import Foundation", 114 | "langName": "Swift" 115 | } 116 | -------------------------------------------------------------------------------- /JSONExport/Supported Languages/Swift-CoreData.json: -------------------------------------------------------------------------------- 1 | { 2 | "modelStart": "{\n", 3 | "importForEachCustomType": "", 4 | "supportMutualRelationships": "true", 5 | "basicTypesWithSpecialStoringNeeds": [ 6 | "Int", 7 | "Bool", 8 | "Character", 9 | "Float", 10 | "Double" 11 | ], 12 | "reservedKeywords": [ 13 | "abstract", 14 | "assert", 15 | "boolean", 16 | "break", 17 | "byte", 18 | "case", 19 | "catch", 20 | "char", 21 | "class", 22 | "const", 23 | "continue", 24 | "default", 25 | "do", 26 | "double", 27 | "else", 28 | "enum", 29 | "extends", 30 | "false", 31 | "final", 32 | "finally", 33 | "float", 34 | "for", 35 | "goto", 36 | "if", 37 | "implements", 38 | "import", 39 | "instanceof", 40 | "int", 41 | "interface", 42 | "long", 43 | "native", 44 | "new", 45 | "null", 46 | "package", 47 | "private", 48 | "protected", 49 | "public", 50 | "return", 51 | "short", 52 | "static", 53 | "strictfp", 54 | "super", 55 | "switch", 56 | "synchronized", 57 | "this", 58 | "throw", 59 | "throws", 60 | "transient", 61 | "true", 62 | "try", 63 | "void", 64 | "volatile", 65 | "while", 66 | "class", 67 | "description" 68 | ], 69 | "booleanGetter": "", 70 | "briefDescription": "Defines how your JSON objects can be mapped to Swift classes using the built-in NSJSONSerialization class", 71 | "instanceVarWithSpeicalDefinition": "\t@NSManaged var : \n", 72 | "utilityMethods": [ 73 | { 74 | "forEachProperty": "\t\tif != nil{\n\t\t\tdictionary[\"\"] = \n\t\t}\n", 75 | "bodyEnd": "\t}\n", 76 | "signature": "\tfunc toDictionary() -> [String:Any]", 77 | "forEachPropertyWithSpecialStoringNeeds": "\t\tdictionary[\"\"] = \n", 78 | "forEachCustomTypeProperty": "\t\tif != nil{\n\t\t\tdictionary[\"\"] = .toDictionary()\n\t\t}\n", 79 | "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", 80 | "returnStatement": "\t\treturn dictionary\n", 81 | "body": "\t\tvar dictionary = [String:Any]()\n", 82 | "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", 83 | "bodyStart": "\n\t{\n" 84 | } 85 | ], 86 | "dataTypes": { 87 | "stringType": "String", 88 | "boolType": "Bool", 89 | "floatType": "Float", 90 | "doubleType": "Double", 91 | "characterType": "Character", 92 | "longType": "Double", 93 | "intType": "Int" 94 | }, 95 | "wordsToRemoveToGetArrayElementsType": [ 96 | "[", 97 | "]" 98 | ], 99 | "constructors": [ 100 | { 101 | "fetchBasicTypeWithSpecialNeedsPropertyFromMap": "\t\tif let Value = dictionary[\"\"] as? {\n\t\t\t = Value\n\t\t}\n", 102 | "bodyStart": "\t{\n\t\tlet entity = NSEntityDescription.entityForName(\"\", inManagedObjectContext: context)!\n\t\tsuper.init(entity: entity, insertIntoManagedObjectContext: context)\n", 103 | "bodyEnd": "\t}\n", 104 | "fetchBasicTypePropertyFromMap": "\t\tif let Value = dictionary[\"\"] as? {\n\t\t\t = Value\n\t\t}\n", 105 | "signature": "\tinit(fromDictionary dictionary: [String:Any], context: NSManagedObjectContext)", 106 | "fetchArrayOfCustomTypePropertyFromMap": "\t\tif let Array = dictionary[\"\"] as? [[String:Any]]{\n\t\t\tvar Set = NSMutableSet()\n\t\t\tfor dic in Array{\n\t\t\t\tlet value = (fromDictionary: dic, context:context)\n\t\t\t\tSet.addObject(value)\n\t\t\t}\n\t\t\t = Set\n\t\t}\n", 107 | "comment": "\t/**\n\t * Instantiate the instance using the passed dictionary values to set the properties values\n\t */\n", 108 | "fetchCustomTypePropertyFromMap": "\t\tif let Data = dictionary[\"\"] as? [String:Any]{\n\t\t\t = (fromDictionary: Data, context:context)\n\t\t}\n" 109 | } 110 | ], 111 | "modelDefinition": "\nclass : NSManagedObject", 112 | "genericType": "AnyObject", 113 | "getter": "", 114 | "setter": "", 115 | "fileExtension": "swift", 116 | "arrayType": "NSMutableSet", 117 | "modelDefinitionWithParent": "\n\nclass : ", 118 | "displayLangName": "Swift - CoreData", 119 | "basicTypesWithSpecialFetchingNeeds": [ 120 | "Int", 121 | "Bool", 122 | "Character", 123 | "Float", 124 | "Double" 125 | ], 126 | "instanceVarDefinition": "\t@NSManaged var : !\n", 127 | "supportsFirstLineStatement": "false", 128 | "modelEnd": "\n}", 129 | "typesNeedSpecialDefinition": [ 130 | "Int", 131 | "Bool", 132 | "Character", 133 | "Float", 134 | "Double" 135 | ], 136 | "staticImports": "import Foundation\nimport CoreData", 137 | "langName": "Swift" 138 | } 139 | -------------------------------------------------------------------------------- /JSONExport/Supported Languages/Swift-Mappable.json: -------------------------------------------------------------------------------- 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 classes using the built-in NSJSONSerialization class", 63 | "utilityMethods": [ 64 | { 65 | "forEachProperty": "\t\t <- map[\"\"]\n", 66 | "bodyEnd": "\t}\n", 67 | "signature": "\tfunc mapping(map: Map)", 68 | "forEachCustomTypeProperty": "\t\t <- map[\"\"]\n", 69 | "forEachArrayOfCustomTypeProperty": "\t\t <- map[\"\"]\n", 70 | "returnStatement": "\t\t\n", 71 | "body": "", 72 | "comment": "", 73 | "bodyStart": "\n\t{\n" 74 | }, 75 | { 76 | "forEachProperty": " = aDecoder.decodeObject(forKey: \"\") as? \n", 77 | "bodyEnd": "\n\t}\n", 78 | "signature": " @objc required init(coder aDecoder: NSCoder)", 79 | "forEachCustomTypeProperty": " = aDecoder.decodeObject(forKey: \"\") as? \n", 80 | "forEachArrayOfCustomTypeProperty": " = aDecoder.decodeObject(forKey: \"\") as? \n", 81 | "returnStatement": "", 82 | "body": "", 83 | "comment": "\n /**\n * NSCoding required initializer.\n * Fills the data from the passed decoder\n */\n", 84 | "bodyStart": "\n\t{\n" 85 | }, 86 | { 87 | "forEachProperty": "\t\tif != nil{\n\t\t\taCoder.encode(, forKey: \"\")\n\t\t}\n", 88 | "bodyEnd": "\n\t}\n", 89 | "signature": " @objc func encode(with aCoder: NSCoder)", 90 | "forEachCustomTypeProperty": "\t\tif != nil{\n\t\t\taCoder.encode(, forKey: \"\")\n\t\t}\n", 91 | "forEachArrayOfCustomTypeProperty": "\t\tif != nil{\n\t\t\taCoder.encode(, forKey: \"\")\n\t\t}\n", 92 | "returnStatement": "", 93 | "body": "", 94 | "comment": "\n /**\n * NSCoding required method.\n * Encodes mode properties into the decoder\n */\n", 95 | "bodyStart": "\n\t{\n" 96 | } 97 | ], 98 | "dataTypes": { 99 | "stringType": "String", 100 | "boolType": "Bool", 101 | "floatType": "Float", 102 | "doubleType": "Double", 103 | "characterType": "Character", 104 | "longType": "Double", 105 | "intType": "Int" 106 | }, 107 | "wordsToRemoveToGetArrayElementsType": [ 108 | "[", 109 | "]" 110 | ], 111 | "defaultParentWithUtilityMethods": "NSObject, NSCoding, Mappable", 112 | "constructors": [ 113 | { 114 | "fetchBasicTypeWithSpecialNeedsPropertyFromMap": "", 115 | "bodyStart": "{\n\t\treturn ()", 116 | "bodyEnd": "\n\t}\n", 117 | "fetchBasicTypePropertyFromMap": "", 118 | "signature": "\tclass func newInstance(map: Map) -> Mappable?", 119 | "fetchArrayOfCustomTypePropertyFromMap": "", 120 | "comment": "", 121 | "fetchCustomTypePropertyFromMap": "" 122 | }, 123 | { 124 | "fetchBasicTypeWithSpecialNeedsPropertyFromMap": "", 125 | "bodyStart": "{", 126 | "bodyEnd": "}\n", 127 | "fetchBasicTypePropertyFromMap": "", 128 | "signature": "\trequired init?(map: Map)", 129 | "fetchArrayOfCustomTypePropertyFromMap": "", 130 | "comment": "", 131 | "fetchCustomTypePropertyFromMap": "" 132 | }, 133 | { 134 | "fetchBasicTypeWithSpecialNeedsPropertyFromMap": "", 135 | "bodyStart": "{", 136 | "bodyEnd": "}\n", 137 | "fetchBasicTypePropertyFromMap": "", 138 | "signature": "\tprivate override init()", 139 | "fetchArrayOfCustomTypePropertyFromMap": "", 140 | "comment": "", 141 | "fetchCustomTypePropertyFromMap": "" 142 | } 143 | ], 144 | "modelDefinition": "\nclass ", 145 | "genericType": "AnyObject", 146 | "getter": "", 147 | "setter": "", 148 | "displayLangName": "Swift - Mappable", 149 | "fileExtension": "swift", 150 | "basicTypesWithSpecialFetchingNeeds": [ 151 | ], 152 | "arrayType": "[]", 153 | "modelDefinitionWithParent": "\n\nclass : ", 154 | "instanceVarDefinition": "\tvar : ?\n", 155 | "supportsFirstLineStatement": "false", 156 | "modelEnd": "\n}", 157 | "staticImports": "import Foundation \nimport ObjectMapper", 158 | "langName": "Swift" 159 | } 160 | -------------------------------------------------------------------------------- /JSONExport/Supported Languages/Swift-Outlaw.json: -------------------------------------------------------------------------------- 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 classes using the built-in NSJSONSerialization class", 63 | "utilityMethods": [ 64 | { 65 | "forEachProperty": "\t\tif != nil{\n\t\t\tdictionary[\"\"] = \n\t\t}\n", 66 | "bodyEnd": "\t}\n", 67 | "signature": "\tfunc serialized() -> [String:Any]", 68 | "forEachCustomTypeProperty": "\t\tif != nil{\n\t\t\tdictionary[\"\"] = !.serialized()\n\t\t}\n", 69 | "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", 70 | "returnStatement": "\t\treturn dictionary\n", 71 | "body": "\t\tvar dictionary = [String:Any]()\n", 72 | "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", 73 | "bodyStart": "\n\t{\n" 74 | }, 75 | { 76 | "forEachProperty": " = aDecoder.decodeObject(forKey: \"\") as? \n", 77 | "bodyEnd": "\n\t}\n", 78 | "signature": " @objc required init(coder aDecoder: NSCoder)", 79 | "forEachCustomTypeProperty": " = aDecoder.decodeObject(forKey: \"\") as? \n", 80 | "forEachArrayOfCustomTypeProperty": " = aDecoder.decodeObject(forKey :\"\") as? \n", 81 | "returnStatement": "", 82 | "body": "", 83 | "comment": "\n /**\n * NSCoding required initializer.\n * Fills the data from the passed decoder\n */\n", 84 | "bodyStart": "\n\t{\n" 85 | }, 86 | { 87 | "forEachProperty": "\t\tif != nil{\n\t\t\taCoder.encode(, forKey: \"\")\n\t\t}\n", 88 | "bodyEnd": "\n\t}\n", 89 | "signature": " @objc func encode(with aCoder: NSCoder)", 90 | "forEachCustomTypeProperty": "\t\tif != nil{\n\t\t\taCoder.encode(, forKey: \"\")\n\t\t}\n", 91 | "forEachArrayOfCustomTypeProperty": "\t\tif != nil{\n\t\t\taCoder.encode(, forKey: \"\")\n\t\t}\n", 92 | "returnStatement": "", 93 | "body": "", 94 | "comment": "\n /**\n * NSCoding required method.\n * Encodes mode properties into the decoder\n */\n", 95 | "bodyStart": "\n\t{\n" 96 | } 97 | ], 98 | "dataTypes": { 99 | "stringType": "String", 100 | "boolType": "Bool", 101 | "floatType": "Float", 102 | "doubleType": "Double", 103 | "characterType": "Character", 104 | "longType": "Double", 105 | "intType": "Int" 106 | }, 107 | "wordsToRemoveToGetArrayElementsType": [ 108 | "[", 109 | "]" 110 | ], 111 | "defaultParentWithUtilityMethods": "NSObject, DataObject", 112 | "constructors": [ 113 | { 114 | "fetchBasicTypeWithSpecialNeedsPropertyFromMap": "", 115 | "fetchCustomTypePropertyFromMap": "\t\tif let Data = object.optionalAny(for: \"\") as? [String:Any]{\n\t\t\t = try (object: Data)\n\t\t}\n", 116 | "bodyEnd": "\t}\n", 117 | "fetchBasicTypePropertyFromMap": "\t\t = object.value(for: \"\")\n", 118 | "signature": "\trequired init(object: Extractable) throws", 119 | "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", 120 | "comment": "\t/**\n\t * Instantiate the instance using the passed dictionary values to set the properties values\n\t */\n", 121 | "bodyStart": "{\n" 122 | } 123 | ], 124 | "modelDefinition": "\nclass ", 125 | "genericType": "AnyObject", 126 | "getter": "", 127 | "setter": "", 128 | "displayLangName": "Swift - Outlaw", 129 | "fileExtension": "swift", 130 | "basicTypesWithSpecialFetchingNeeds": [], 131 | "arrayType": "[]", 132 | "modelDefinitionWithParent": "\n\nclass : ", 133 | "instanceVarDefinition": "\tvar : ?\n", 134 | "supportsFirstLineStatement": "false", 135 | "modelEnd": "\n}", 136 | "staticImports": "import Foundation\nimport Outlaw", 137 | "langName": "Swift" 138 | } -------------------------------------------------------------------------------- /JSONExport/Supported Languages/Swift-Realm.json: -------------------------------------------------------------------------------- 1 | { 2 | "modelStart": " {\n", 3 | "importForEachCustomType": "", 4 | "basicTypesWithSpecialStoringNeeds": [ 5 | "Int", 6 | "Bool", 7 | "Int", 8 | "Float", 9 | "Double" 10 | ], 11 | "supportMutualRelationships": "true", 12 | "reservedKeywords": [ 13 | "abstract", 14 | "assert", 15 | "boolean", 16 | "break", 17 | "byte", 18 | "case", 19 | "catch", 20 | "char", 21 | "class", 22 | "const", 23 | "continue", 24 | "default", 25 | "do", 26 | "double", 27 | "else", 28 | "enum", 29 | "extends", 30 | "false", 31 | "final", 32 | "finally", 33 | "float", 34 | "for", 35 | "goto", 36 | "if", 37 | "implements", 38 | "import", 39 | "instanceof", 40 | "int", 41 | "interface", 42 | "long", 43 | "native", 44 | "new", 45 | "null", 46 | "package", 47 | "private", 48 | "protected", 49 | "public", 50 | "return", 51 | "short", 52 | "static", 53 | "strictfp", 54 | "super", 55 | "switch", 56 | "synchronized", 57 | "this", 58 | "throw", 59 | "throws", 60 | "transient", 61 | "true", 62 | "try", 63 | "void", 64 | "volatile", 65 | "while", 66 | "class", 67 | "description" 68 | ], 69 | "booleanGetter": "", 70 | "briefDescription": "Defines how your JSON objects can be mapped to Swift classes using the built-in NSJSONSerialization class", 71 | "instanceVarWithSpeicalDefinition": "\tdynamic var : \n", 72 | "utilityMethods": [ 73 | { 74 | "forEachProperty": "\t\tif != nil{\n\t\t\tdictionary[\"\"] = \n\t\t}\n", 75 | "bodyEnd": "\t}\n", 76 | "signature": "\tfunc toDictionary() -> [String:Any]", 77 | "forEachPropertyWithSpecialStoringNeeds": "\t\tdictionary[\"\"] = \n", 78 | "forEachArrayOfCustomTypeProperty": "\t\tif != nil{\n\t\t\tvar dictionaryElements = [[String:Any]]()\n\t\t\tfor i in 0 ..< .count {\n\t\t\t\tif let Element = [i] as? {\n\t\t\t\t\tdictionaryElements.append(Element.toDictionary())\n\t\t\t\t}\n\t\t\t}\n\t\t\tdictionary[\"\"] = dictionaryElements\n\t\t}\n", 79 | "forEachCustomTypeProperty": "\t\tif != nil{\n\t\t\tdictionary[\"\"] = .toDictionary()\n\t\t}\n", 80 | "returnStatement": "\t\treturn dictionary\n", 81 | "body": "\t\tvar dictionary = [String:Any]()\n", 82 | "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", 83 | "bodyStart": "\n\t{\n" 84 | }, 85 | { 86 | "forEachProperty": " = aDecoder.decodeObject(forKey: \"\") as? \n", 87 | "bodyEnd": "\n\t}\n", 88 | "signature": " @objc required init(coder aDecoder: NSCoder)", 89 | "forEachCustomTypeProperty": " = aDecoder.decodeObject(forKey: \"\") as? \n", 90 | "forEachArrayOfCustomTypeProperty": " = aDecoder.decodeObject(forKey: \"\") as? \n", 91 | "returnStatement": "", 92 | "forEachPropertyWithSpecialStoringNeeds": " = aDecoder.decodeObject(forKey: \"\") as? \n", 93 | "body": "", 94 | "comment": "\n /**\n * NSCoding required initializer.\n * Fills the data from the passed decoder\n */\n", 95 | "bodyStart": "\n\t{\n" 96 | }, 97 | { 98 | "forEachProperty": "\t\tif != nil{\n\t\t\taCoder.encode(, forKey: \"\")\n\t\t}\n", 99 | "bodyEnd": "\n\t}\n", 100 | "signature": " func encode(with aCoder: NSCoder)", 101 | "forEachPropertyWithSpecialStoringNeeds": " = aDecoder.decodeObject(forKey: \"\") as? \n", 102 | "forEachArrayOfCustomTypeProperty": "\t\tif != nil{\n\t\t\taCoder.encode(, forKey: \"\")\n\t\t}\n", 103 | "forEachCustomTypeProperty": "\t\tif != nil{\n\t\t\taCoder.encode(, forKey: \"\")\n\t\t}\n", 104 | "returnStatement": "", 105 | "body": "", 106 | "comment": "\n /**\n * NSCoding required method.\n * Encodes mode properties into the decoder\n */\n", 107 | "bodyStart": "\n\t{\n" 108 | } 109 | ], 110 | "dataTypes": { 111 | "stringType": "String", 112 | "boolType": "Bool", 113 | "floatType": "Float", 114 | "doubleType": "Double", 115 | "characterType": "Int", 116 | "longType": "Double", 117 | "intType": "Int" 118 | }, 119 | "wordsToRemoveToGetArrayElementsType": [ 120 | "[", 121 | "]" 122 | ], 123 | "defaultParentWithUtilityMethods": "Object, NSCoding", 124 | "constructors": [ 125 | { 126 | "fetchBasicTypeWithSpecialNeedsPropertyFromMap": "\t\tif let Value = dictionary[\"\"] as? {\n\t\t\tthis. = Value\n\t\t}\n", 127 | "fetchCustomTypePropertyFromMap": "\t\tif let Data = dictionary[\"\"] as? [String:Any]{\n\t\t\tthis. = .fromDictionary(Data)\n\t\t}\n", 128 | "bodyEnd": "\t\treturn this\n\t}\n", 129 | "fetchBasicTypePropertyFromMap": "\t\tif let Value = dictionary[\"\"] as? {\n\t\t\tthis. = Value\n\t\t}\n", 130 | "signature": "\tclass func fromDictionary(dictionary: [String:Any]) -> ", 131 | "fetchArrayOfCustomTypePropertyFromMap": "\t\tif let Array = dictionary[\"\"] as? [[String:Any]]{\n\t\t\tvar Items = List(objectClassName: .className())\n\t\t\tfor dic in Array{\n\t\t\t\tlet value = .fromDictionary(dic)\n\t\t\t\tItems.addObject(value)\n\t\t\t}\n\t\t\t = Items\n\t\t}\n", 132 | "comment": "\t/**\n\t * Instantiate the instance using the passed dictionary values to set the properties values\n\t */\n", 133 | "bodyStart": "\t{\n\t\tlet this = ()\n" 134 | } 135 | ], 136 | "modelDefinition": "\nclass : Object", 137 | "genericType": "AnyObject", 138 | "getter": "", 139 | "setter": "", 140 | "fileExtension": "swift", 141 | "arrayType": "List", 142 | "modelDefinitionWithParent": "\n\nclass : ", 143 | "displayLangName": "Swift - Realm", 144 | "basicTypesWithSpecialFetchingNeeds": [ 145 | "Int", 146 | "Bool", 147 | "Int", 148 | "Float", 149 | "Double" 150 | ], 151 | "instanceVarDefinition": "\tdynamic var : !\n", 152 | "supportsFirstLineStatement": "false", 153 | "modelEnd": "\n}", 154 | "typesNeedSpecialDefinition": [ 155 | "Int", 156 | "Bool", 157 | "Int", 158 | "Float", 159 | "Double" 160 | ], 161 | "staticImports": "", 162 | "langName": "Swift" 163 | } 164 | -------------------------------------------------------------------------------- /JSONExport/Supported Languages/Swift-Struct-Gloss.json: -------------------------------------------------------------------------------- 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 | "forEachProperty": "\t\t\"\" ~~> ,\n", 66 | "bodyEnd": "\t}\n", 67 | "signature": "\tpublic func toJSON() -> JSON? ", 68 | "forEachCustomTypeProperty": "\t\t\"\" ~~> ,\n", 69 | "forEachArrayOfCustomTypeProperty": "\t\t\"\" ~~> ,\n", 70 | "returnStatement": "\t\t])\n", 71 | "body": "\t\treturn jsonify([\n", 72 | "comment": "\n\t//MARK: Encodable\n", 73 | "bodyStart": "{\n" 74 | } 75 | ], 76 | "dataTypes": { 77 | "stringType": "String", 78 | "boolType": "Bool", 79 | "floatType": "Float", 80 | "doubleType": "Double", 81 | "characterType": "Character", 82 | "longType": "Double", 83 | "intType": "Int" 84 | }, 85 | "wordsToRemoveToGetArrayElementsType": [ 86 | "[", 87 | "]" 88 | ], 89 | "constructors": [ 90 | { 91 | "fetchBasicTypeWithSpecialNeedsPropertyFromMap": "", 92 | "bodyStart": "{\n", 93 | "bodyEnd": "\t}\n", 94 | "fetchBasicTypePropertyFromMap": "\t\t = \"\" <~~ json\n", 95 | "signature": "\tpublic init?(json: JSON)", 96 | "fetchArrayOfCustomTypePropertyFromMap": "\t\t = \"\" <~~ json\n", 97 | "comment": "\n\t//MARK: Decodable\n", 98 | "fetchCustomTypePropertyFromMap": "\t\t = \"\" <~~ json\n" 99 | } 100 | ], 101 | "modelDefinition": "\n//MARK: - \npublic struct : Glossy ", 102 | "genericType": "AnyObject", 103 | "getter": "", 104 | "setter": "", 105 | "fileExtension": "swift", 106 | "arrayType": "[]", 107 | "basicTypesWithSpecialFetchingNeeds": [ 108 | ], 109 | "displayLangName": "Swift - Struct - Gloss", 110 | "instanceVarDefinition": "\tpublic let : !\n", 111 | "supportsFirstLineStatement": "false", 112 | "modelEnd": "\n}", 113 | "staticImports": "import Foundation \nimport Gloss", 114 | "langName": "Swift", 115 | "author" : { 116 | "name" : "CodeEagle", 117 | "website" : "https://github.com/CodeEagle" 118 | } 119 | 120 | } 121 | -------------------------------------------------------------------------------- /JSONExport/Supported Languages/Swift-Struct-Unbox.json: -------------------------------------------------------------------------------- 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 | "forEachProperty": "\t\tif != nil{\n\t\t\tdictionary[\"\"] = \n\t\t}\n", 66 | "bodyEnd": "\t}\n", 67 | "signature": "\tfunc toDictionary() -> [String:Any]", 68 | "forEachCustomTypeProperty": "\t\tif != nil{\n\t\t\tdictionary[\"\"] = .toDictionary()\n\t\t}\n", 69 | "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", 70 | "returnStatement": "\t\treturn dictionary\n", 71 | "body": "\t\tvar dictionary = [String:Any]()\n", 72 | "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", 73 | "bodyStart": "\n\t{\n" 74 | } 75 | ], 76 | "dataTypes": { 77 | "stringType": "String", 78 | "boolType": "Bool", 79 | "floatType": "Float", 80 | "doubleType": "Double", 81 | "characterType": "Character", 82 | "longType": "Double", 83 | "intType": "Int" 84 | }, 85 | "wordsToRemoveToGetArrayElementsType": [ 86 | "[", 87 | "]" 88 | ], 89 | "constructors": [ 90 | { 91 | "fetchBasicTypeWithSpecialNeedsPropertyFromMap": "", 92 | "bodyStart": "{\n", 93 | "bodyEnd": "\t}\n", 94 | "fetchBasicTypePropertyFromMap": "\t\t = try unboxer.unbox(key: \"\")\n", 95 | "signature": "\tinit(unboxer: Unboxer) throws ", 96 | "fetchArrayOfCustomTypePropertyFromMap": "\t\t = try unboxer.unbox(key: \"\")\n", 97 | "comment": "", 98 | "fetchCustomTypePropertyFromMap": "\t\t = try unboxer.unbox(key: \"\")\n" 99 | } 100 | ], 101 | "modelDefinition": "\nstruct : Unboxable ", 102 | "genericType": "AnyObject", 103 | "getter": "", 104 | "setter": "", 105 | "fileExtension": "swift", 106 | "arrayType": "[]", 107 | "basicTypesWithSpecialFetchingNeeds": [ 108 | ], 109 | "displayLangName": "Swift - Struct - Unbox", 110 | "instanceVarDefinition": "\tlet : !\n", 111 | "supportsFirstLineStatement": "false", 112 | "modelEnd": "\n}", 113 | "staticImports": "import Foundation\nimport Unbox", 114 | "langName": "Swift" 115 | } 116 | -------------------------------------------------------------------------------- /JSONExport/Supported Languages/Swift-Struct.json: -------------------------------------------------------------------------------- 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 | "forEachProperty": "\t\tif != nil{\n\t\t\tdictionary[\"\"] = \n\t\t}\n", 66 | "bodyEnd": "\t}\n", 67 | "signature": "\tfunc toDictionary() -> [String:Any]", 68 | "forEachCustomTypeProperty": "\t\tif != nil{\n\t\t\tdictionary[\"\"] = .toDictionary()\n\t\t}\n", 69 | "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", 70 | "returnStatement": "\t\treturn dictionary\n", 71 | "body": "\t\tvar dictionary = [String:Any]()\n", 72 | "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", 73 | "bodyStart": "\n\t{\n" 74 | } 75 | ], 76 | "dataTypes": { 77 | "stringType": "String", 78 | "boolType": "Bool", 79 | "floatType": "Float", 80 | "doubleType": "Double", 81 | "characterType": "Character", 82 | "longType": "Double", 83 | "intType": "Int" 84 | }, 85 | "wordsToRemoveToGetArrayElementsType": [ 86 | "[", 87 | "]" 88 | ], 89 | "constructors": [ 90 | { 91 | "fetchBasicTypeWithSpecialNeedsPropertyFromMap": "", 92 | "bodyStart": "{\n", 93 | "bodyEnd": "\t}\n", 94 | "fetchBasicTypePropertyFromMap": "\t\t = dictionary[\"\"] as? \n", 95 | "signature": "\tinit(fromDictionary dictionary: [String:Any])", 96 | "fetchArrayOfCustomTypePropertyFromMap": "\t\t = ()\n\t\tif let Array = dictionary[\"\"] as? [[String:Any]]{\n\t\t\tfor dic in Array{\n\t\t\t\tlet value = (fromDictionary: dic)\n\t\t\t\t.append(value)\n\t\t\t}\n\t\t}\n", 97 | "comment": "\t/**\n\t * Instantiate the instance using the passed dictionary values to set the properties values\n\t */\n", 98 | "fetchCustomTypePropertyFromMap": "\t\tif let Data = dictionary[\"\"] as? [String:Any]{\n\t\t\t\t = (fromDictionary: Data)\n\t\t\t}\n" 99 | } 100 | ], 101 | "modelDefinition": "\nstruct ", 102 | "genericType": "AnyObject", 103 | "getter": "", 104 | "setter": "", 105 | "fileExtension": "swift", 106 | "arrayType": "[]", 107 | "basicTypesWithSpecialFetchingNeeds": [ 108 | ], 109 | "displayLangName": "Swift - Struct", 110 | "instanceVarDefinition": "\tvar : !\n", 111 | "supportsFirstLineStatement": "false", 112 | "modelEnd": "\n}", 113 | "staticImports": "import Foundation", 114 | "langName": "Swift" 115 | } 116 | -------------------------------------------------------------------------------- /JSONExport/Supported Languages/Swift3-Mappable.json: -------------------------------------------------------------------------------- 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 classes using the built-in NSJSONSerialization class", 63 | "utilityMethods": [ 64 | { 65 | "forEachProperty": "\t\t <- map[\"\"]\n", 66 | "bodyEnd": "\t}\n", 67 | "signature": "\tfunc mapping(_ map: Map)", 68 | "forEachCustomTypeProperty": "\t\t <- map[\"\"]\n", 69 | "forEachArrayOfCustomTypeProperty": "\t\t <- map[\"\"]\n", 70 | "returnStatement": "\t\t\n", 71 | "body": "", 72 | "comment": "", 73 | "bodyStart": "\n\t{\n" 74 | }, 75 | { 76 | "forEachProperty": " = aDecoder.decodeObject(forKey: \"\") as? \n", 77 | "bodyEnd": "\n\t}\n", 78 | "signature": " @objc required init(coder aDecoder: NSCoder)", 79 | "forEachCustomTypeProperty": " = aDecoder.decodeObjectForKey(\"\") as? \n", 80 | "forEachArrayOfCustomTypeProperty": " = aDecoder.decodeObjectForKey(\"\") as? \n", 81 | "returnStatement": "", 82 | "body": "", 83 | "comment": "\n /**\n * NSCoding required initializer.\n * Fills the data from the passed decoder\n */\n", 84 | "bodyStart": "\n\t{\n" 85 | }, 86 | { 87 | "forEachProperty": "\t\tif != nil{\n\t\t\taCoder.encodeConditionalObject(, forKey: \"\")\n\t\t}\n", 88 | "bodyEnd": "\n\t}\n", 89 | "signature": " @objc func encode(with aCoder: NSCoder)", 90 | "forEachCustomTypeProperty": "\t\tif != nil{\n\t\t\taCoder.encodeObject(, forKey: \"\")\n\t\t}\n", 91 | "forEachArrayOfCustomTypeProperty": "\t\tif != nil{\n\t\t\taCoder.encodeObject(, forKey: \"\")\n\t\t}\n", 92 | "returnStatement": "", 93 | "body": "", 94 | "comment": "\n /**\n * NSCoding required method.\n * Encodes mode properties into the decoder\n */\n", 95 | "bodyStart": "\n\t{\n" 96 | } 97 | ], 98 | "dataTypes": { 99 | "stringType": "String", 100 | "boolType": "Bool", 101 | "floatType": "Float", 102 | "doubleType": "Double", 103 | "characterType": "Character", 104 | "longType": "Double", 105 | "intType": "Int" 106 | }, 107 | "wordsToRemoveToGetArrayElementsType": [ 108 | "[", 109 | "]" 110 | ], 111 | "defaultParentWithUtilityMethods": "NSObject, NSCoding, Mappable", 112 | "constructors": [ 113 | { 114 | "fetchBasicTypeWithSpecialNeedsPropertyFromMap": "", 115 | "bodyStart": "{\n\t\treturn ()", 116 | "bodyEnd": "\n\t}\n", 117 | "fetchBasicTypePropertyFromMap": "", 118 | "signature": "\tclass func newInstance(map: Map) -> Mappable?", 119 | "fetchArrayOfCustomTypePropertyFromMap": "", 120 | "comment": "", 121 | "fetchCustomTypePropertyFromMap": "" 122 | }, 123 | { 124 | "fetchBasicTypeWithSpecialNeedsPropertyFromMap": "", 125 | "bodyStart": "{", 126 | "bodyEnd": "}\n", 127 | "fetchBasicTypePropertyFromMap": "", 128 | "signature": "\tprivate override init()", 129 | "fetchArrayOfCustomTypePropertyFromMap": "", 130 | "comment": "", 131 | "fetchCustomTypePropertyFromMap": "" 132 | }, 133 | { 134 | "fetchBasicTypeWithSpecialNeedsPropertyFromMap": "", 135 | "bodyStart": "{", 136 | "bodyEnd": "}\n", 137 | "fetchBasicTypePropertyFromMap": "", 138 | "signature": "\trequired init?(_ map: Map)", 139 | "fetchArrayOfCustomTypePropertyFromMap": "", 140 | "comment": "", 141 | "fetchCustomTypePropertyFromMap": "" 142 | } 143 | ], 144 | "modelDefinition": "\nclass ", 145 | "genericType": "AnyObject", 146 | "getter": "", 147 | "setter": "", 148 | "displayLangName": "Swift3 - Mappable", 149 | "fileExtension": "swift", 150 | "basicTypesWithSpecialFetchingNeeds": [ 151 | ], 152 | "arrayType": "[]", 153 | "modelDefinitionWithParent": "\n\nclass : ", 154 | "instanceVarDefinition": "\tvar : ?\n", 155 | "supportsFirstLineStatement": "false", 156 | "modelEnd": "\n}", 157 | "staticImports": "import Foundation \nimport ObjectMapper", 158 | "langName": "Swift" 159 | } -------------------------------------------------------------------------------- /JSONExport/Supported Languages/SwiftyJSON-Class.json: -------------------------------------------------------------------------------- 1 | { 2 | "modelStart": "{\n", 3 | "basicTypesWithSpecialFetchingNeedsReplacements": [ 4 | "intValue", 5 | "boolValue", 6 | "charValue", 7 | "floatValue", 8 | "doubleValue", 9 | "stringValue", 10 | "stringValue" 11 | ], 12 | "importForEachCustomType": "", 13 | "reservedKeywords": [ 14 | "abstract", 15 | "assert", 16 | "boolean", 17 | "break", 18 | "byte", 19 | "case", 20 | "catch", 21 | "char", 22 | "class", 23 | "const", 24 | "continue", 25 | "default", 26 | "do", 27 | "double", 28 | "else", 29 | "enum", 30 | "extends", 31 | "false", 32 | "final", 33 | "finally", 34 | "float", 35 | "for", 36 | "goto", 37 | "if", 38 | "implements", 39 | "import", 40 | "instanceof", 41 | "int", 42 | "interface", 43 | "long", 44 | "native", 45 | "new", 46 | "null", 47 | "package", 48 | "private", 49 | "protected", 50 | "public", 51 | "return", 52 | "short", 53 | "static", 54 | "strictfp", 55 | "super", 56 | "switch", 57 | "synchronized", 58 | "this", 59 | "throw", 60 | "throws", 61 | "transient", 62 | "true", 63 | "try", 64 | "void", 65 | "volatile", 66 | "while", 67 | "class", 68 | "description" 69 | ], 70 | "booleanGetter": "", 71 | "briefDescription": "Defines how your JSON objects can be mapped to Swift classes using the SwiftyJSON library", 72 | "utilityMethods": [ 73 | { 74 | "forEachProperty": "\t\tif != nil{\n\t\t\tdictionary[\"\"] = \n\t\t}\n", 75 | "bodyEnd": "\t}\n", 76 | "signature": "\tfunc toDictionary() -> [String:Any]", 77 | "forEachCustomTypeProperty": "\t\tif != nil{\n\t\t\tdictionary[\"\"] = .toDictionary()\n\t\t}\n", 78 | "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", 79 | "returnStatement": "\t\treturn dictionary\n", 80 | "body": "\t\tvar dictionary = [String:Any]()\n", 81 | "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", 82 | "bodyStart": "\n\t{\n" 83 | }, 84 | { 85 | "forEachProperty": " = aDecoder.decodeObject(forKey: \"\") as? \n", 86 | "bodyEnd": "\n\t}\n", 87 | "signature": " @objc required init(coder aDecoder: NSCoder)", 88 | "forEachCustomTypeProperty": " = aDecoder.decodeObject(forKey: \"\") as? \n", 89 | "forEachArrayOfCustomTypeProperty": " = aDecoder.decodeObject(forKey: \"\") as? \n", 90 | "returnStatement": "", 91 | "body": "", 92 | "comment": "\n /**\n * NSCoding required initializer.\n * Fills the data from the passed decoder\n */\n", 93 | "bodyStart": "\n\t{\n" 94 | }, 95 | { 96 | "forEachProperty": "\t\tif != nil{\n\t\t\taCoder.encode(, forKey: \"\")\n\t\t}\n", 97 | "bodyEnd": "\n\t}\n", 98 | "signature": " func encode(with aCoder: NSCoder)", 99 | "forEachCustomTypeProperty": "\t\tif != nil{\n\t\t\taCoder.encode(, forKey: \"\")\n\t\t}\n", 100 | "forEachArrayOfCustomTypeProperty": "\t\tif != nil{\n\t\t\taCoder.encode(, forKey: \"\")\n\t\t}\n", 101 | "returnStatement": "", 102 | "body": "", 103 | "comment": "\n /**\n * NSCoding required method.\n * Encodes mode properties into the decoder\n */\n", 104 | "bodyStart": "\n\t{\n" 105 | } 106 | ], 107 | "dataTypes": { 108 | "stringType": "String", 109 | "boolType": "Bool", 110 | "floatType": "Float", 111 | "doubleType": "Double", 112 | "characterType": "Character", 113 | "longType": "Double", 114 | "intType": "Int" 115 | }, 116 | "wordsToRemoveToGetArrayElementsType": [ 117 | "[", 118 | "]" 119 | ], 120 | "defaultParentWithUtilityMethods": "NSObject, NSCoding", 121 | "constructors": [ 122 | { 123 | "fetchArrayOfBasicTypePropertyFromMap": "\t\t = ()\n\t\tlet Array = json[\"\"].arrayValue\n\t\tfor Json in Array{\n\t\t\t.append(Json.)\n\t\t}\n", 124 | "fetchBasicTypeWithSpecialNeedsPropertyFromMap": "\t\t = json[\"\"].\n", 125 | "bodyStart": "{\n\t\tif json.isEmpty{\n\t\t\treturn\n\t\t}\n", 126 | "bodyEnd": "\t}\n", 127 | "fetchBasicTypePropertyFromMap": "", 128 | "signature": "\tinit(fromJson json: JSON!)", 129 | "fetchArrayOfCustomTypePropertyFromMap": "\t\t = ()\n\t\tlet Array = json[\"\"].arrayValue\n\t\tfor Json in Array{\n\t\t\tlet value = (fromJson: Json)\n\t\t\t.append(value)\n\t\t}\n", 130 | "comment": "\t/**\n\t * Instantiate the instance using the passed json values to set the properties values\n\t */\n", 131 | "fetchCustomTypePropertyFromMap": "\t\tlet Json = json[\"\"]\n\t\tif !Json.isEmpty{\n\t\t\t = (fromJson: Json)\n\t\t}\n" 132 | } 133 | ], 134 | "modelDefinition": "\nclass ", 135 | "genericType": "AnyObject", 136 | "getter": "", 137 | "setter": "", 138 | "displayLangName": "SwiftyJSON - Class", 139 | "fileExtension": "swift", 140 | "basicTypesWithSpecialFetchingNeeds": [ 141 | "Int", 142 | "Bool", 143 | "Character", 144 | "Float", 145 | "Double", 146 | "String", 147 | "AnyObject" 148 | ], 149 | "arrayType": "[]", 150 | "modelDefinitionWithParent": "\n\nclass : ", 151 | "instanceVarDefinition": "\tvar : !\n", 152 | "supportsFirstLineStatement": "false", 153 | "modelEnd": "\n}", 154 | "staticImports": "import Foundation \nimport SwiftyJSON", 155 | "langName": "Swift" 156 | } 157 | -------------------------------------------------------------------------------- /JSONExport/Swift-Apollo Realm.json: -------------------------------------------------------------------------------- 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 | "supportMutualRelationships": "false", 75 | "wordsToRemoveToGetArrayElementsType": [ 76 | "[", 77 | "]" 78 | ], 79 | "constructors": [ 80 | { 81 | "fetchBasicTypeWithSpecialNeedsPropertyFromMap": "", 82 | "bodyStart": "{\n", 83 | "body": "", 84 | "bodyEnd": "\t}", 85 | "fetchBasicTypePropertyFromMap": "\t\tcase = \"\"\n", 86 | "signature": "\tenum CodingKeys: String, CodingKey ", 87 | "fetchArrayOfCustomTypePropertyFromMap": "\t\tcase = \"\"\n", 88 | "comment": "", 89 | "fetchCustomTypePropertyFromMap": "\t\tcase \n" 90 | }, 91 | { 92 | "fetchBasicTypeWithSpecialNeedsPropertyFromMap": "", 93 | "bodyStart": "{\n\t\tself.init()\n\t\tlet container = try decoder.container(keyedBy: CodingKeys.self)\n", 94 | "bodyEnd": "\t}\n", 95 | "fetchBasicTypePropertyFromMap": "\t\t = try? container.decode(.self, forKey: .)\n", 96 | "signature": "\n\n\trequired convenience init(from decoder: Decoder) throws ", 97 | "fetchArrayOfCustomTypePropertyFromMap": "\n\t\tlet Array = try? container.decode([].self, forKey: .)\n\t\t.append(objectsIn: Array ?? [])\n", 98 | "comment": "", 99 | "fetchCustomTypePropertyFromMap": "\t\t = try? container.decode(.self, forKey: .)\n" 100 | } 101 | ], 102 | "modelDefinition": "\nclass : Object, ObjectKeyIdentifiable, Codable ", 103 | "genericType": "String", 104 | "getter": "", 105 | "setter": "", 106 | "fileExtension": "swift", 107 | "arrayType": "List<> = List<>()", 108 | "basicTypesWithSpecialFetchingNeeds": [ 109 | ], 110 | "displayLangName": "Swift - Apollo Realm", 111 | "instanceVarDefinition": "\t@Persisted var : \n", 112 | "supportsFirstLineStatement": "false", 113 | "modelEnd": "}", 114 | "staticImports": "import Foundation\nimport RealmSwift", 115 | "langName": "Swift" 116 | } 117 | -------------------------------------------------------------------------------- /JSONExport/Swift-Codable-Unwrapped.json: -------------------------------------------------------------------------------- 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 = \"\"\n", 85 | "signature": "\tenum CodingKeys: String, CodingKey ", 86 | "fetchArrayOfCustomTypePropertyFromMap": "\t\tcase = \"\"\n", 87 | "comment": "", 88 | "fetchCustomTypePropertyFromMap": "\t\tcase \n" 89 | } 90 | ], 91 | "modelDefinition": "\nstruct : Codable ", 92 | "genericType": "AnyObject", 93 | "getter": "", 94 | "setter": "", 95 | "fileExtension": "swift", 96 | "arrayType": "[]", 97 | "basicTypesWithSpecialFetchingNeeds": [ 98 | ], 99 | "displayLangName": "Swift - Struct - Codable - Unwrapped", 100 | "instanceVarDefinition": "\tlet : \n", 101 | "supportsFirstLineStatement": "false", 102 | "modelEnd": "\n}", 103 | "staticImports": "import Foundation", 104 | "langName": "Swift" 105 | } 106 | -------------------------------------------------------------------------------- /JSONExport/UtilityMethod.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UtilityMethod.swift 3 | // 4 | // Create by Ahmed Ali on 14/11/2014 5 | // Copyright (c) 2014 Mobile Developer. All rights reserved. 6 | // 7 | 8 | import Foundation 9 | 10 | class UtilityMethod{ 11 | 12 | 13 | var body : String! 14 | var bodyEnd : String! 15 | var bodyStart : String! 16 | var comment : String! 17 | var forEachArrayOfCustomTypeProperty : String! 18 | var forEachProperty : String! 19 | var forEachCustomTypeProperty : String! 20 | var returnStatement : String! 21 | var signature : String! 22 | var forEachPropertyWithSpecialStoringNeeds : String! 23 | 24 | /** 25 | * Instantiate the instance using the passed dictionary values to set the properties values 26 | */ 27 | init(fromDictionary dictionary: NSDictionary){ 28 | forEachCustomTypeProperty = dictionary["forEachCustomTypeProperty"] as? String 29 | body = dictionary["body"] as? String 30 | bodyEnd = dictionary["bodyEnd"] as? String 31 | bodyStart = dictionary["bodyStart"] as? String 32 | comment = dictionary["comment"] as? String 33 | forEachArrayOfCustomTypeProperty = dictionary["forEachArrayOfCustomTypeProperty"] as? String 34 | forEachProperty = dictionary["forEachProperty"] as? String 35 | returnStatement = dictionary["returnStatement"] as? String 36 | signature = dictionary["signature"] as? String 37 | forEachPropertyWithSpecialStoringNeeds = dictionary["forEachPropertyWithSpecialStoringNeeds"] as? String 38 | } 39 | 40 | 41 | 42 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 Ahmed-Ali 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | 1- The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 2- For paid software, you MUST include a reference to the original project repoistory: https://github.com/Ahmed-Ali/JSONExport 13 | or contact the author (Ahmed Ali) to obtain permission to not include this reference. 14 | 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # JSONExport is Seeking New Maintainers/Contributors 2 | 3 | Hello everyone, 4 | 5 | I've had a great time working on this project, I kicked it of with the support for few languages, and the amazing community added plenty more! 6 | However, I am currently unable to continue actively maintaining this project and attend to all incoming issues/requests. I would like to take this opportunity to express my gratitude to everyone who has contributed to the development of this project over the years. 7 | 8 | I'm hoping to find someone (or a group of people) who are interested in taking over as maintainers or contributors. If you are interested, here's how you can express your interest: 9 | 10 | 1. Fork the repository and make some contributions. You can start with solving existing issues or adding new features. 11 | 2. Send a pull request with your changes. I promise I will be more attentive to future PRs. 12 | 3. After a few successful pull requests, create an issue titled "[Your Name] for maintainer" and in the description, reference your earlier contribution and any additional features/changes you would like to bring to the project, if any. 13 | 14 | The community will have a chance to voice their thoughts on the issue. If the feedback is neutral or positive, and there is no clear blocker on why you wouldn't be a good contributor, I will add you to the project as maintainer. 15 | 16 | I believe in the power of open source and the incredible community that drives it. I am confident that with your support, JSONExport can continue to grow and evolve. 17 | 18 | Thank you for your understanding and for your continued support of JSONExport. 19 | 20 | Best regards, 21 | 22 | Ahmed 23 | 24 | ----- 25 | 26 | JSONExport 27 | ========== 28 | JSONExport is a desktop application for Mac OS X written in Swift. 29 | Using JSONExport you will be able to: 30 | * Convert any valid JSON object to a class of one of the currently supported languages. 31 | * Preview the generated content before saving it. 32 | * Include constructors only, utility methods only, both or none. 33 | * Change the root class name. 34 | * Set a class name prefix for the generated classes. 35 | * Set package name for Java files. 36 | 37 | Generated Files 38 | ======================== 39 | Each generated file, besid the getters and setters (for Java) can include: 40 | * A constructor wich accepts an instance of NSDictionary, JSON, JSONObject instance depending on the file language, and the class will use this object to fill its properties data. 41 | * A utility method which converts the class data into a dictionary again. 42 | 43 | Currently supported languages 44 | ======================== 45 | Currently you can convert your JSON object to one of the following languages: 46 | 47 | 1. Java for Android. 48 | 2. Java for [Realm](http://realm.io) Android. 49 | 3. GSON for Android 50 | 4. Swift Classes. 51 | 5. Swift Classes for [SwiftyJSON](https://github.com/SwiftyJSON/SwiftyJSON) library. 52 | 6. Swift Classes for [Realm](http://realm.io). 53 | 7. Swift - CoreData. 54 | 8. Swift Structures. 55 | 9. Swift Structures for [Gloss](https://github.com/hkellaway/Gloss) 56 | 10. Swift Mappable Classes for (Swift 3) [ObjectMapper](https://github.com/Hearst-DD/ObjectMapper) 57 | 11. Swift Structures for [Unbox](https://github.com/JohnSundell/Unbox) 58 | 12. Objective-C - iOS. 59 | 13. Objective-C - MAC. 60 | 14. Objective-C - CoreData. 61 | 15. Objective-C for [Realm](http://realm.io) iOS. 62 | 63 | 64 | 65 | Screenshot shows JSONExport used for a snippet from Twitter timeline JSON and converting it to Swift-CoreData. 66 | ![alt tag](https://cloud.githubusercontent.com/assets/5157350/5228493/72693010-7713-11e4-9e42-625a8590424a.png) 67 | 68 | Installation 69 | ======================== 70 | Kindly clone the project, and build it using xCode 8 and above. 71 | 72 | To Do 73 | ======================== 74 | * ~~Support Objective-C~~ Done 75 | * ~~Sync multible classes with the same name or have the same exact properties~~ Done 76 | * ~~Support to parse JSON arrays of objects~~ Done 77 | * Load JSON data from web 78 | * ~~Open .json files from JSONExport~~ 79 | * Supported languages management editor. 80 | * Beside raw JSON, load the model raw data from plist files as well. 81 | 82 | 83 | Known Limitations: 84 | ======================== 85 | * When exporting to subclasses of NSManagedObject, some data types can not be exported. For example core data does not have data type for "array of strings"; in turn, if your JSON contains an array of strings, the exported file will not compile without you fixing the type mismatch. 86 | * When exporting subclasses of RLMObject, you will have to enter the default values of premitive types manually. This is because of dynamic properties limition that prevents you from having an optional premitive type. 87 | * When exporting to CoreData or Realm and you want to use the utility methods, you will need to manually watch for deep relation cycle calls; that is, when you convert an object to dictionary, this object try to convert one of its relation to a dictionary and the relation tries to convert the original object to a dictionary, that will cause a kind of cycle where each object involved calls the other object's toDictionary method infenitly... 88 | * Avoid attempt to model a JSON object with empty values, because JSONExport does not understand empty values and can not guess their types. 89 | * Deep nesting of arrays and objects will not be exported in a proper model files. 90 | 91 | 92 | Final Note 93 | ======================== 94 | The application still in its early stage. Please report any issue so I can improve it. 95 | 96 | License 97 | ======================== 98 | JSONExport is available under custom version of **MIT** license. 99 | --------------------------------------------------------------------------------