All Projects → jgsamudio → ModelSynchro

jgsamudio / ModelSynchro

Licence: MIT license
A JSON model generator for Swift 4

Programming Languages

swift
15916 projects
objective c
16641 projects - #2 most used programming language
kotlin
9241 projects
ruby
36898 projects - #4 most used programming language
Makefile
30231 projects
HTML
75241 projects
shell
77523 projects

Projects that are alternatives of or similar to ModelSynchro

modeling-website
Landing page for project sites
Stars: ✭ 16 (-15.79%)
Mutual labels:  model
CNN-GoogLeNet
👁 Vision : Model 4: GoogLeNet : Image Classification
Stars: ✭ 17 (-10.53%)
Mutual labels:  model
virtio
Virtio implementation in SystemVerilog
Stars: ✭ 38 (+100%)
Mutual labels:  model
paramak
Create parametric 3D fusion reactor CAD and neutronics models
Stars: ✭ 40 (+110.53%)
Mutual labels:  model
Scrape-Finance-Data
My code for scraping financial data in Vietnam
Stars: ✭ 13 (-31.58%)
Mutual labels:  model
oggm
Open Global Glacier Model
Stars: ✭ 167 (+778.95%)
Mutual labels:  model
AWESOME-LDraw
LDraw — awesome software, file format, parts library and model repository (3D models of LEGO® and LEGO-compatible bricks)
Stars: ✭ 30 (+57.89%)
Mutual labels:  model
realar
5 kB Advanced state manager for React
Stars: ✭ 41 (+115.79%)
Mutual labels:  model
ILAMB
Python software used in the International Land Model Benchmarking (ILAMB) project
Stars: ✭ 28 (+47.37%)
Mutual labels:  model
eSelection
Dynamic model selection library for SA-MP servers
Stars: ✭ 28 (+47.37%)
Mutual labels:  model
source-engine-model-loader
Three.js loader for parsing Valve's Source Engine models
Stars: ✭ 54 (+184.21%)
Mutual labels:  model
prediction
Tidy, Type-Safe 'prediction()' Methods
Stars: ✭ 86 (+352.63%)
Mutual labels:  model
DTE
Generate C# class from database table
Stars: ✭ 26 (+36.84%)
Mutual labels:  model
common-osint-model
Converting data from services like Censys and Shodan to a common data model
Stars: ✭ 35 (+84.21%)
Mutual labels:  model
hcv-color
🌈 Color model HCV/HCG is an alternative to HSV and HSL, derived by Munsell color system, usable for Dark and Light themes... 🌈
Stars: ✭ 44 (+131.58%)
Mutual labels:  model
TeslaKit
Elegant Tesla API in Swift
Stars: ✭ 47 (+147.37%)
Mutual labels:  model
SpleeterRT
Real time monaural source separation base on fully convolutional neural network operates on Time-frequency domain.
Stars: ✭ 111 (+484.21%)
Mutual labels:  model
darkgreybox
DarkGreyBox: An open-source data-driven python building thermal model inspired by Genetic Algorithms and Machine Learning
Stars: ✭ 25 (+31.58%)
Mutual labels:  model
Odin
manage model revisions with ease
Stars: ✭ 60 (+215.79%)
Mutual labels:  model
acorn-db
Provides Acorn projects with Eloquent Models for WordPress data.
Stars: ✭ 30 (+57.89%)
Mutual labels:  model

ModelSynchro | Build Status

Description

An automated way to generate network models from JSON and keep them up to date.

Logic Diagram.

Installation

CocoaPods

ModelSynchro is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'ModelSynchro'

After adding the ModelSynchro to your Podfile, add the following script as a run script in your Build Phases.

"${PODS_ROOT}/ModelSynchro/ModelSynchro/Source/ModelSynchro" -projectDirectory ${SRCROOT}/

Next, you will need to configure a custom configuration.json file and add it to the root of your project.

{
  "authorName" : "Jonathan Samudio",
  "companyName" : "Prolific Interactive",
  "projectName" : "MyProject",
  "language" : "swift",
  "outputDirectory" : "MyProject/Models/",
  "localJSONDirectory" : [
    {
        "inputDirectory" : "SampleJSON1/",
        "outputDirectory" : "SampleJSONOutput1/"
    },
    {
        "inputDirectory" : "SampleJSON2/",
        "outputDirectory" : "SampleJSONOutput2/"
    }
  ],
  "endpoints" : [
    {
      "url" : "https://facebook.github.io/react-native/movies.json",
      "name" : "Movies"
    },
    {
      "url" : "https://facebook.github.io/react-native/movies.json",
      "name" : "Movies"
    }
  ],
  "mappedModelNames" : [
    {
        "jsonKey" : "filters",
        "mappedName" : "Filter"
    },
    {
        "jsonKey" : "event_guests",
        "mappedName" : "EventGuest"
    },
    {
        "jsonKey" : "event",
        "mappedName" : "RegistrationEvent"
    },
    {
        "fileName": "Event",
        "mappedName": "MappedEvent"
    }
  ]
}

Manual Installation

To run the application manually, run the following command.

[Directory to ModelSynchro source]/ModelSynchro -projectDirectory [Root Project Directory]

Custom Keys

If the variable names from the api are not what you wish to use as variable names for your models, then ModelSynchro allows you to mark and make updates to your model variable names. Take the swift model below as an example.

struct Book: Codable {
	let author: String
	let id: Int

	enum CodingKeys: String, CodingKey {
		case author = "author"
		case id = "id"
	}
}

If you would like to change id to bookId then all we need to do is change the variable name from id to bookId and mark the line with a // after the variable declaration. In addition, the id case in the CodingKeys will need to be changed to bookId.

struct Book: Codable {
	let author: String
	let bookId: Int //

	enum CodingKeys: String, CodingKey {
		case author = "author"
		case bookId = "id"
	}
}

Custom Model Names

By default, the name of the swift network model will be set to the name of the local JSON file or the keys of the JSON object for sub-models. If you would like to change the name of the model to something else add the mappedModelNames object to the configuration file. Here you can add the JSON key or filename along with the mapped name.

"mappedModelNames" : [
    {
        "jsonKey" : "filters",
        "mappedName" : "Filter"
    },
    {
        "jsonKey" : "event_guests",
        "mappedName" : "EventGuest"
    },
    {
        "jsonKey" : "event",
        "mappedName" : "RegistrationEvent"
    },
    {
        "fileName": "Event",
        "mappedName": "MappedEvent"
    }
]

Languages

As of now swift is supported as the primary language to generate models. objective-c is also available, however is currently in beta. To add a custom language please refer to the LanguageFormatter protocol to create a new language formatter.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].