Dynamic Form creation Based on json response in SwiftUI

{
“data”: {
“viewModel”:{
“type”: “form”,
“children”: [
{
“id”: “1”,
“flex”: 1,
“type”: “title”,
“align”: “left”,
“label”: “Chak De_1”,
“weight”: 400,
“variant”: “h5”,
“emphasis”: false,
“multiline”: false
},
{
“id”: “2”,
“flex”: 1,
“type”: “label”,
“label”: “Text Details”,
“helpText”: “Testing label helper”
},
{
“id”: “3”,
“max”: “10”,
“flex”: 1,
“type”: “text”,
“label”: “Enter Text”,
“pointer”: “Text_1”,
“inputType”: “string”,
“multiline”: false
},
{
“id”: “4”,
“flex”: 1,
“type”: “title”,
“align”: “center”,
“label”: “Chak De_2”,
“weight”: 300,
“variant”: “h6”,
“emphasis”: true,
“multiline”: false
},
{
“id”: “5”,
“flex”: 1,
“type”: “label”,
“label”: “Text Details”
},
{
“id”: “6”,
“max”: “100”,
“min”: “30”,
“flex”: 1,
“step”: “5”,
“type”: “text”,
“label”: “Enter only number format”,
“pointer”: “Text_2”,
“helpText”: “Accept number from 30 to 100 along with increase each 5”,
“inputType”: “number”,
“multiline”: false
},
{
“id”: “8”,
“flex”: 1,
“type”: “label”,
“label”: “Multi lineText Details”
},
{
“id”: “9”,
“max”: “20”,
“flex”: 1,
“rows”: 3,
“type”: “text”,
“label”: “Enter the text here”,
“pointer”: “Text_3”,
“rowsMax”: 4,
“helpText”: “Accept max 4 rows and max 20 alphabets accepted.”,
“inputType”: “string”,
“multiline”: true
},
],
“validationSets”: [
{
“key”: “save”,
“validations”:
},
{
“key”: “route”,
“validations”:
}
]
}
}
}

In this based on json response I have to create a dynamic form with relay on each object like “type”: “title” (Label and next text fieds) along with input fields. I would appreciate to help me to the which architecture is suitable or design pattern and how to start create a dynamic form with examples by using SwiftUI.

This is called Server Driven UI. The architecture and design pattern don’t matter dramatically. Many people use MVVM for SwiftUI apps.

You should read the JSON and depending on what was decoded, create the UI

Thank you for your response @mikaelacaron.