Manos Chorianopoulos

update allGifts

......@@ -71,16 +71,18 @@ extension AllGiftsView {
struct giftItemView: View {
var item: NSDictionary
var item: swiftApi.CouponItemModel
var parentView: UIView
var uiscreen = UIScreen.main.bounds
var body: some View {
let couponSetData = item.couponset_data
Button {
// GiftItem Action
let instanceOfMyApi = MyApi()
let couponBarcodeViewController = instanceOfMyApi.openCouponBarcode(parentView, coupon: item as! [String : Any])!
let instanceOfMySwiftApi = swiftApi()
let couponBarcodeViewController = instanceOfMySwiftApi.openCouponBarcode(parent: parentView, coupon: item)
couponBarcodeViewController.view.tag = 7
// addChild(couponsViewController)
couponBarcodeViewController.view.frame = parentView.frame
......@@ -89,10 +91,10 @@ extension AllGiftsView {
} label: {
HStack(alignment: .center, spacing: 0.0) {
ImageView(withURL: item["img_preview"] as? String ?? "", width: self.uiscreen.width * 0.5, isFill: true)
ImageView(withURL: couponSetData?.img_preview ?? "", width: self.uiscreen.width * 0.5, isFill: true)
VStack(alignment: .leading, spacing: 5.0) {
Text(item["name"] as? String ?? "")
Text(couponSetData?.name ?? "")
.fontWeight(.bold)
.font(.system(size: 16))
.foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803))
......@@ -100,7 +102,7 @@ extension AllGiftsView {
.padding([.top,.horizontal], 15)
.background(Color.white)
Text(item["short_description"] as? String ?? "")
Text(couponSetData?.short_description ?? "")
.fontWeight(.regular)
.font(.system(size: 16))
.foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803))
......@@ -123,7 +125,7 @@ extension AllGiftsView {
}
struct couponsContainer: View {
@State var coupons:Array<NSDictionary> = []
@State var coupons:Array<swiftApi.CouponItemModel> = []
@State var parentView:UIView
var uiscreen = UIScreen.main.bounds
......@@ -148,10 +150,19 @@ extension AllGiftsView {
struct AllGiftsView: View {
var parentView: UIView
var coupons:Array<NSDictionary> = DataModel().getData
var coupons:Array<swiftApi.CouponItemModel> = []
var uiscreen = UIScreen.main.bounds
init(parentView: UIView) { //initializer method
let instanceOfMySwiftApi = swiftApi()
let couponsData = instanceOfMySwiftApi.getCoupons()
self.coupons = couponsData
self.parentView = parentView
}
func goBack(){
for subview in parentView.subviews {
if(subview.tag == 8) {
......