{"id":3059,"date":"2025-11-12T11:31:01","date_gmt":"2025-11-12T04:31:01","guid":{"rendered":"https:\/\/portal-atlasx.cdg.co.th\/home\/?post_type=docs&#038;p=3059"},"modified":"2025-11-12T11:31:01","modified_gmt":"2025-11-12T04:31:01","slug":"atlasx-dynamic-model","status":"publish","type":"docs","link":"https:\/\/portal-atlasx.cdg.co.th\/home\/docs\/ios\/services\/atlasx-dynamic-model\/","title":{"rendered":"AtlasX Dynamic Model"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\" id=\"atlasx-dynamic-model\">AtlasX Dynamic Model<\/h1>\n\n\n\n<p>AtlasX Dynamic Model \u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e40\u0e1e\u0e34\u0e48\u0e21\u0e25\u0e14\u0e08\u0e33\u0e19\u0e27\u0e19 Properties \u0e44\u0e14\u0e49\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e2d\u0e34\u0e2a\u0e23\u0e30\u0e40\u0e1e\u0e37\u0e48\u0e2d Support Model \u0e17\u0e35\u0e48\u0e21\u0e35\u0e01\u0e32\u0e23\u0e40\u0e1b\u0e25\u0e35\u0e48\u0e22\u0e19\u0e41\u0e1b\u0e25\u0e07 Properties \u0e2d\u0e22\u0e39\u0e48\u0e1a\u0e48\u0e2d\u0e22\u0e04\u0e23\u0e31\u0e49\u0e07<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"operation\">Operation<\/h2>\n\n\n\n<p>\u0e40\u0e04\u0e23\u0e37\u0e48\u0e2d\u0e07\u0e2b\u0e21\u0e32\u0e22\u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a\u0e01\u0e32\u0e23\u0e2a\u0e23\u0e49\u0e32\u0e07 Condition<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-Fira-Code\" style=\"font-size:.875rem;font-family:Code-Pro-Fira-Code,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#000000;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>enum Operation {\n    case equal(value: Any?)\n    case notEqual(value: Any?)\n    case moreThanInt(value: Int)\n    case moreThanDouble(value: Double)\n    case moreThanAndEqualInt(value: Int)\n    case moreThanAndEqualDouble(value: Double)\n    case lessThanInt(value: Int)\n    case lessThanDouble(value: Double)\n    case lessThanAndEqualInt(value: Int)\n    case lessThanAndEqualDouble(value: Double)\n    case contains(value: String)\n}<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki light-plus\" style=\"background-color: #FFFFFF\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #0000FF\">enum<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #267F99\">Operation<\/span><span style=\"color: #000000\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">    <\/span><span style=\"color: #0070C1\">case<\/span><span style=\"color: #000000\"> equal(value: Any?)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">    <\/span><span style=\"color: #0070C1\">case<\/span><span style=\"color: #000000\"> notEqual(value: Any?)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">    <\/span><span style=\"color: #0070C1\">case<\/span><span style=\"color: #000000\"> moreThanInt(value: Int)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">    <\/span><span style=\"color: #0070C1\">case<\/span><span style=\"color: #000000\"> moreThanDouble(value: Double)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">    <\/span><span style=\"color: #0070C1\">case<\/span><span style=\"color: #000000\"> moreThanAndEqualInt(value: Int)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">    <\/span><span style=\"color: #0070C1\">case<\/span><span style=\"color: #000000\"> moreThanAndEqualDouble(value: Double)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">    <\/span><span style=\"color: #0070C1\">case<\/span><span style=\"color: #000000\"> lessThanInt(value: Int)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">    <\/span><span style=\"color: #0070C1\">case<\/span><span style=\"color: #000000\"> lessThanDouble(value: Double)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">    <\/span><span style=\"color: #0070C1\">case<\/span><span style=\"color: #000000\"> lessThanAndEqualInt(value: Int)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">    <\/span><span style=\"color: #0070C1\">case<\/span><span style=\"color: #000000\"> lessThanAndEqualDouble(value: Double)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">    <\/span><span style=\"color: #0070C1\">case<\/span><span style=\"color: #000000\"> contains(value: String)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">}<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Name<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>equal<\/td><td>\u0e40\u0e04\u0e23\u0e37\u0e48\u0e2d\u0e07\u0e2b\u0e21\u0e32\u0e22 ==<\/td><\/tr><tr><td>notEqual<\/td><td>\u0e40\u0e04\u0e23\u0e37\u0e48\u0e2d\u0e07\u0e2b\u0e21\u0e32\u0e22 !=<\/td><\/tr><tr><td>moreThanInt<\/td><td>\u0e40\u0e04\u0e23\u0e37\u0e48\u0e2d\u0e07\u0e2b\u0e21\u0e32\u0e22 &gt; \u0e17\u0e35\u0e48\u0e43\u0e0a\u0e49\u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a Integer<\/td><\/tr><tr><td>moreThanDouble<\/td><td>\u0e40\u0e04\u0e23\u0e37\u0e48\u0e2d\u0e07\u0e2b\u0e21\u0e32\u0e22 &gt; \u0e17\u0e35\u0e48\u0e43\u0e0a\u0e49\u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a Double<\/td><\/tr><tr><td>moreThanAndEqualInt<\/td><td>\u0e40\u0e04\u0e23\u0e37\u0e48\u0e2d\u0e07\u0e2b\u0e21\u0e32\u0e22 &gt;= \u0e17\u0e35\u0e48\u0e43\u0e0a\u0e49\u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a Integer<\/td><\/tr><tr><td>moreThanAndEqualDouble<\/td><td>\u0e40\u0e04\u0e23\u0e37\u0e48\u0e2d\u0e07\u0e2b\u0e21\u0e32\u0e22 &gt;= \u0e17\u0e35\u0e48\u0e43\u0e0a\u0e49\u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a Double<\/td><\/tr><tr><td>lessThanInt<\/td><td>\u0e40\u0e04\u0e23\u0e37\u0e48\u0e2d\u0e07\u0e2b\u0e21\u0e32\u0e22 &lt; \u0e17\u0e35\u0e48\u0e43\u0e0a\u0e49\u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a Integer<\/td><\/tr><tr><td>lessThanDouble<\/td><td>\u0e40\u0e04\u0e23\u0e37\u0e48\u0e2d\u0e07\u0e2b\u0e21\u0e32\u0e22 &lt; \u0e17\u0e35\u0e48\u0e43\u0e0a\u0e49\u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a Double<\/td><\/tr><tr><td>lessThanAndEqualInt<\/td><td>\u0e40\u0e04\u0e23\u0e37\u0e48\u0e2d\u0e07\u0e2b\u0e21\u0e32\u0e22 &lt;= \u0e17\u0e35\u0e48\u0e43\u0e0a\u0e49\u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a Integer<\/td><\/tr><tr><td>lessThanAndEqualDouble<\/td><td>\u0e40\u0e04\u0e23\u0e37\u0e48\u0e2d\u0e07\u0e2b\u0e21\u0e32\u0e22 &lt;= \u0e17\u0e35\u0e48\u0e43\u0e0a\u0e49\u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a Double<\/td><\/tr><tr><td>contains<\/td><td>\u0e01\u0e32\u0e23 Contains String<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"properties\">Properties<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Name<\/th><th>Description<\/th><th>Type<\/th><th>Default<\/th><\/tr><\/thead><tbody><tr><td>jsonObject<\/td><td>String Json \u0e02\u0e2d\u0e07 Model<\/td><td>Optional(String)<\/td><td>null<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"initial\">Initial<\/h2>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-Fira-Code\" style=\"font-size:.875rem;font-family:Code-Pro-Fira-Code,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#000000;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>required convenience public init(jsonObject: &#91;String: Any?&#93;)<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki light-plus\" style=\"background-color: #FFFFFF\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #001080\">required<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #001080\">convenience<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #001080\">public<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #795E26\">init<\/span><span style=\"color: #000000\">(<\/span><span style=\"color: #001080\">jsonObject<\/span><span style=\"color: #000000\">: &#91;<\/span><span style=\"color: #001080\">String<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #001080\">Any<\/span><span style=\"color: #000000\">?&#93;)<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>| Name | Description | Type | | &#8212; | &#8212; | &#8212; | &#8212; | | jsonObject | Model \u0e17\u0e35\u0e48\u0e15\u0e49\u0e2d\u0e07\u0e01\u0e32\u0e23\u0e40\u0e01\u0e47\u0e1a\u0e41\u0e1a\u0e1a Dynamic | Dictionary |<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"example\">Example<\/h2>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-Fira-Code\" style=\"font-size:.875rem;font-family:Code-Pro-Fira-Code,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#000000;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>class YourDynamicModels: AtlasXDynamicModel {\n    required convenience init(jsonObject: &#91;String: Any?&#93;) {\n        self.init(jsonObject: jsonObject)\n    }\n}\n\nlet data = &#91;\"id\": 1, \"KeyA\": \"A\"&#93;\nlet yourDynamicModel = YourDynamicModels(jsonObject: data)\n\n&lt;em>\/\/ Add your model to Database&lt;\/em>\n...<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki light-plus\" style=\"background-color: #FFFFFF\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #0000FF\">class<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #267F99\">YourDynamicModels<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #267F99\">AtlasXDynamicModel<\/span><span style=\"color: #000000\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">    <\/span><span style=\"color: #001080\">required<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #001080\">convenience<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #795E26\">init<\/span><span style=\"color: #000000\">(<\/span><span style=\"color: #001080\">jsonObject<\/span><span style=\"color: #000000\">: &#91;String: <\/span><span style=\"color: #267F99\">Any<\/span><span style=\"color: #000000\">?&#93;) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">        <\/span><span style=\"color: #001080\">self<\/span><span style=\"color: #000000\">.<\/span><span style=\"color: #795E26\">init<\/span><span style=\"color: #000000\">(<\/span><span style=\"color: #001080\">jsonObject<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #001080\">jsonObject<\/span><span style=\"color: #000000\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">    }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">}<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #0000FF\">let<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #001080\">data<\/span><span style=\"color: #000000\"> = &#91;<\/span><span style=\"color: #A31515\">&quot;id&quot;<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #098658\">1<\/span><span style=\"color: #000000\">, <\/span><span style=\"color: #A31515\">&quot;KeyA&quot;<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #A31515\">&quot;A&quot;<\/span><span style=\"color: #000000\">&#93;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #0000FF\">let<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #001080\">yourDynamicModel<\/span><span style=\"color: #000000\"> = <\/span><span style=\"color: #795E26\">YourDynamicModels<\/span><span style=\"color: #000000\">(<\/span><span style=\"color: #001080\">jsonObject<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #001080\">data<\/span><span style=\"color: #000000\">)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #800000\">&lt;em&gt;<\/span><span style=\"color: #000000\">\/\/ Add your model to Database<\/span><span style=\"color: #800000\">&lt;\/em&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">...<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"method-overview\">Method Overview<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Name<\/th><th>Description<\/th><th>Return<\/th><\/tr><\/thead><tbody><tr><td>toJsonObject()<\/td><td>\u0e01\u0e32\u0e23\u0e14\u0e36\u0e07\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e08\u0e32\u0e01 Model \u0e43\u0e2b\u0e49\u0e2d\u0e2d\u0e01\u0e21\u0e32\u0e43\u0e19\u0e23\u0e39\u0e1b Dictionary<\/td><td>Optional(Dictionary)<\/td><\/tr><tr><td>update()<\/td><td>\u0e01\u0e32\u0e23 Update \u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e43\u0e19 Model<\/td><td>void<\/td><\/tr><tr><td>checkData()<\/td><td>Condition \u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a\u0e01\u0e32\u0e23 Filter \u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e43\u0e19 Model<\/td><td>Boolean<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"method-details\">Method Details<\/h2>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-Fira-Code\" style=\"font-size:.875rem;font-family:Code-Pro-Fira-Code,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#000000;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>func toJsonObject() -> &#91;String: Any?&#93;?<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki light-plus\" style=\"background-color: #FFFFFF\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #001080\">func<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #795E26\">toJsonObject<\/span><span style=\"color: #000000\">() -&gt; &#91;<\/span><span style=\"color: #001080\">String<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #001080\">Any<\/span><span style=\"color: #000000\">?&#93;?<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u0e01\u0e32\u0e23\u0e14\u0e36\u0e07\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e08\u0e32\u0e01 Model \u0e43\u0e2b\u0e49\u0e2d\u0e2d\u0e01\u0e21\u0e32\u0e43\u0e19\u0e23\u0e39\u0e1b Dictionary<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"returns\">Returns<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Type<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>Optional(Dictionary)<\/td><td>Return Dictionary \u0e02\u0e2d\u0e07 Model<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-Fira-Code\" style=\"font-size:.875rem;font-family:Code-Pro-Fira-Code,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#000000;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>func checkData(forKey key: String, operation: Operation) -> Bool<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki light-plus\" style=\"background-color: #FFFFFF\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #001080\">func<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #795E26\">checkData<\/span><span style=\"color: #000000\">(<\/span><span style=\"color: #001080\">forKey<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #001080\">key<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #001080\">String<\/span><span style=\"color: #000000\">, <\/span><span style=\"color: #001080\">operation<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #001080\">Operation<\/span><span style=\"color: #000000\">) -&gt; <\/span><span style=\"color: #001080\">Bool<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Condition \u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a\u0e01\u0e32\u0e23 Filter \u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e43\u0e19 Model<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"parameters\">Parameters<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Name<\/th><th>Description<\/th><th>Type<\/th><\/tr><\/thead><tbody><tr><td>forKey<\/td><td>Key \u0e17\u0e35\u0e48\u0e15\u0e49\u0e2d\u0e07\u0e01\u0e32\u0e23\u0e2a\u0e23\u0e49\u0e32\u0e07 Condition<\/td><td>String<\/td><\/tr><tr><td>operation<\/td><td>Operation \u0e02\u0e2d\u0e07 Condition<\/td><td>Operation<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"returns-1\">Returns<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Type<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>Boolean<\/td><td>Return Condition<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"example-1\">Example<\/h3>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-Fira-Code\" style=\"font-size:.875rem;font-family:Code-Pro-Fira-Code,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#000000;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>let yourDynamicModels: &#91;YourDynamicModels&#93;\n\nyourDynamicModels.filter { item in\n    return item.checkData(forKey: \"id\", operation: .equal(value: 1))\n}<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki light-plus\" style=\"background-color: #FFFFFF\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #0000FF\">let<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #001080\">yourDynamicModels<\/span><span style=\"color: #000000\">: &#91;<\/span><span style=\"color: #267F99\">YourDynamicModels<\/span><span style=\"color: #000000\">&#93;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #001080\">yourDynamicModels<\/span><span style=\"color: #000000\">.<\/span><span style=\"color: #001080\">filter<\/span><span style=\"color: #000000\"> { <\/span><span style=\"color: #001080\">item<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #0000FF\">in<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">    <\/span><span style=\"color: #AF00DB\">return<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #001080\">item<\/span><span style=\"color: #000000\">.<\/span><span style=\"color: #795E26\">checkData<\/span><span style=\"color: #000000\">(<\/span><span style=\"color: #001080\">forKey<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #A31515\">&quot;id&quot;<\/span><span style=\"color: #000000\">, <\/span><span style=\"color: #001080\">operation<\/span><span style=\"color: #000000\">: .<\/span><span style=\"color: #795E26\">equal<\/span><span style=\"color: #000000\">(<\/span><span style=\"color: #001080\">value<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #098658\">1<\/span><span style=\"color: #000000\">))<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">}<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-Fira-Code\" style=\"font-size:.875rem;font-family:Code-Pro-Fira-Code,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#000000;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>func update(newJsonObject object: &#91;String: Any?&#93;, completion: ((Error?, &#91;String: Any?&#93;?) -> Void)?)<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki light-plus\" style=\"background-color: #FFFFFF\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #001080\">func<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #795E26\">update<\/span><span style=\"color: #000000\">(<\/span><span style=\"color: #001080\">newJsonObject<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #001080\">object<\/span><span style=\"color: #000000\">: &#91;<\/span><span style=\"color: #001080\">String<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #001080\">Any<\/span><span style=\"color: #000000\">?&#93;, <\/span><span style=\"color: #001080\">completion<\/span><span style=\"color: #000000\">: ((<\/span><span style=\"color: #001080\">Error<\/span><span style=\"color: #000000\">?, &#91;<\/span><span style=\"color: #001080\">String<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #001080\">Any<\/span><span style=\"color: #000000\">?&#93;?) -&gt; <\/span><span style=\"color: #001080\">Void<\/span><span style=\"color: #000000\">)?)<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u0e01\u0e32\u0e23 Update \u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e43\u0e19 Model \u0e42\u0e14\u0e22\u0e08\u0e30\u0e17\u0e33\u0e01\u0e32\u0e23 Merge Model \u0e40\u0e02\u0e49\u0e32\u0e14\u0e49\u0e27\u0e22\u0e01\u0e31\u0e19\u0e41\u0e25\u0e30\u0e22\u0e36\u0e14\u0e04\u0e48\u0e32\u0e02\u0e2d\u0e07 Model \u0e17\u0e35\u0e48\u0e40\u0e02\u0e49\u0e32\u0e21\u0e32 Update \u0e40\u0e2a\u0e21\u0e2d<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"parameters-1\">Parameters<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Name<\/th><th>Description<\/th><th>Type<\/th><\/tr><\/thead><tbody><tr><td>newJsonObject<\/td><td>\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e43\u0e2b\u0e21\u0e48\u0e17\u0e35\u0e48\u0e15\u0e49\u0e2d\u0e07\u0e01\u0e32\u0e23 Update<\/td><td>Dictionary<\/td><\/tr><tr><td>completion<\/td><td>Callback \u0e40\u0e21\u0e37\u0e48\u0e2d Update \u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e2a\u0e33\u0e40\u0e23\u0e47\u0e08\u0e2b\u0e23\u0e37\u0e2d\u0e44\u0e21\u0e48\u0e2a\u0e33\u0e40\u0e23\u0e47\u0e08<\/td><td>Completion<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"example-result\">Example Result<\/h3>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-Fira-Code\" style=\"font-size:.875rem;font-family:Code-Pro-Fira-Code,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#000000;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>let oldModel = &#91;\"KeyA\": \"A\", \"KeyB\": \"B\"&#93;\nlet updateModel = &#91;\"KeyB\": \"B1\", \"KeyC\": \"C\"&#93;\n\n&lt;em>\/\/ After update model&lt;\/em>\nlet resultModel = &#91;\"KeyA\": \"A\", \"KeyB\": \"B1\", \"KeyC\": \"C\"&#93;<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki light-plus\" style=\"background-color: #FFFFFF\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #0000FF\">let<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #001080\">oldModel<\/span><span style=\"color: #000000\"> = &#91;<\/span><span style=\"color: #A31515\">&quot;KeyA&quot;<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #A31515\">&quot;A&quot;<\/span><span style=\"color: #000000\">, <\/span><span style=\"color: #A31515\">&quot;KeyB&quot;<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #A31515\">&quot;B&quot;<\/span><span style=\"color: #000000\">&#93;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #0000FF\">let<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #001080\">updateModel<\/span><span style=\"color: #000000\"> = &#91;<\/span><span style=\"color: #A31515\">&quot;KeyB&quot;<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #A31515\">&quot;B1&quot;<\/span><span style=\"color: #000000\">, <\/span><span style=\"color: #A31515\">&quot;KeyC&quot;<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #A31515\">&quot;C&quot;<\/span><span style=\"color: #000000\">&#93;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #800000\">&lt;em&gt;<\/span><span style=\"color: #000000\">\/\/ After update model<\/span><span style=\"color: #800000\">&lt;\/em&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #0000FF\">let<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #001080\">resultModel<\/span><span style=\"color: #000000\"> = &#91;<\/span><span style=\"color: #A31515\">&quot;KeyA&quot;<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #A31515\">&quot;A&quot;<\/span><span style=\"color: #000000\">, <\/span><span style=\"color: #A31515\">&quot;KeyB&quot;<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #A31515\">&quot;B1&quot;<\/span><span style=\"color: #000000\">, <\/span><span style=\"color: #A31515\">&quot;KeyC&quot;<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #A31515\">&quot;C&quot;<\/span><span style=\"color: #000000\">&#93;<\/span><\/span><\/code><\/pre><\/div>\n","protected":false},"featured_media":0,"parent":3056,"menu_order":1,"comment_status":"closed","ping_status":"closed","template":"","meta":{"nav_title":"","positive":"","negative":"","footnotes":""},"docs_category":[],"class_list":["post-3059","docs","type-docs","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/portal-atlasx.cdg.co.th\/home\/wp-json\/wp\/v2\/docs\/3059","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/portal-atlasx.cdg.co.th\/home\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/portal-atlasx.cdg.co.th\/home\/wp-json\/wp\/v2\/types\/docs"}],"replies":[{"embeddable":true,"href":"https:\/\/portal-atlasx.cdg.co.th\/home\/wp-json\/wp\/v2\/comments?post=3059"}],"version-history":[{"count":1,"href":"https:\/\/portal-atlasx.cdg.co.th\/home\/wp-json\/wp\/v2\/docs\/3059\/revisions"}],"predecessor-version":[{"id":3060,"href":"https:\/\/portal-atlasx.cdg.co.th\/home\/wp-json\/wp\/v2\/docs\/3059\/revisions\/3060"}],"up":[{"embeddable":true,"href":"https:\/\/portal-atlasx.cdg.co.th\/home\/wp-json\/wp\/v2\/docs\/3056"}],"wp:attachment":[{"href":"https:\/\/portal-atlasx.cdg.co.th\/home\/wp-json\/wp\/v2\/media?parent=3059"}],"wp:term":[{"taxonomy":"docs_category","embeddable":true,"href":"https:\/\/portal-atlasx.cdg.co.th\/home\/wp-json\/wp\/v2\/docs_category?post=3059"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}