soooban / SwiftyJSONAccelerator

OSX app to generate Swift 3 code for models from JSON.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Logo

SwiftyJSONAccelerator

Build Status codecov

Version v1.1.0 Released!

  • Now generates the correct option struct and class based on what was selected.

Version v1.0.0 Released!

  • Now generates Swift 3 and the software itself is upgraded to Swift 3.
  • Unit tests and complete code coverage for file generation module.
  • Modular code to make adding support for other JSON mapping libraries simple.
  • Project upgraded with SwiftLint, Travis, CocoaPods etc.

Download/Installing

A swift model generator like the Objective-C JSONAccelerator. Formats and generates models for the given JSON and also breaks them into files making it easy to manage and share between several models.

The models that are generated depend on JSON object mapping libraries, currently the model can be generated to depend on any of the below mentioned mapping libraries:

Currently, the pattern is very similar to its Objective-C counterpart. It generates classes with following properties.

  • Initalize with JSON (SwiftyJSON or ObjectMapper) or Initalize with Any
  • Optional NSCoding compliance.
  • Convert object to Dictionary for description printing.

Preview

  • Simple configurable interface for generation of file.
  • Each class in the JSON is generated as a file.

Adding New Libraries

  • Add a new type in JSONMappingLibrary in Constants.swift.
  • Follow the examples in Library-Extensions and create a struct implementingModelFile. Follow the other extensions for SwiftyJSON and ObjectMapper, they tell you what all you can replace based on your libraries specification.
  • Do the necessary UI changes for the dropdown.
  • Add tests for your library.

Swift 2?

Download (v0.0.6), the older version of the project, please keep in mind it is no longer supported.

Todo

There is a lot more to do, follow the issues section, I usually try to follow up or keep the list updated with any new ideas which I plan to implement.

  • Build a CLI, useful in integrated with mocks and API documentations.
  • Creating a better UI for the application.
  • Adding support for better libraries mentioned here.

Contributions and Requests

Any suggestions regarding code quality of the app, generated code's quality, Swift related improvements and pull requests are all very welcome. Please make sure you submit the pull request to the next release branch and not the master branch.

License

MIT License / Karthikeya Udupa

About

OSX app to generate Swift 3 code for models from JSON.

License:MIT License


Languages

Language:Swift 95.4%Language:Ruby 3.1%Language:Shell 0.7%Language:Makefile 0.7%