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
2022-04-29 16:22:41 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
674e99b8e49b6468a5afa52343e1c93a7e0effdd
674e99b8
1 parent
2a84ac1b
fix swiftApi models v2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
7 deletions
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS.xcworkspace/xcuserdata/manos.xcuserdatad/UserInterfaceState.xcuserstate
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/swiftApi.swift
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS.xcworkspace/xcuserdata/manos.xcuserdatad/UserInterfaceState.xcuserstate
View file @
674e99b
No preview for this file type
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/swiftApi.swift
View file @
674e99b
...
...
@@ -140,15 +140,23 @@ public class swiftApi {
self
.
category
=
dictionary
[
"category"
]
as?
String
?
??
""
self
.
barcode
=
dictionary
[
"barcode"
]
as?
String
?
??
""
self
.
status
=
dictionary
[
"status"
]
as?
Int
?
??
nil
self
.
couponset_data
=
dictionary
[
"couponset_data"
]
as?
CouponSetItemModel
?
??
nil
let
expirationObject
=
dictionary
[
"expiration"
]
as?
[
String
:
Any
]?
??
[
""
:
""
]
let
expirationString
=
expirationObject
?[
"value"
]
as?
String
?
??
""
if
let
couponSetData
=
dictionary
[
"couponset_data"
]
as?
[
String
:
Any
]?
??
[
""
:
""
]
{
let
tempCouponset
=
CouponSetItemModel
(
dictionary
:
couponSetData
)
self
.
couponset_data
=
tempCouponset
}
else
{
self
.
couponset_data
=
nil
}
let
expirationString
=
dictionary
[
"expiration"
]
as?
String
?
??
""
// Example expirationString: Optional(2022-12-05 01:55)
let
dateFormatter
=
DateFormatter
()
dateFormatter
.
dateFormat
=
"yyyy-MM-dd hh:mm"
dateFormatter
.
dateFormat
=
"yyyy-MM-dd hh:mm
:ss
"
if
let
date
=
dateFormatter
.
date
(
from
:
expirationString
??
""
)
{
dateFormatter
.
dateFormat
=
"dd/MM/yyyy"
let
resultString
=
dateFormatter
.
string
(
from
:
date
)
...
...
@@ -192,15 +200,15 @@ public class swiftApi {
let
couponsData
=
(
myCouponsDictionary
[
"result"
]
as!
Array
<
NSMutableDictionary
>
)
if
let
sets
=
couponSetsData
as?
NSArray
{
for
set
in
sets
{
let
s
=
set
as!
[
String
:
Any
]
let
s
=
set
as!
NSDictionary
if
let
cpns
=
couponsData
as?
NSArray
{
for
coupon
in
cpns
{
var
c
=
coupon
as!
[
String
:
Any
]
var
c
=
coupon
as!
NSDictionary
// var temp = NSMutableDictionary(dictionary: s);
if
c
[
"couponset_uuid"
]
as!
String
==
s
[
"uuid"
]
as!
String
{
let
temp
=
NSMutableDictionary
(
dictionary
:
c
);
temp
.
setValue
(
s
as
[
AnyHashable
:
Any
],
forKey
:
"couponset_data"
)
temp
.
setValue
(
s
as
!
[
AnyHashable
:
Any
],
forKey
:
"couponset_data"
)
let
tempCoupon
=
CouponItemModel
(
dictionary
:
temp
as!
[
String
:
Any
])
couponsArray
.
append
(
tempCoupon
)
...
...
Please
register
or
login
to post a comment