Showing
17 changed files
with
379 additions
and
35 deletions
... | @@ -7,7 +7,7 @@ | ... | @@ -7,7 +7,7 @@ |
7 | <key>Pods-SwiftWarplyFramework.xcscheme_^#shared#^_</key> | 7 | <key>Pods-SwiftWarplyFramework.xcscheme_^#shared#^_</key> |
8 | <dict> | 8 | <dict> |
9 | <key>orderHint</key> | 9 | <key>orderHint</key> |
10 | - <integer>0</integer> | 10 | + <integer>1</integer> |
11 | </dict> | 11 | </dict> |
12 | </dict> | 12 | </dict> |
13 | </dict> | 13 | </dict> | ... | ... |
... | @@ -7,6 +7,7 @@ | ... | @@ -7,6 +7,7 @@ |
7 | objects = { | 7 | objects = { |
8 | 8 | ||
9 | /* Begin PBXBuildFile section */ | 9 | /* Begin PBXBuildFile section */ |
10 | + 1EA1AF0A2835346A008998AA /* CouponsTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EA1AF092835346A008998AA /* CouponsTableViewCell.swift */; }; | ||
10 | 7630AD9A6242D60846D6750C /* Pods_SwiftWarplyFramework.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C0D5F56DD4E5371A50AD2D87 /* Pods_SwiftWarplyFramework.framework */; }; | 11 | 7630AD9A6242D60846D6750C /* Pods_SwiftWarplyFramework.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C0D5F56DD4E5371A50AD2D87 /* Pods_SwiftWarplyFramework.framework */; }; |
11 | E6A77853282933340045BBA8 /* SwiftWarplyFramework.docc in Sources */ = {isa = PBXBuildFile; fileRef = E6A77852282933340045BBA8 /* SwiftWarplyFramework.docc */; }; | 12 | E6A77853282933340045BBA8 /* SwiftWarplyFramework.docc in Sources */ = {isa = PBXBuildFile; fileRef = E6A77852282933340045BBA8 /* SwiftWarplyFramework.docc */; }; |
12 | E6A77854282933340045BBA8 /* SwiftWarplyFramework.h in Headers */ = {isa = PBXBuildFile; fileRef = E6A77851282933340045BBA8 /* SwiftWarplyFramework.h */; settings = {ATTRIBUTES = (Public, ); }; }; | 13 | E6A77854282933340045BBA8 /* SwiftWarplyFramework.h in Headers */ = {isa = PBXBuildFile; fileRef = E6A77851282933340045BBA8 /* SwiftWarplyFramework.h */; settings = {ATTRIBUTES = (Public, ); }; }; |
... | @@ -137,6 +138,7 @@ | ... | @@ -137,6 +138,7 @@ |
137 | /* End PBXBuildFile section */ | 138 | /* End PBXBuildFile section */ |
138 | 139 | ||
139 | /* Begin PBXFileReference section */ | 140 | /* Begin PBXFileReference section */ |
141 | + 1EA1AF092835346A008998AA /* CouponsTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CouponsTableViewCell.swift; sourceTree = "<group>"; }; | ||
140 | A9B7BE01A4E812DE49866EF8 /* Pods-SwiftWarplyFramework.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftWarplyFramework.debug.xcconfig"; path = "Target Support Files/Pods-SwiftWarplyFramework/Pods-SwiftWarplyFramework.debug.xcconfig"; sourceTree = "<group>"; }; | 142 | A9B7BE01A4E812DE49866EF8 /* Pods-SwiftWarplyFramework.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftWarplyFramework.debug.xcconfig"; path = "Target Support Files/Pods-SwiftWarplyFramework/Pods-SwiftWarplyFramework.debug.xcconfig"; sourceTree = "<group>"; }; |
141 | B9EB8A451EF0C5AD75094EEE /* Pods-SwiftWarplyFramework.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftWarplyFramework.release.xcconfig"; path = "Target Support Files/Pods-SwiftWarplyFramework/Pods-SwiftWarplyFramework.release.xcconfig"; sourceTree = "<group>"; }; | 143 | B9EB8A451EF0C5AD75094EEE /* Pods-SwiftWarplyFramework.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftWarplyFramework.release.xcconfig"; path = "Target Support Files/Pods-SwiftWarplyFramework/Pods-SwiftWarplyFramework.release.xcconfig"; sourceTree = "<group>"; }; |
142 | C0D5F56DD4E5371A50AD2D87 /* Pods_SwiftWarplyFramework.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SwiftWarplyFramework.framework; sourceTree = BUILT_PRODUCTS_DIR; }; | 144 | C0D5F56DD4E5371A50AD2D87 /* Pods_SwiftWarplyFramework.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SwiftWarplyFramework.framework; sourceTree = BUILT_PRODUCTS_DIR; }; |
... | @@ -320,6 +322,7 @@ | ... | @@ -320,6 +322,7 @@ |
320 | isa = PBXGroup; | 322 | isa = PBXGroup; |
321 | children = ( | 323 | children = ( |
322 | E6A7785E282933E40045BBA8 /* CouponsViewController.swift */, | 324 | E6A7785E282933E40045BBA8 /* CouponsViewController.swift */, |
325 | + 1EA1AF092835346A008998AA /* CouponsTableViewCell.swift */, | ||
323 | E6A7785D282933E40045BBA8 /* CouponViewController.swift */, | 326 | E6A7785D282933E40045BBA8 /* CouponViewController.swift */, |
324 | E6A77863282933E50045BBA8 /* DetailsViewController.swift */, | 327 | E6A77863282933E50045BBA8 /* DetailsViewController.swift */, |
325 | E6A778DE282933E60045BBA8 /* GiftsViewController.swift */, | 328 | E6A778DE282933E60045BBA8 /* GiftsViewController.swift */, |
... | @@ -750,6 +753,7 @@ | ... | @@ -750,6 +753,7 @@ |
750 | E6A77935282933E70045BBA8 /* UIWebView+AFNetworking.m in Sources */, | 753 | E6A77935282933E70045BBA8 /* UIWebView+AFNetworking.m in Sources */, |
751 | E6A77925282933E70045BBA8 /* UIProgressView+AFNetworking.m in Sources */, | 754 | E6A77925282933E70045BBA8 /* UIProgressView+AFNetworking.m in Sources */, |
752 | E6A77944282933E70045BBA8 /* AFSecurityPolicy.m in Sources */, | 755 | E6A77944282933E70045BBA8 /* AFSecurityPolicy.m in Sources */, |
756 | + 1EA1AF0A2835346A008998AA /* CouponsTableViewCell.swift in Sources */, | ||
753 | E6A77A32282BA9C60045BBA8 /* CampaignViewController.swift in Sources */, | 757 | E6A77A32282BA9C60045BBA8 /* CampaignViewController.swift in Sources */, |
754 | E6A77917282933E60045BBA8 /* UIViewController+WLAdditions.m in Sources */, | 758 | E6A77917282933E60045BBA8 /* UIViewController+WLAdditions.m in Sources */, |
755 | E6A77943282933E70045BBA8 /* AFNetworkReachabilityManager.m in Sources */, | 759 | E6A77943282933E70045BBA8 /* AFNetworkReachabilityManager.m in Sources */, | ... | ... |
... | @@ -7,7 +7,7 @@ | ... | @@ -7,7 +7,7 @@ |
7 | <key>SwiftWarplyFramework.xcscheme_^#shared#^_</key> | 7 | <key>SwiftWarplyFramework.xcscheme_^#shared#^_</key> |
8 | <dict> | 8 | <dict> |
9 | <key>orderHint</key> | 9 | <key>orderHint</key> |
10 | - <integer>1</integer> | 10 | + <integer>0</integer> |
11 | </dict> | 11 | </dict> |
12 | </dict> | 12 | </dict> |
13 | </dict> | 13 | </dict> | ... | ... |
No preview for this file type
... | @@ -9,6 +9,7 @@ import UIKit | ... | @@ -9,6 +9,7 @@ import UIKit |
9 | 9 | ||
10 | class CouponViewController: UIViewController { | 10 | class CouponViewController: UIViewController { |
11 | @IBOutlet weak var mainView: UIView! | 11 | @IBOutlet weak var mainView: UIView! |
12 | + @IBOutlet weak var backgroundImage: UIImageView! | ||
12 | @IBOutlet weak var scrollView: UIScrollView! | 13 | @IBOutlet weak var scrollView: UIScrollView! |
13 | @IBOutlet weak var scrollContentView: UIView! | 14 | @IBOutlet weak var scrollContentView: UIView! |
14 | @IBOutlet weak var couponImageHeight: NSLayoutConstraint! | 15 | @IBOutlet weak var couponImageHeight: NSLayoutConstraint! |
... | @@ -28,6 +29,8 @@ class CouponViewController: UIViewController { | ... | @@ -28,6 +29,8 @@ class CouponViewController: UIViewController { |
28 | setBackButton() | 29 | setBackButton() |
29 | setNavigationTitle("Εκπτωτικό κουπόνι") | 30 | setNavigationTitle("Εκπτωτικό κουπόνι") |
30 | 31 | ||
32 | + backgroundImage.image = UIImage(named: "coupons_scrollview_white") | ||
33 | + | ||
31 | scrollView.clipsToBounds = true | 34 | scrollView.clipsToBounds = true |
32 | scrollView.layer.cornerRadius = 30 | 35 | scrollView.layer.cornerRadius = 30 |
33 | scrollView.layer.maskedCorners = [ .layerMinXMinYCorner] // Top left corner radius | 36 | scrollView.layer.maskedCorners = [ .layerMinXMinYCorner] // Top left corner radius | ... | ... |
1 | +// | ||
2 | +// CouponsTableViewCell.swift | ||
3 | +// SwiftWarplyFramework | ||
4 | +// | ||
5 | +// Created by Manos Chorianopoulos on 18/5/22. | ||
6 | +// | ||
7 | + | ||
8 | +import Foundation | ||
9 | +import UIKit | ||
10 | +import WarplySDKFrameworkIOS | ||
11 | + | ||
12 | +class CouponsTableViewCell: UITableViewCell { | ||
13 | + @IBOutlet weak var couponBgImage: UIImageView! | ||
14 | + @IBOutlet weak var couponImage: UIImageView! | ||
15 | + @IBOutlet weak var borderView: UIView! | ||
16 | + @IBOutlet weak var nameLabel: UILabel! | ||
17 | + @IBOutlet weak var dicountLabel: UILabel! | ||
18 | + @IBOutlet weak var discriptionLabel: UILabel! | ||
19 | + @IBOutlet weak var expirationLabel: UILabel! | ||
20 | + | ||
21 | + | ||
22 | + override func awakeFromNib() { | ||
23 | + super.awakeFromNib() | ||
24 | + // Initialization code | ||
25 | + | ||
26 | + couponBgImage.image = UIImage(named: "coupon_bg") | ||
27 | + | ||
28 | + borderView.addDashedBorderVertical(color: UIColor(red: 0.44, green: 0.44, blue: 0.44, alpha: 1.00), width: 1.0, height: 110.0) | ||
29 | + } | ||
30 | + | ||
31 | + override func setSelected(_ selected: Bool, animated: Bool) { | ||
32 | + super.setSelected(selected, animated: animated) | ||
33 | + | ||
34 | + // Configure the view for the selected state | ||
35 | + } | ||
36 | + | ||
37 | + override func layoutSubviews() { | ||
38 | + super.layoutSubviews() | ||
39 | + //set the values for top,left,bottom,right margins | ||
40 | + let margins = UIEdgeInsets(top: 0, left: 0, bottom: 30, right: 0) | ||
41 | + contentView.frame = contentView.frame.inset(by: margins) | ||
42 | + } | ||
43 | + | ||
44 | + | ||
45 | + func configureCell(coupon: swiftApi.CouponItemModel) { | ||
46 | +// COUPONSET: desc, img_preview, name, terms | ||
47 | +// COUPON: coupon, expiration, discount, status | ||
48 | + | ||
49 | + let couponSetData: swiftApi.CouponSetItemModel? = coupon.couponset_data | ||
50 | + | ||
51 | + couponImage.load(link: couponSetData?.img_preview ?? "", placeholder: UIImage(), cache: URLCache()) | ||
52 | + nameLabel.text = couponSetData?.name ?? "" | ||
53 | + dicountLabel.text = (coupon.discount ?? "") + "€" | ||
54 | + discriptionLabel.text = couponSetData?.short_description ?? "" | ||
55 | + expirationLabel.text = "Ισχύει έως "+(coupon.expiration ?? "") | ||
56 | + } | ||
57 | + | ||
58 | +} |
... | @@ -7,21 +7,86 @@ | ... | @@ -7,21 +7,86 @@ |
7 | 7 | ||
8 | import Foundation | 8 | import Foundation |
9 | import UIKit | 9 | import UIKit |
10 | +import WarplySDKFrameworkIOS | ||
10 | 11 | ||
11 | @objc public class CouponsViewController: UIViewController { | 12 | @objc public class CouponsViewController: UIViewController { |
13 | + @IBOutlet weak var backgroundImage: UIImageView! | ||
14 | + @IBOutlet weak var tableView: UITableView! | ||
12 | 15 | ||
13 | - @IBOutlet weak var couponButton: UIButton! | 16 | + var coupons:Array<swiftApi.CouponItemModel> = [] |
14 | - | 17 | + |
15 | - public override func viewWillAppear(_ animated: Bool) { | 18 | + override func viewDidLoad() { |
16 | - super.viewWillAppear(animated) | 19 | + super.viewDidLoad() |
20 | + | ||
21 | + getCouponsRequest() | ||
22 | + | ||
17 | setBackButton() | 23 | setBackButton() |
18 | - setNavigationTitle("Εκπτωτικό κουπόνι") | 24 | + setNavigationTitle("Ενεργά κουπόνια") |
25 | + | ||
26 | + backgroundImage.image = UIImage(named: "coupons_scrollview_dark") | ||
27 | + | ||
28 | + tableView.delegate = self | ||
29 | + tableView.dataSource = self | ||
30 | + | ||
31 | + tableView.clipsToBounds = true | ||
32 | + tableView.layer.cornerRadius = 30 | ||
33 | + tableView.layer.maskedCorners = [ .layerMinXMinYCorner] // Top left corner radius | ||
34 | + tableView.contentInset.top = 50 | ||
35 | + } | ||
36 | + | ||
37 | + | ||
38 | + | ||
39 | + // MARK: - API Functions | ||
40 | + func getCouponsRequest() { | ||
41 | + swiftApi().getCouponsAsync(getCouponsCallback) | ||
42 | + } | ||
43 | + | ||
44 | + func getCouponsCallback (_ couponsData: Array<swiftApi.CouponItemModel>?) -> Void { | ||
45 | + if (couponsData != nil) { | ||
46 | + let activeCouponData = swiftApi().filterActiveCoupons(couponsData ?? []) | ||
47 | + | ||
48 | + self.coupons = activeCouponData | ||
49 | + | ||
50 | + DispatchQueue.main.async { | ||
51 | + self.tableView.reloadData() | ||
52 | + } | ||
53 | + } else { | ||
54 | + self.coupons = [] | ||
55 | + } | ||
56 | + } | ||
57 | + | ||
58 | +} | ||
59 | + | ||
60 | +// MARK: - TableView | ||
61 | +extension CouponsViewController: UITableViewDelegate, UITableViewDataSource{ | ||
62 | + | ||
63 | + func numberOfSections(in tableView: UITableView) -> Int { | ||
64 | + return 1 | ||
65 | + } | ||
66 | + | ||
67 | + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | ||
68 | + return self.coupons.count | ||
19 | } | 69 | } |
20 | 70 | ||
71 | + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { | ||
72 | + return 120.0 + 30.0 | ||
73 | +// return UITableViewAutomaticDimension | ||
74 | + } | ||
21 | 75 | ||
22 | - @IBAction func navigateToCoupon(_ sender: Any) { | 76 | + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { |
23 | - let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) | 77 | + let cell = tableView.dequeueReusableCell(withIdentifier: "CouponsTableViewCellId", for: indexPath) as! CouponsTableViewCell |
24 | - let vc = storyboard.instantiateViewController(withIdentifier: "CouponViewController") as UIViewController | 78 | + |
25 | - self.navigationController?.pushViewController(vc, animated: true) | 79 | + cell.configureCell(coupon: coupons[indexPath.row]) |
80 | + | ||
81 | + return cell | ||
26 | } | 82 | } |
83 | + | ||
84 | + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { | ||
85 | + | ||
86 | + // TODO: navigate to CouponBarcode | ||
87 | + // let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) | ||
88 | + // let vc = storyboard.instantiateViewController(withIdentifier: "CouponBarcodeViewController") as UIViewController | ||
89 | + // self.navigationController?.pushViewController(vc, animated: true) | ||
90 | + } | ||
91 | + | ||
27 | } | 92 | } | ... | ... |
... | @@ -12,39 +12,159 @@ | ... | @@ -12,39 +12,159 @@ |
12 | <!--Coupons View Controller--> | 12 | <!--Coupons View Controller--> |
13 | <scene sceneID="s0d-6b-0kx"> | 13 | <scene sceneID="s0d-6b-0kx"> |
14 | <objects> | 14 | <objects> |
15 | - <viewController storyboardIdentifier="CouponsViewController" id="zti-Lv-RCc" customClass="CouponsViewController" customModule="SwiftWarplyFramework" customModuleProvider="target" sceneMemberID="viewController"> | 15 | + <viewController storyboardIdentifier="CouponsViewController" id="UpJ-ey-hJ5" customClass="CouponsViewController" customModule="SwiftWarplyFramework" customModuleProvider="target" sceneMemberID="viewController"> |
16 | - <view key="view" contentMode="scaleToFill" id="OHf-ga-xvH"> | 16 | + <view key="view" contentMode="scaleToFill" id="XzS-AB-unt"> |
17 | <rect key="frame" x="0.0" y="0.0" width="414" height="896"/> | 17 | <rect key="frame" x="0.0" y="0.0" width="414" height="896"/> |
18 | <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | 18 | <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> |
19 | <subviews> | 19 | <subviews> |
20 | - <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="coupons_scrollview" translatesAutoresizingMaskIntoConstraints="NO" id="t7M-3j-iFe"> | 20 | + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="FoX-v7-tak" userLabel="Main View"> |
21 | - <rect key="frame" x="0.0" y="88" width="414" height="808"/> | 21 | + <rect key="frame" x="0.0" y="44" width="414" height="852"/> |
22 | - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> | ||
23 | - </imageView> | ||
24 | - <scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ebo-cU-G6Q"> | ||
25 | - <rect key="frame" x="0.0" y="88" width="414" height="808"/> | ||
26 | - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> | ||
27 | <subviews> | 22 | <subviews> |
28 | - <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Vy5-PH-dRI"> | 23 | + <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="coupons_scrollview_dark" translatesAutoresizingMaskIntoConstraints="NO" id="5rB-1e-ygb"> |
29 | - <rect key="frame" x="151" y="107" width="114" height="31"/> | 24 | + <rect key="frame" x="0.0" y="0.0" width="414" height="852"/> |
30 | - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> | 25 | + </imageView> |
31 | - <state key="normal" title="Button"/> | 26 | + <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="none" allowsSelection="NO" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="-1" estimatedSectionHeaderHeight="-1" sectionFooterHeight="-1" estimatedSectionFooterHeight="-1" translatesAutoresizingMaskIntoConstraints="NO" id="KhH-tg-FBN"> |
32 | - <buttonConfiguration key="configuration" style="plain" title="Go to Coupon"/> | 27 | + <rect key="frame" x="0.0" y="5" width="414" height="847"/> |
28 | + <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | ||
29 | + <color key="sectionIndexBackgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | ||
30 | + <prototypes> | ||
31 | + <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="CouponsTableViewCellId" id="Ivk-7o-eVp" customClass="CouponsTableViewCell" customModule="SwiftWarplyFramework" customModuleProvider="target"> | ||
32 | + <rect key="frame" x="0.0" y="44.5" width="414" height="115"/> | ||
33 | + <autoresizingMask key="autoresizingMask"/> | ||
34 | + <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="Ivk-7o-eVp" id="OpF-ry-8Pc"> | ||
35 | + <rect key="frame" x="0.0" y="0.0" width="414" height="115"/> | ||
36 | + <autoresizingMask key="autoresizingMask"/> | ||
37 | + <subviews> | ||
38 | + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="JaN-ia-6ul"> | ||
39 | + <rect key="frame" x="10" y="0.0" width="394" height="115"/> | ||
40 | + <subviews> | ||
41 | + <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="coupon_bg" translatesAutoresizingMaskIntoConstraints="NO" id="2YB-QL-me8"> | ||
42 | + <rect key="frame" x="0.0" y="0.0" width="394" height="115"/> | ||
43 | + </imageView> | ||
44 | + <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="qgV-LI-5lL"> | ||
45 | + <rect key="frame" x="20" y="10" width="79" height="95"/> | ||
46 | + <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | ||
47 | + </imageView> | ||
48 | + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="kWi-pp-keF"> | ||
49 | + <rect key="frame" x="104" y="5" width="10" height="105"/> | ||
50 | + <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | ||
51 | + <constraints> | ||
52 | + <constraint firstAttribute="width" constant="10" id="UQ1-xk-Qqc"/> | ||
53 | + </constraints> | ||
54 | + </view> | ||
55 | + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gWw-Mr-bn2"> | ||
56 | + <rect key="frame" x="119" y="15" width="255" height="19.5"/> | ||
57 | + <fontDescription key="fontDescription" type="system" weight="medium" pointSize="16"/> | ||
58 | + <color key="textColor" red="0.22745098039215686" green="0.32156862745098036" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/> | ||
59 | + <nil key="highlightedColor"/> | ||
60 | + </label> | ||
61 | + <stackView opaque="NO" contentMode="scaleToFill" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="URC-i5-9Gw"> | ||
62 | + <rect key="frame" x="119" y="39.5" width="255" height="36"/> | ||
63 | + <subviews> | ||
64 | + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Ssk-9S-HMD"> | ||
65 | + <rect key="frame" x="0.0" y="0.0" width="127.5" height="36"/> | ||
66 | + <fontDescription key="fontDescription" type="boldSystem" pointSize="30"/> | ||
67 | + <color key="textColor" red="0.22745098039215686" green="0.32156862745098036" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/> | ||
68 | + <nil key="highlightedColor"/> | ||
69 | + </label> | ||
70 | + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" numberOfLines="3" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hWa-mr-cXD"> | ||
71 | + <rect key="frame" x="132.5" y="0.0" width="122.5" height="36"/> | ||
72 | + <fontDescription key="fontDescription" type="system" weight="medium" pointSize="11"/> | ||
73 | + <color key="textColor" red="0.38039215686274508" green="0.44313725490196076" blue="0.50588235294117645" alpha="1" colorSpace="calibratedRGB"/> | ||
74 | + <nil key="highlightedColor"/> | ||
75 | + </label> | ||
76 | + </subviews> | ||
77 | + <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | ||
78 | + <constraints> | ||
79 | + <constraint firstItem="Ssk-9S-HMD" firstAttribute="width" secondItem="URC-i5-9Gw" secondAttribute="width" multiplier="0.5" id="OLz-q3-DQc"/> | ||
80 | + </constraints> | ||
81 | + </stackView> | ||
82 | + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Kdt-I2-GtS"> | ||
83 | + <rect key="frame" x="119" y="86.5" width="255" height="13.5"/> | ||
84 | + <fontDescription key="fontDescription" type="system" weight="medium" pointSize="11"/> | ||
85 | + <color key="textColor" red="0.38039215686274508" green="0.44313725490196076" blue="0.50588235294117645" alpha="1" colorSpace="calibratedRGB"/> | ||
86 | + <nil key="highlightedColor"/> | ||
87 | + </label> | ||
88 | + </subviews> | ||
89 | + <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | ||
90 | + <constraints> | ||
91 | + <constraint firstItem="Kdt-I2-GtS" firstAttribute="leading" secondItem="kWi-pp-keF" secondAttribute="trailing" constant="5" id="4H7-U6-dwU"/> | ||
92 | + <constraint firstItem="kWi-pp-keF" firstAttribute="leading" secondItem="qgV-LI-5lL" secondAttribute="trailing" constant="5" id="7Oc-6i-WAJ"/> | ||
93 | + <constraint firstAttribute="trailing" secondItem="Kdt-I2-GtS" secondAttribute="trailing" constant="20" id="87u-XE-PUf"/> | ||
94 | + <constraint firstItem="URC-i5-9Gw" firstAttribute="leading" secondItem="kWi-pp-keF" secondAttribute="trailing" constant="5" id="CAI-TE-31b"/> | ||
95 | + <constraint firstItem="gWw-Mr-bn2" firstAttribute="leading" secondItem="kWi-pp-keF" secondAttribute="trailing" constant="5" id="DIf-jd-4i9"/> | ||
96 | + <constraint firstItem="2YB-QL-me8" firstAttribute="top" secondItem="JaN-ia-6ul" secondAttribute="top" id="Kg9-3h-9yX"/> | ||
97 | + <constraint firstItem="gWw-Mr-bn2" firstAttribute="top" secondItem="JaN-ia-6ul" secondAttribute="top" constant="15" id="L2J-sA-Qyz"/> | ||
98 | + <constraint firstAttribute="trailing" secondItem="2YB-QL-me8" secondAttribute="trailing" id="LKX-8Q-weK"/> | ||
99 | + <constraint firstItem="kWi-pp-keF" firstAttribute="top" secondItem="JaN-ia-6ul" secondAttribute="top" constant="5" id="Nw1-Du-inS"/> | ||
100 | + <constraint firstAttribute="bottom" secondItem="2YB-QL-me8" secondAttribute="bottom" id="QuD-tm-o3p"/> | ||
101 | + <constraint firstItem="2YB-QL-me8" firstAttribute="leading" secondItem="JaN-ia-6ul" secondAttribute="leading" id="RGp-Mx-kq9"/> | ||
102 | + <constraint firstAttribute="trailing" secondItem="URC-i5-9Gw" secondAttribute="trailing" constant="20" id="X88-Je-614"/> | ||
103 | + <constraint firstAttribute="bottom" secondItem="Kdt-I2-GtS" secondAttribute="bottom" constant="15" id="YOO-8b-oBD"/> | ||
104 | + <constraint firstItem="qgV-LI-5lL" firstAttribute="leading" secondItem="JaN-ia-6ul" secondAttribute="leading" constant="20" id="Zz2-s3-Lli"/> | ||
105 | + <constraint firstItem="URC-i5-9Gw" firstAttribute="top" relation="greaterThanOrEqual" secondItem="gWw-Mr-bn2" secondAttribute="bottom" constant="5" id="gv1-5w-f05"/> | ||
106 | + <constraint firstItem="URC-i5-9Gw" firstAttribute="centerY" secondItem="JaN-ia-6ul" secondAttribute="centerY" id="lCc-I4-VSe"/> | ||
107 | + <constraint firstAttribute="bottom" secondItem="kWi-pp-keF" secondAttribute="bottom" constant="5" id="mqK-8D-WIR"/> | ||
108 | + <constraint firstAttribute="trailing" secondItem="gWw-Mr-bn2" secondAttribute="trailing" constant="20" id="oL8-6u-dOS"/> | ||
109 | + <constraint firstItem="qgV-LI-5lL" firstAttribute="width" secondItem="JaN-ia-6ul" secondAttribute="width" multiplier="0.2" id="pqq-lg-4bn"/> | ||
110 | + <constraint firstItem="Kdt-I2-GtS" firstAttribute="top" relation="greaterThanOrEqual" secondItem="URC-i5-9Gw" secondAttribute="bottom" constant="5" id="rGz-OI-ook"/> | ||
111 | + <constraint firstAttribute="bottom" secondItem="qgV-LI-5lL" secondAttribute="bottom" constant="10" id="ryN-Yr-NRM"/> | ||
112 | + <constraint firstItem="qgV-LI-5lL" firstAttribute="top" secondItem="JaN-ia-6ul" secondAttribute="top" constant="10" id="z0W-2B-JKp"/> | ||
113 | + </constraints> | ||
114 | + </view> | ||
115 | + </subviews> | ||
116 | + <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | ||
117 | + <constraints> | ||
118 | + <constraint firstAttribute="trailing" secondItem="JaN-ia-6ul" secondAttribute="trailing" constant="10" id="1eX-rz-i5G"/> | ||
119 | + <constraint firstItem="JaN-ia-6ul" firstAttribute="leading" secondItem="OpF-ry-8Pc" secondAttribute="leading" constant="10" id="XJA-hx-mRX"/> | ||
120 | + <constraint firstItem="JaN-ia-6ul" firstAttribute="top" secondItem="OpF-ry-8Pc" secondAttribute="top" id="bxl-4U-Dqm"/> | ||
121 | + <constraint firstAttribute="bottom" secondItem="JaN-ia-6ul" secondAttribute="bottom" id="zeG-7a-iyk"/> | ||
122 | + </constraints> | ||
123 | + </tableViewCellContentView> | ||
124 | + <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | ||
125 | + <connections> | ||
126 | + <outlet property="borderView" destination="kWi-pp-keF" id="j4k-29-fIC"/> | ||
127 | + <outlet property="couponBgImage" destination="2YB-QL-me8" id="nCY-Ir-Nkb"/> | ||
128 | + <outlet property="couponImage" destination="qgV-LI-5lL" id="am7-DT-7Ln"/> | ||
129 | + <outlet property="dicountLabel" destination="Ssk-9S-HMD" id="WS3-nG-Sue"/> | ||
130 | + <outlet property="discriptionLabel" destination="hWa-mr-cXD" id="q6c-pM-iXa"/> | ||
131 | + <outlet property="expirationLabel" destination="Kdt-I2-GtS" id="cYp-01-3RL"/> | ||
132 | + <outlet property="nameLabel" destination="gWw-Mr-bn2" id="rT2-kW-Z2F"/> | ||
133 | + </connections> | ||
134 | + </tableViewCell> | ||
135 | + </prototypes> | ||
33 | <connections> | 136 | <connections> |
34 | - <action selector="navigateToCoupon:" destination="zti-Lv-RCc" eventType="touchUpInside" id="G78-ub-QiI"/> | 137 | + <outlet property="dataSource" destination="UpJ-ey-hJ5" id="paH-E4-ldj"/> |
138 | + <outlet property="delegate" destination="UpJ-ey-hJ5" id="lXT-i0-gPS"/> | ||
35 | </connections> | 139 | </connections> |
36 | - </button> | 140 | + </tableView> |
37 | </subviews> | 141 | </subviews> |
38 | - <viewLayoutGuide key="contentLayoutGuide" id="gl4-uV-tMn"/> | 142 | + <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> |
39 | - <viewLayoutGuide key="frameLayoutGuide" id="5Jr-wv-06A"/> | 143 | + <constraints> |
40 | - </scrollView> | 144 | + <constraint firstItem="KhH-tg-FBN" firstAttribute="top" secondItem="FoX-v7-tak" secondAttribute="top" constant="5" id="DSl-zy-v7y"/> |
145 | + <constraint firstAttribute="bottom" secondItem="KhH-tg-FBN" secondAttribute="bottom" id="Dk8-ID-x8T"/> | ||
146 | + <constraint firstItem="5rB-1e-ygb" firstAttribute="top" secondItem="FoX-v7-tak" secondAttribute="top" id="R4t-dF-JMv"/> | ||
147 | + <constraint firstItem="5rB-1e-ygb" firstAttribute="leading" secondItem="FoX-v7-tak" secondAttribute="leading" id="Yyu-T7-XaB"/> | ||
148 | + <constraint firstAttribute="trailing" secondItem="5rB-1e-ygb" secondAttribute="trailing" id="h1f-x6-eGo"/> | ||
149 | + <constraint firstAttribute="bottom" secondItem="5rB-1e-ygb" secondAttribute="bottom" id="mFa-RR-qQj"/> | ||
150 | + <constraint firstItem="KhH-tg-FBN" firstAttribute="leading" secondItem="FoX-v7-tak" secondAttribute="leading" id="oXI-zv-0nB"/> | ||
151 | + <constraint firstAttribute="trailing" secondItem="KhH-tg-FBN" secondAttribute="trailing" id="tAn-PH-mZ8"/> | ||
152 | + </constraints> | ||
153 | + </view> | ||
41 | </subviews> | 154 | </subviews> |
42 | - <viewLayoutGuide key="safeArea" id="x1D-HA-Wfd"/> | 155 | + <viewLayoutGuide key="safeArea" id="KbU-RX-se5"/> |
43 | - <color key="backgroundColor" systemColor="systemBackgroundColor"/> | 156 | + <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> |
157 | + <constraints> | ||
158 | + <constraint firstItem="FoX-v7-tak" firstAttribute="leading" secondItem="XzS-AB-unt" secondAttribute="leading" id="FRE-tf-mAG"/> | ||
159 | + <constraint firstAttribute="bottom" secondItem="FoX-v7-tak" secondAttribute="bottom" id="UlL-zJ-mdc"/> | ||
160 | + <constraint firstItem="FoX-v7-tak" firstAttribute="top" secondItem="KbU-RX-se5" secondAttribute="top" id="hDd-5D-Boi"/> | ||
161 | + <constraint firstAttribute="trailing" secondItem="FoX-v7-tak" secondAttribute="trailing" id="nro-Jt-pxP"/> | ||
162 | + </constraints> | ||
44 | </view> | 163 | </view> |
45 | - <navigationItem key="navigationItem" id="YHq-Mi-XvW"/> | 164 | + <navigationItem key="navigationItem" id="mr8-UG-4rX"/> |
46 | <connections> | 165 | <connections> |
47 | - <outlet property="couponButton" destination="Vy5-PH-dRI" id="wX5-IH-ne8"/> | 166 | + <outlet property="backgroundImage" destination="5rB-1e-ygb" id="Nxt-Pj-vLK"/> |
167 | + <outlet property="tableView" destination="KhH-tg-FBN" id="EJH-sF-YPj"/> | ||
48 | </connections> | 168 | </connections> |
49 | </viewController> | 169 | </viewController> |
50 | <placeholder placeholderIdentifier="IBFirstResponder" id="N1c-BM-LqY" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/> | 170 | <placeholder placeholderIdentifier="IBFirstResponder" id="N1c-BM-LqY" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/> |
... | @@ -306,6 +426,7 @@ | ... | @@ -306,6 +426,7 @@ |
306 | </constraints> | 426 | </constraints> |
307 | </view> | 427 | </view> |
308 | <connections> | 428 | <connections> |
429 | + <outlet property="backgroundImage" destination="Oep-XD-blB" id="YaT-qr-rry"/> | ||
309 | <outlet property="couponImageHeight" destination="zUx-Yd-in7" id="7vo-8L-d8o"/> | 430 | <outlet property="couponImageHeight" destination="zUx-Yd-in7" id="7vo-8L-d8o"/> |
310 | <outlet property="mainView" destination="Jqu-cp-CWU" id="Q0Z-dO-MXL"/> | 431 | <outlet property="mainView" destination="Jqu-cp-CWU" id="Q0Z-dO-MXL"/> |
311 | <outlet property="redeemButton" destination="FCd-hv-dHg" id="3Jw-Yn-uNr"/> | 432 | <outlet property="redeemButton" destination="FCd-hv-dHg" id="3Jw-Yn-uNr"/> |
... | @@ -366,7 +487,8 @@ | ... | @@ -366,7 +487,8 @@ |
366 | </scene> | 487 | </scene> |
367 | </scenes> | 488 | </scenes> |
368 | <resources> | 489 | <resources> |
369 | - <image name="coupons_scrollview" width="214" height="463.5"/> | 490 | + <image name="coupon_bg" width="196" height="64.5"/> |
491 | + <image name="coupons_scrollview_dark" width="214" height="462"/> | ||
370 | <image name="coupons_scrollview_white" width="214" height="462"/> | 492 | <image name="coupons_scrollview_white" width="214" height="462"/> |
371 | <image name="ic_down_dark" width="22" height="11.5"/> | 493 | <image name="ic_down_dark" width="22" height="11.5"/> |
372 | <systemColor name="systemBackgroundColor"> | 494 | <systemColor name="systemBackgroundColor"> | ... | ... |
SwiftWarplyFramework/SwiftWarplyFramework/Media.xcassets/coupon_bg.imageset/Contents.json
0 → 100644
1 | +{ | ||
2 | + "images" : [ | ||
3 | + { | ||
4 | + "filename" : "coupon_bg.png", | ||
5 | + "idiom" : "universal", | ||
6 | + "scale" : "1x" | ||
7 | + }, | ||
8 | + { | ||
9 | + "filename" : "coupon_bg-1.png", | ||
10 | + "idiom" : "universal", | ||
11 | + "scale" : "2x" | ||
12 | + }, | ||
13 | + { | ||
14 | + "filename" : "coupon_bg-2.png", | ||
15 | + "idiom" : "universal", | ||
16 | + "scale" : "3x" | ||
17 | + } | ||
18 | + ], | ||
19 | + "info" : { | ||
20 | + "author" : "xcode", | ||
21 | + "version" : 1 | ||
22 | + } | ||
23 | +} |
SwiftWarplyFramework/SwiftWarplyFramework/Media.xcassets/coupon_bg.imageset/coupon_bg-1.png
0 → 100644
2.28 KB
SwiftWarplyFramework/SwiftWarplyFramework/Media.xcassets/coupon_bg.imageset/coupon_bg-2.png
0 → 100644
2.28 KB
SwiftWarplyFramework/SwiftWarplyFramework/Media.xcassets/coupon_bg.imageset/coupon_bg.png
0 → 100644
2.28 KB
1 | +{ | ||
2 | + "images" : [ | ||
3 | + { | ||
4 | + "filename" : "coupons_scrollview_dark.png", | ||
5 | + "idiom" : "universal", | ||
6 | + "scale" : "1x" | ||
7 | + }, | ||
8 | + { | ||
9 | + "filename" : "coupons_scrollview_dark-1.png", | ||
10 | + "idiom" : "universal", | ||
11 | + "scale" : "2x" | ||
12 | + }, | ||
13 | + { | ||
14 | + "filename" : "coupons_scrollview_dark-2.png", | ||
15 | + "idiom" : "universal", | ||
16 | + "scale" : "3x" | ||
17 | + } | ||
18 | + ], | ||
19 | + "info" : { | ||
20 | + "author" : "xcode", | ||
21 | + "version" : 1 | ||
22 | + } | ||
23 | +} |
9.93 KB
9.93 KB
9.93 KB
... | @@ -63,3 +63,49 @@ extension String { | ... | @@ -63,3 +63,49 @@ extension String { |
63 | return htmlToAttributedString?.string ?? "" | 63 | return htmlToAttributedString?.string ?? "" |
64 | } | 64 | } |
65 | } | 65 | } |
66 | + | ||
67 | +extension UIView { | ||
68 | + | ||
69 | + func addDashedBorderVertical(color: UIColor, width: CGFloat, height: CGFloat) { | ||
70 | + | ||
71 | + let color = color.cgColor | ||
72 | + let frameSize = self.frame.size | ||
73 | + | ||
74 | + let lineLayer = CAShapeLayer() | ||
75 | + lineLayer.strokeColor = color | ||
76 | + lineLayer.lineWidth = width | ||
77 | + lineLayer.lineDashPattern = [5,5] | ||
78 | + | ||
79 | + let path = CGMutablePath() | ||
80 | + path.addLines(between: [CGPoint(x: frameSize.width/2, y: 0), CGPoint(x: frameSize.width/2, y: height)]) | ||
81 | + lineLayer.path = path | ||
82 | + self.layer.addSublayer(lineLayer) | ||
83 | + } | ||
84 | +} | ||
85 | + | ||
86 | +extension UIImageView { | ||
87 | + | ||
88 | + func load(link: String, placeholder: UIImage?, cache: URLCache? = nil) { | ||
89 | + guard let url = URL(string: link) else { return } | ||
90 | + | ||
91 | + let cache = cache ?? URLCache.shared | ||
92 | + let request = URLRequest(url: url) | ||
93 | + if let data = cache.cachedResponse(for: request)?.data, let image = UIImage(data: data) { | ||
94 | + DispatchQueue.main.async { | ||
95 | + self.image = image | ||
96 | + } | ||
97 | + } else { | ||
98 | + self.image = placeholder | ||
99 | + URLSession.shared.dataTask(with: request, completionHandler: { (data, response, error) in | ||
100 | + if let data = data, let response = response, ((response as? HTTPURLResponse)?.statusCode ?? 500) < 300, let image = UIImage(data: data) { | ||
101 | + let cachedData = CachedURLResponse(response: response, data: data) | ||
102 | + cache.storeCachedResponse(cachedData, for: request) | ||
103 | + DispatchQueue.main.async { | ||
104 | + self.image = image | ||
105 | + } | ||
106 | + | ||
107 | + } | ||
108 | + }).resume() | ||
109 | + } | ||
110 | + } | ||
111 | +} | ... | ... |
-
Please register or login to post a comment