Toggle navigation
Toggle navigation
This project
Loading...
Sign in
open-source
/
warply_sdk_framework
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
Manos Chorianopoulos
2025-07-28 14:43:38 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
6a2b15bb8c2e438901f080595b14263f5a2380c7
6a2b15bb
1 parent
52b08976
fix MerchantCategoryModel
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
23 deletions
SwiftWarplyFramework/SwiftWarplyFramework/models/MerchantCategoryModel.swift
SwiftWarplyFramework/SwiftWarplyFramework/models/MerchantCategoryModel.swift
View file @
6a2b15b
...
...
@@ -42,6 +42,31 @@ public class MerchantCategoryModel: NSObject {
self
.
name
=
dictionary
[
"name"
]
as?
String
}
// MARK: - Codable Support
private
enum
CodingKeys
:
String
,
CodingKey
{
case
uuid
case
admin_name
case
image
case
parent
case
fields
case
children
case
count
case
name
}
public
required
init
(
from
decoder
:
Decoder
)
throws
{
let
container
=
try
decoder
.
container
(
keyedBy
:
CodingKeys
.
self
)
self
.
uuid
=
try
container
.
decodeIfPresent
(
String
.
self
,
forKey
:
.
uuid
)
self
.
admin_name
=
try
container
.
decodeIfPresent
(
String
.
self
,
forKey
:
.
admin_name
)
self
.
image
=
try
container
.
decodeIfPresent
(
String
.
self
,
forKey
:
.
image
)
self
.
parent
=
try
container
.
decodeIfPresent
(
String
.
self
,
forKey
:
.
parent
)
self
.
fields
=
try
container
.
decodeIfPresent
(
String
.
self
,
forKey
:
.
fields
)
self
.
count
=
try
container
.
decodeIfPresent
(
Int
.
self
,
forKey
:
.
count
)
self
.
name
=
try
container
.
decodeIfPresent
(
String
.
self
,
forKey
:
.
name
)
self
.
children
=
[]
// Default empty array for children
}
// MARK: - Public Accessors
public
var
_uuid
:
String
{
...
...
@@ -110,17 +135,6 @@ public class MerchantCategoryModel: NSObject {
// MARK: - Codable Support
extension
MerchantCategoryModel
:
Codable
{
private
enum
CodingKeys
:
String
,
CodingKey
{
case
uuid
case
admin_name
case
image
case
parent
case
fields
case
children
case
count
case
name
}
public
func
encode
(
to
encoder
:
Encoder
)
throws
{
var
container
=
encoder
.
container
(
keyedBy
:
CodingKeys
.
self
)
try
container
.
encode
(
uuid
,
forKey
:
.
uuid
)
...
...
@@ -132,18 +146,6 @@ extension MerchantCategoryModel: Codable {
try
container
.
encodeIfPresent
(
name
,
forKey
:
.
name
)
// Note: children is [Any] so we skip encoding it for now
}
public
required
init
(
from
decoder
:
Decoder
)
throws
{
let
container
=
try
decoder
.
container
(
keyedBy
:
CodingKeys
.
self
)
self
.
uuid
=
try
container
.
decodeIfPresent
(
String
.
self
,
forKey
:
.
uuid
)
self
.
admin_name
=
try
container
.
decodeIfPresent
(
String
.
self
,
forKey
:
.
admin_name
)
self
.
image
=
try
container
.
decodeIfPresent
(
String
.
self
,
forKey
:
.
image
)
self
.
parent
=
try
container
.
decodeIfPresent
(
String
.
self
,
forKey
:
.
parent
)
self
.
fields
=
try
container
.
decodeIfPresent
(
String
.
self
,
forKey
:
.
fields
)
self
.
count
=
try
container
.
decodeIfPresent
(
Int
.
self
,
forKey
:
.
count
)
self
.
name
=
try
container
.
decodeIfPresent
(
String
.
self
,
forKey
:
.
name
)
self
.
children
=
[]
// Default empty array for children
}
}
// MARK: - Debug Description
...
...
Please
register
or
login
to post a comment