Skip to content

Instantly share code, notes, and snippets.

@vivekguptaraw
Created May 8, 2018 05:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vivekguptaraw/f9f3410772e33c3a851ac3677f560f68 to your computer and use it in GitHub Desktop.
Save vivekguptaraw/f9f3410772e33c3a851ac3677f560f68 to your computer and use it in GitHub Desktop.
JSON for Dynamic UI (Swift iOS)
import Foundation
let jsonObject: [[[String: Any]]] =
[
[[ "type" : "carousel",
"portionCoveredPerc": 30,
"number": 1,
"backgroundColor" : "00ffff",
"padding" : 0,
"autoSpreadChild" : true,
"childrens":
[
"horizontal":[
[
"type" : "imageview",
"portionCoveredPerc" : 100,
"number": 1,
"url": "Nature1"
],
[
"type" : "imageview",
"portionCoveredPerc" : 100,
"number": 2,
"url": "Nature2"
],
[
"type" : "imageview",
"portionCoveredPerc" : 100,
"number": 3,
"url": "Nature3"
]
]
]
],
],
[
[ "type" : "uiview",
"portionCoveredPerc": 50,
"number": 1,
"backgroundColor" : "ffffff",
"padding" : 10,
"autoSpreadChild" : false,
"childrens":[
"horizontal":[
[ "type" : "uiview",
"portionCoveredPerc": 100,
"number": 1,
"backgroundColor" : "323232",
"padding" : 0,
"autoSpreadChild" : false,
"layersapplied": [
"layerprops":[
"bordercolor" : "dddddd",
"borderwidth" : 1,
"cornerradius" : 0
]
],
"childrens":[
"vertical":[
[
"type" : "uiview",
"portionCoveredPerc": 40,
"number": 1,
"backgroundColor" : "323232",
"padding" : 10,
"autoSpreadChild" : false,
"childhorizontalrendering" : "left",
"childrens":[
"horizontal":[
[
"type" : "imageview",
"portionCoveredPerc" : 40,
"number": 1,
"url": "Car1"
],
[ "type" : "uiview",
//"portionCoveredPerc" : 1,
"height": 120,
"width" : 1,
"number": 2,
"backgroundColor" : "FF0000",
"padding" : 0,
],
[
"tag": "nestedChildView",
"type" : "uiview",
"portionCoveredPerc": 55,
"number": 3,
"backgroundColor" : "323232",
"padding" : 0,
"autoSpreadChild" : true,
"childhorizontalrendering" : "left",
"childrens":[
"horizontal":[
[
"type" : "label",
"number": 3,
"text": "API design is very much like user interface and user experience design. Your target audience has different needs and characteristics, but they're still humans who are looking to get a job done. As with a friendly, usable app UI, you’re still trying to make your API",
"numberOfLines": 5,
"textalignment": "left",
"backgroundColor" : "CCDCF0",
"padding" : 10
]
]
]
]
]
]
],
[
"type" : "label",
"number": 2,
"text": "hey its multiline label and will GROW as per the contents,kbsvbbgbgb ggpp plz set number of lines you want to see kbsvbbgbgb ggpp plz set number of lines you want to see hey its multiline and will GROW as per the contents,kbsvbbgbgb of lines you want to see hey its multiline label and will GROW as per the contents,kbsvbbgbgb ggpp plz set number of lines you want to see kbsvbbgbgb ggpp plzlonngggg",
"numberOfLines": 5,
"textalignment": "left",
"backgroundColor" : "CCDCF0",
"padding" : 10
]
]
]
]
]
]
],
[ "type" : "uiview",
"portionCoveredPerc": 50,
"number": 2,
"backgroundColor" : "ffffff",
"padding" : 10,
"autoSpreadChild" : false,
"childrens":[
"horizontal":[
[ "type" : "uiview",
"portionCoveredPerc": 100,
"number": 1,
"backgroundColor" : "323232",
"padding" : 0,
"autoSpreadChild" : false,
"layersapplied": [
"layerprops":[
"bordercolor" : "dddddd",
"borderwidth" : 1,
"cornerradius" : 0
]
],
"childrens":[
"vertical":[
[
"type" : "uiview",
"portionCoveredPerc": 40,
"number": 1,
"backgroundColor" : "323232",
"padding" : 10,
"autoSpreadChild" : false,
"childhorizontalrendering" : "left",
"childrens":[
"horizontal":[
[
"type" : "imageview",
"portionCoveredPerc" : 40,
"number": 1,
"url": "Car1"
],
[ "type" : "uiview",
//"portionCoveredPerc" : 1,
"height": 120,
"width" : 1,
"number": 2,
"backgroundColor" : "FF0000",
"padding" : 0,
],
[
"tag": "nestedChildView",
"type" : "uiview",
"portionCoveredPerc": 55,
"number": 3,
"backgroundColor" : "323232",
"padding" : 0,
"autoSpreadChild" : true,
"childhorizontalrendering" : "left",
"childrens":[
"horizontal":[
[
"type" : "label",
"number": 3,
"text": "API design is very much like user interface and user experience design. Your target audience has different needs and characteristics, but they're still humans who are looking to get a job done. As with a friendly, usable app UI, you’re still trying to make your API",
"numberOfLines": 5,
"textalignment": "left",
"backgroundColor" : "CCDCF0",
"padding" : 10
]
]
]
]
]
]
],
[
"type" : "label",
"number": 2,
"text": "hey its multiline label and will GROW as per the contents,kbsvbbgbgb ggpp plz set number of lines you want to see kbsvbbgbgb ggpp plz set number of lines you want to see hey its multiline and will GROW as per the contents,kbsvbbgbgb of lines you want to see hey its multiline label and will GROW as per the contents,kbsvbbgbgb ggpp plz set number of lines you want to see kbsvbbgbgb ggpp plzlonngggg",
"numberOfLines": 5,
"textalignment": "left",
"backgroundColor" : "CCDCF0",
"padding" : 10
]
]
]
]
]
]
]
],
[
[ "type" : "uiview",
"portionCoveredPerc": 50,
"number": 3,
"backgroundColor" : "ffffff",
"padding" : 10,
"autoSpreadChild" : false,
"childrens":[
"horizontal":[
[ "type" : "uiview",
"portionCoveredPerc": 100,
"number": 1,
"backgroundColor" : "323232",
"padding" : 0,
"autoSpreadChild" : false,
"layersapplied": [
"layerprops":[
"bordercolor" : "dddddd",
"borderwidth" : 1,
"cornerradius" : 0
]
],
"childrens":[
"vertical":[
[
"type" : "uiview",
"portionCoveredPerc": 40,
"number": 1,
"backgroundColor" : "323232",
"padding" : 10,
"autoSpreadChild" : false,
"childhorizontalrendering" : "left",
"childrens":[
"horizontal":[
[
"type" : "imageview",
"portionCoveredPerc" : 55,
"number": 3,
"url": "Car1"
],
[ "type" : "uiview",
//"portionCoveredPerc" : 1,
"height": 120,
"width" : 1,
"number": 2,
"backgroundColor" : "FF0000",
"padding" : 0,
],
[
"tag": "nestedChildView",
"type" : "uiview",
"portionCoveredPerc": 40,
"number": 1,
"backgroundColor" : "323232",
"padding" : 0,
"autoSpreadChild" : true,
"childhorizontalrendering" : "left",
"childrens":[
"horizontal":[
[
"type" : "label",
"number": 3,
"text": "Triying another change",
"numberOfLines": 5,
"textalignment": "left",
"backgroundColor" : "CCDCF0",
"padding" : 10
]
]
]
]
]
]
],
[
"type" : "label",
"number": 2,
"text": "hey its multiline label and will GROW as per the contents,kbsvbbgbgb ggpp plz vbbgbgb ggpp plz set number of lines you want to see kbsvbbgbgb ggpp plzlonngggg",
"numberOfLines": 5,
"textalignment": "left",
"backgroundColor" : "CCDCF0",
"padding" : 10
]
]
]
]
]
]
],
],
[
[ "type" : "uiview",
"portionCoveredPerc": 50,
"number": 3,
"backgroundColor" : "ffffff",
"padding" : 10,
"autoSpreadChild" : false,
"childrens":[
"horizontal":[
[ "type" : "uiview",
"portionCoveredPerc": 100,
"number": 1,
"backgroundColor" : "323232",
"padding" : 0,
"autoSpreadChild" : false,
"layersapplied": [
"layerprops":[
"bordercolor" : "dddddd",
"borderwidth" : 1,
"cornerradius" : 0
]
],
"childrens":[
"vertical":[
[
"type" : "uiview",
"portionCoveredPerc": 40,
"number": 1,
"backgroundColor" : "323232",
"padding" : 10,
"autoSpreadChild" : false,
"childhorizontalrendering" : "left",
"childrens":[
"horizontal":[
[
"type" : "imageview",
"portionCoveredPerc" : 50,
"number": 1,
"url": "Car2"
],
[ "type" : "uiview",
//"portionCoveredPerc" : 1,
"height": 120,
"width" : 1,
"number": 2,
"backgroundColor" : "FF0000",
"padding" : 0,
],
[
"tag": "nestedChildView",
"type" : "uiview",
"portionCoveredPerc": 45,
"number": 3,
"backgroundColor" : "323232",
"padding" : 0,
"autoSpreadChild" : true,
"childhorizontalrendering" : "left",
"childrens":[
"horizontal":[
[
"type" : "label",
"number": 3,
"text": "Because more and more people are living, working and playing here, we’ve established a new Traffic Plan designed to make leaving the area after a HEAT game or an Arena event a more organized and efficient process. We are confident this plan will help you get to where you need to go as quickly as possible.",
"numberOfLines": 3,
"textalignment": "left",
"backgroundColor" : "CCDCF0",
"padding" : 10
]
]
]
]
]
]
],
[
"type" : "label",
"number": 2,
"text": "hey its multiline label and will GROW as per the contents,kbsvbbgbgb ggpp plz set number of lines you want to see kbsvbbgbgb ggpp plz set number of lines you want to see hey its multiline and will GROW as per the contents,kbsvbbgbgb of lines you want to see hey its multiline label and will GROW as per the contents,kbsvbbgbgb ggpp plz set number of lines you want to see kbsvbbgbgb ggpp plzlonngggg",
"numberOfLines": 5,
"textalignment": "left",
"backgroundColor" : "CCDCF0",
"padding" : 10
]
]
]
]
]
]
],
],
[
[ "type" : "uiview",
"portionCoveredPerc": 60,
"number": 4,
"backgroundColor" : "ffffff",
"padding" : 10,
"autoSpreadChild" : false,
"childrens":[
"horizontal":[
[ "type" : "uiview",
"portionCoveredPerc": 100,
"number": 1,
"backgroundColor" : "ffffff",
"padding" : 0,
"autoSpreadChild" : false,
"layersapplied": [
"layerprops":[
"bordercolor" : "dddddd",
"borderwidth" : 1,
"cornerradius" : 0
]
],
"childrens":[
"vertical":[
[
"type" : "imageview",
"portionCoveredPerc" : 40,
"number": 1,
"url": "testImage"
],
[
"type" : "label",
"number": 1,
"text": "My title dining",
"numberOfLines": 1,
"textalignment": "center",
"backgroundColor" : "CCDCF0",
"padding" : 5
],
[
"type" : "label",
"number": 2,
"text": "hey its multiline label and will GROW as per the contents,kbsvbbgbgb ggpp plz set number of lines you want to see kbsvbbgbgb ggpp plz set number of lines you want to see hey its multiline and will GROW as per the contents,kbsvbbgbgb of lines you want to see hey its multiline label and will GROW as per the contents,kbsvbbgbgb ggpp plz set number of lines you want to see kbsvbbgbgb ggpp plzlonngggg",
"numberOfLines": 5,
"textalignment": "center",
"backgroundColor" : "CCDCF0",
"padding" : 10
],
[
"type" : "uiview",
"portionCoveredPerc": 14,
"number": 4,
"backgroundColor" : "ffffff",
"padding" : 10,
"autoSpreadChild" : true,
"sideSpacing" : 10,
"layersapplied": [
"layerprops":[
"bordercolor" : "000000",
"borderwidth" : 1,
"cornerradius" : 5
]
],
"childrens":[
"horizontal":[
[
"type" : "button",
"height" : 44,
"width" : 250,
"parameter": [
"query" :
[ "id" : "78999111",
"deeplink" : "kings://gamedetailFromChildcool"
]
],
"title" : "Request reservation",
"backgroundColor" : "ffb6c1",
"number": 1
]
]
]
]
]
]
]
]
]
],
],
[
[ "type" : "uiview",
"portionCoveredPerc": 60,
"number": 5,
"backgroundColor" : "ffffff",
"padding" : 10,
"autoSpreadChild" : false,
"childrens":[
"horizontal":[
[ "type" : "uiview",
"portionCoveredPerc": 100,
"number": 1,
"backgroundColor" : "ffffff",
"padding" : 0,
"autoSpreadChild" : false,
"layersapplied": [
"layerprops":[
"bordercolor" : "dddddd",
"borderwidth" : 1,
"cornerradius" : 0
]
],
"childrens":[
"vertical":[
[
"type" : "imageview",
"portionCoveredPerc" : 60,
"number": 1,
"url": "testImage"
],
[
"type" : "label",
"number": 2,
"text": "hey its multiline label and will GROW as per the contents,kbsvbbgbgb ggpp plz set number of lines you want to see kbsvbbgbgb ggpp plz set number of lines yggpp plz set number of lines you want to see kbsvbbgbgb ggpp plzlonngggg",
"numberOfLines": 3,
"textalignment": "center",
"backgroundColor" : "CCDCF0",
"padding" : 10
],
[
"type" : "label",
"number": 3,
"text": "hey its multiline label and will GROW as per the contents,kbsvbbgbgb ggpp plz set number of lines you want to see kbsvbbgbgb ggpp plz set number of lines you want to see hey its multiline and will GROW as per the contents,kbsvbbgbgb of lines you want to see hey its multiline label and will GROW as per the contents,kbsvbbgbgb ggpp plz set number of lines you want to see kbsvbbgbgb ggpp plzlonngggg",
"numberOfLines": 6,
"textalignment": "center",
"backgroundColor" : "CCDCF0",
"padding" : 10
]
]
]
]
]
]
],
],
[
[ "type" : "uiview",
"portionCoveredPerc": 60,
"number": 6,
"backgroundColor" : "ffffff",
"padding" : 10,
"autoSpreadChild" : false,
"childrens":[
"horizontal":[
[ "type" : "uiview",
"portionCoveredPerc": 100,
"number": 1,
"backgroundColor" : "ffffff",
"padding" : 0,
"autoSpreadChild" : false,
"layersapplied": [
"layerprops":[
"bordercolor" : "dddddd",
"borderwidth" : 1,
"cornerradius" : 0
]
],
"childrens":[
"vertical":[
[
"type" : "imageview",
"portionCoveredPerc" : 40,
"number": 1,
"url": "testImage"
],
[
"type" : "label",
"number": 2,
"text": "hey its multiline label and will GROW as per the contents,kbsvbbgbgb ggpp plz set number of lines you want to see kbsvbbgbgb ggpp plz set number of lines yggpp plz set number of lines you want to see kbsvbbgbgb ggpp plzlonngggg",
"numberOfLines": 3,
"textalignment": "center",
"backgroundColor" : "CCDCF0",
"padding" : 10
],
[
"type" : "label",
"number": 3,
"text": "hey its multiline label and will GROW as per the contents,kbsvbbgbgb ggpp plz set number of lines you want to see kbsvbbgbgb ggpp plz set number of lines you want to see hey its multiline and will GROW as per the contents,kbsvbbgbgb of lines you want to see hey its multiline label and will GROW as per the contents,kbsvbbgbgb ggpp plz set number of lines you want to see kbsvbbgbgb ggpp plzlonngggg",
"numberOfLines": 3,
"textalignment": "center",
"backgroundColor" : "CCDCF0",
"padding" : 10
],
[
"type" : "uiview",
"portionCoveredPerc": 14,
"number": 4,
"backgroundColor" : "20B2AA",
"padding" : 10,
"autoSpreadChild" : true,
"childrens":[
"horizontal":[
[
"type" : "button",
"height" : 44,
"parameter": [
"query" :
[ "id" : "123456",
"deeplink" : "kings://gamedetailFromChildVivek"
]
],
"title" : "Request reservation",
"backgroundColor" : "ffb6c1",
"number": 1
],
[
"type" : "button",
"height" : 44,
"parameter": [
"query" :
[ "id" : "7867800009562",
"deeplink" : "kings://gamedetailFromChild0000"
]
],
"title" : "Request reservation",
"backgroundColor" : "ffb6c1",
"number": 2
]
]
]
]
]
]
]
]
]
],
]
]
@tl67821102
Copy link

How to handle all of this?

@udayFAI
Copy link

udayFAI commented Jan 30, 2024

Can anyone help me how do handle all of this ?
Like display in a UIViewController.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment