alickbass / swiftyjsonmodel Goto Github PK
View Code? Open in Web Editor NEWBetter way to use SwiftyJSON with custom models
License: MIT License
Better way to use SwiftyJSON with custom models
License: MIT License
Earlier i used JSONModel
lib (https://github.com/jsonmodel/jsonmodel) for object c, and now i can not convert JSONModel
to SwiftyJSONModel
(for Swift). When i try to add 1 JSONModel property, the compile error :
Ambiguous reference to member 'value(for:)'
How can i combine to use 2 libs in project? Thanks
Now the optional value can be nil
in 2 cases
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?
For now every String enum has to explicitly conform to JSONInitializable
protocol which introduces a lot of boilerplate
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 that transforms value for keypath to specific type and use closure-based method that take function of transform as parameter
Add support for MacOS, tvOS, watchOS
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
Update README in the following manner: Instead of this: will be this:
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.
Now the recursive value for key uses Array and this creates every recursion. It's better to use ArraySlice
instead
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.