Vasilis

revert of mistake at warply.m

This diff could not be displayed because it is too large.
......@@ -9,7 +9,7 @@
import SwiftUI
import Combine
import Foundation
import UIKit
class DataModel {
var data: Array<NSDictionary> = []
......@@ -95,15 +95,22 @@ struct ImageView: View {
extension CouponsView {
struct headerView: View {
var goBack: () -> ()
var uiscreen = UIScreen.main.bounds
var body: some View {
HStack {
Image("ic_back", bundle: Bundle(for: MyEmptyClass.self))
.resizable()
.frame(width: self.uiscreen.width * 0.025, height: self.uiscreen.height * 0.02)
.offset(x: -self.uiscreen.width / 2 + self.uiscreen.width * 0.05, y: self.uiscreen.height * 0.04)
Button(action: goBack) {
HStack {
Image("ic_back", bundle: Bundle(for: MyEmptyClass.self))
.resizable()
.frame(width: self.uiscreen.width * 0.025, height: self.uiscreen.height * 0.02)
// .offset(x: -self.uiscreen.width / 2 + self.uiscreen.width * 0.05, y: self.uiscreen.height * 0.04)
}
}
// .frame(width: self.uiscreen.width * 0.025, height: self.uiscreen.height * 0.02)
// .offset(x: -self.uiscreen.width / 2 + self.uiscreen.width * 0.05, y: self.uiscreen.height * 0.04)
Text("Όλα τα κουπόνια μου")
.frame(width: self.uiscreen.width * 0.8, height: self.uiscreen.height * 0.025, alignment: .center)
.offset( y: self.uiscreen.height * 0.04)
......@@ -127,22 +134,28 @@ extension CouponsView {
HStack(alignment: .center) {
HStack(alignment: .center) {
ImageView(withURL: result["img_preview"] as! String)
.frame(width: self.uiscreen.width * 0.2, height: self.uiscreen.height * 0.05)
.frame(maxWidth: self.uiscreen.width * 0.2)
// .offset(x: -self.uiscreen.width / 2 + self.uiscreen.width * 0.2, y: -self.uiscreen.height * 0.05 * 0.96)
// .padding(.leading, self.uiscreen.width * 0.05)
Rectangle()
.frame(width: 1, height: self.uiscreen.height * 0.1 * 0.93)
// .offset(x: -self.uiscreen.width / 2 + self.uiscreen.width * 0.205, y: -self.uiscreen.height * 0.05 * 0.93)
VStack {
Text(CouponsView.couponView.localizedWithParameter(parameter: result["admin_name"] as! String))
Text(CouponsView.couponView.localizedWithParameter(parameter: result["discount"] as! String))
Text(CouponsView.couponView.localizedWithParameter(parameter: "Ισχύει εώς " + (result["expiration"] as! String).components(separatedBy: [" "]).filter({!$0.isEmpty})[0]))
Text(CouponsView.couponView.localizedWithParameter(parameter: result["admin_name"] as? String ?? ""))
.frame(maxWidth: self.uiscreen.width * 0.27, maxHeight: .infinity, alignment: .leading)
Text(CouponsView.couponView.localizedWithParameter(parameter: result["discount"] as? String ?? ""))
.frame(maxWidth: self.uiscreen.width * 0.27, maxHeight: .infinity, alignment: .leading)
Text(CouponsView.couponView.localizedWithParameter(parameter: "Ισχύει εώς " + (result["expiration"] as? String ?? "").components(separatedBy: [" "]).filter({!$0.isEmpty})[0]))
.frame(maxWidth: self.uiscreen.width * 0.27, maxHeight: .infinity, alignment: .leading)
}
.frame(maxHeight: .infinity)
.padding(.top, self.uiscreen.height * 0.03)
.padding(.bottom, self.uiscreen.height * 0.03)
VStack {
Text(CouponsView.couponView.localizedWithParameter(parameter: result["short_description"] as! String))
.frame(maxWidth: self.uiscreen.width * 0.15, maxHeight: .infinity)
}
.frame(maxWidth: self.uiscreen.width * 0.15, maxHeight: .infinity)
.frame(maxWidth: self.uiscreen.width * 0.25, maxHeight: .infinity)
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
......@@ -152,7 +165,7 @@ extension CouponsView {
Image("coupons_container", bundle: Bundle(for: MyEmptyClass.self))
)
// .padding(.top, self.uiscreen.height * 0.05)
.frame(width: self.uiscreen.width * 0.9, height: self.uiscreen.height * 0.1)
.frame(width: self.uiscreen.width * 0.9, height: self.uiscreen.height * 0.13)
.background(Color.purple)
}
}
......@@ -161,14 +174,24 @@ extension CouponsView {
@available(iOS 13.0.0, *)
struct CouponsView: View {
var data:Array<NSDictionary> = DataModel().getData
var tag: String = "coupons"
var parentView: UIView
var uiscreen = UIScreen.main.bounds
func goBack(){
for subview in parentView.subviews {
if(subview.tag == 1) {
subview.removeFromSuperview()
}
}
}
var body: some View {
VStack {
headerView()
headerView(goBack: goBack)
ScrollView {
VStack {
if (data.count) > 0 {
......