Jasonette / JASONETTE-iOS

📡 Native App over HTTP, on iOS
https://www.jasonette.com
MIT License
5.27k stars 352 forks source link

Stringify #337

Closed gliechtenstein closed 6 years ago

gliechtenstein commented 6 years ago

Previously there was a strict rule about keeping every attribute a string format. This has confused a lot of people when getting started because for example you would expect something like this to work right out of the box:

{
  "type": "label", "text": 42
}

But it didn't because you had to EXPLICITLY set every attribute value to string, so the 42 had to be wrapped with double quotes like this:

{
  "type": "label", "text": "42"
}

This PR fixes this problem so all types automatically get typecasted to string when printing to the view. Numbers become strings and booleans become strings too (true becomes "1" and false becomes "0")

Here are the features that have been updated to reflect this:

View

Action

$util actions

Styling

all styles with number metrics (size, width, height, etc.)

gliechtenstein commented 6 years ago

Can try the demo at https://jasonette.github.io/Jasontests/stringify/index.json

drwasho commented 6 years ago

Awesome!