This repository has been archived by the owner on Aug 16, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
JSON parsing and factories #7
Merged
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
823cb16
ADD first draft for component factories. Not happy yet; WIP
6eb292f
ADD JSONReader to read a json file into a dictionary (JSONObject)
AndreasThenn 8c6bc88
ADD unit tests for JSONReader
ba91bc7
REM line_length setting for SwiftLint again, because new SwiftLint ve…
AndreasThenn 6ecf8d0
Add JSONFactory wrapper
joanromano 77b4626
Update swiftlint tests file
joanromano df43352
Add tests to JSONReader
joanromano d6c16f6
Add JSONFactoryError for JSONFactory error handling
joanromano 2a4fd05
Minor header fixes
joanromano be460f6
Fix swift lint rules with new version
joanromano f524260
Update project set up
joanromano 26acb59
Update app_structure.json and tests to reflect current schema
joanromano 62ca01d
Refactor using a single JSONFactory which holds builder closures
joanromano 06b4bcd
Remove swiftlint line length since we use the default
joanromano d8ff008
Add public init in JSONFactory
joanromano 98a5b1d
Merge branch 'master' into feature/jsonParsing
joanromano d218084
Fix code in example
joanromano 81a720f
Fix line length violation on ExpressibleByComponentMeta documentation
joanromano b3cc35b
CRC
joanromano e030bf4
Use JSONObject type when possible
joanromano dadde5d
Re build example
joanromano ae229e1
Added gemfile to fix buddybuild
452a56b
Added another gemfile
50dcde2
ADD danger to the gemfile
abd0a79
Add danger-swiftlint
c80a885
Update documentation
joanromano 57b6d0b
Update code and documentation with snake case keys
joanromano 8119b1b
Remove fast test
joanromano 6a9d36a
Update json example with snake case
joanromano 63a84b9
Fix link on Readme
joanromano File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
# JSON schema guide | ||
|
||
This is a reference for the JSON schema provided by Matrioska, which should be followed in order to register `Component`s and build the provided standard components. | ||
|
||
## JSON schemas for `Component` and `ComponentMeta` | ||
|
||
Below you can find a detailed schema for `Component`s and for each configuration (`ComponentMeta`). | ||
|
||
### Component schema | ||
|
||
| Key | Type | Description | | ||
| --- | ---- | ----------- | | ||
| `type` | `String` | The type of the component. Used for factory registration. | | ||
|
||
### StackConfig schema | ||
|
||
| Key | Type | Description | Maps to | Optional | Default value | | ||
| --- | ---- | ----------- | ------- | -------- | ------------- | | ||
| `title` | `String` | The title of the stack. | `title` | Yes | `nil` | | ||
| `spacing` | `Float` | The spacing of the components inside the stack. | `spacing` | Yes | `10` | | ||
| `axis` | `Int` | The orientation of the stack. Can be either `0`(horizontal) or `1`(vertical). | `axis` | Yes | `1` | | ||
| `preserve_parent_width` | `Bool` | Whether the arranged subviews should preserve the parent width or their own intrinsicContentSize. | `preserveParentWidth` | Yes | `false` | | ||
| `background_color` | `String` | The background color of the stack. Alpha and compact forms are not supported. Valid formats: `0x123456` or `123456`. | `backgroundColor` | Yes | `ffffff`(white) | | ||
|
||
### TabBarConfig schema | ||
|
||
| Key | Type | Description | Maps to | Optional | Default value | | ||
| --- | ---- | ----------- | ------- | -------- | ------------- | | ||
| `selected_index` | `Int` | The selected index of the tab bar. | `selectedIndex` | No | . | | ||
|
||
### Tab schema | ||
|
||
| Key | Type | Description | Maps to | Optional | Default value | | ||
| --- | ---- | ----------- | ------- | -------- | ------------- | | ||
| `title` | `String` | The title to display on the tab. | `title` | No | . | | ||
| `icon_name` | `Int` | The name of the icon to display on the tab. | `iconName` | No | . | | ||
|
||
## Example JSON | ||
|
||
``` | ||
{ | ||
"structure": { | ||
"type": "tabbar", | ||
"meta": { | ||
"selected_index": 1 | ||
}, | ||
"children": [{ | ||
"type": "navigation", | ||
"meta": { | ||
"title": "history_title", | ||
"icon_name": "history_tab_icon" | ||
}, | ||
"children": [{ | ||
"type": "stack", | ||
"meta": { | ||
"axis": 1, | ||
"preserve_parent_width": true, | ||
"background_color": "0x123456" | ||
}, | ||
"children": [{ | ||
"type": "table_view" | ||
}] | ||
}] | ||
}, { | ||
"type": "navigation", | ||
"meta": { | ||
"title": "main_tab_title", | ||
"icon_name": "main_tab_icon" | ||
}, | ||
"children": [{ | ||
"type": "stack", | ||
"meta": { | ||
"axis": 1, | ||
"title": "Main stack", | ||
"preserve_parent_width": true, | ||
"spacing": "5" | ||
}, | ||
"children": [{ | ||
"type": "label", | ||
"meta": { | ||
} | ||
}, { | ||
"type": "test_feature", | ||
"meta": { | ||
} | ||
} | ||
] | ||
}] | ||
}] | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe setup buddybuild quickly so we can make sure to not break the example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will do so
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done (wanted to see how it works), I created a runtastic team on buddybuild. Will invite you guys. Btw I think buddybuild also supports libraries now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh nevermind that's only for payed plans.