Giter Site home page Giter Site logo

alickbass / swiftyjsonmodel Goto Github PK

View Code? Open in Web Editor NEW
29.0 6.0 11.0 148 KB

Better way to use SwiftyJSON with custom models

License: MIT License

Swift 96.14% Objective-C 1.88% Ruby 1.98%
json swiftyjson json-model-mapping type-safe protocol-oriented

swiftyjsonmodel's People

Contributors

dkalachniuk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

swiftyjsonmodel's Issues

Make optional values throwable

Now the optional value can be nil in 2 cases

  • When element is absent
  • When there was an error while constructing a value

I think that's a pitty, as the error case should actually throw. This would add optional values better errors and will still allow to use try?

Add Support for string enums

For now every String enum has to explicitly conform to JSONInitializable protocol which introduces a lot of boilerplate

How can I access to some values with are nested on a JSON ..

How can I have a struct with a structure which is not correspondent with the JSON hierarchy?
Lets suppose I have the next JSON

{
  "id": 5128581,
  "name": "New York",
  "cod": 200
  "main": {
    "temp": 263.76,
    "pressure": 1038,
    "humidity": 92,
    "temp_min": 259.15,
    "temp_max": 269.15
  }
}

And I want to have a struct with the values for the keys name and main->temp.
How can I do it?

Remove duplicate code for keypaths

Remove duplicate code that transforms value for keypath to specific type and use closure-based method that take function of transform as parameter

Issue with type Double/Int

if I do

try? JSON(0.0).value() as Int

this equals to nil as well as the opposite:

try? JSON(-5).value() as Double

is also nil

Fix README

Update README in the following manner: Instead of this: will be this:

Add support for Dates with custom format

Now, to support the Date type we had to conform date to JSONInitializable protocol and define the format in it. However, this excludes possibility to support several format.

No example for Dates in ReadMe

Hi, and thanks for the great library!

I'm pretty new to all this and trying to map a json result to a Date. I notice you've merged some code adding support for Dates (that's great!) but it would people like me if the documentation gave a brief example for how this works.

Many thanks,

Meurig

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.