Manos Chorianopoulos

MyRewardsOffersScrollTableViewCell implementation

Showing 87 changed files with 697 additions and 43 deletions
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
7 objects = { 7 objects = {
8 8
9 /* Begin PBXBuildFile section */ 9 /* Begin PBXBuildFile section */
10 + 1E64E1832DE48E0600543217 /* MyRewardsOfferCollectionViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1E64E1822DE48E0600543217 /* MyRewardsOfferCollectionViewCell.xib */; };
11 + 1E64E1842DE48E0600543217 /* MyRewardsOfferCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E64E1812DE48E0600543217 /* MyRewardsOfferCollectionViewCell.swift */; };
10 1E917CD62DDF64B2002221D8 /* MyRewardsViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1E917CD52DDF64B2002221D8 /* MyRewardsViewController.xib */; }; 12 1E917CD62DDF64B2002221D8 /* MyRewardsViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1E917CD52DDF64B2002221D8 /* MyRewardsViewController.xib */; };
11 1E917CD72DDF64B2002221D8 /* MyRewardsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E917CD42DDF64B2002221D8 /* MyRewardsViewController.swift */; }; 13 1E917CD72DDF64B2002221D8 /* MyRewardsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E917CD42DDF64B2002221D8 /* MyRewardsViewController.swift */; };
12 1E917CDB2DDF68C7002221D8 /* CouponViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1E917CDA2DDF68C7002221D8 /* CouponViewController.xib */; }; 14 1E917CDB2DDF68C7002221D8 /* CouponViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1E917CDA2DDF68C7002221D8 /* CouponViewController.xib */; };
...@@ -148,6 +150,8 @@ ...@@ -148,6 +150,8 @@
148 150
149 /* Begin PBXFileReference section */ 151 /* Begin PBXFileReference section */
150 1E108A9728A3FA9B0008B8E7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 152 1E108A9728A3FA9B0008B8E7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
153 + 1E64E1812DE48E0600543217 /* MyRewardsOfferCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyRewardsOfferCollectionViewCell.swift; sourceTree = "<group>"; };
154 + 1E64E1822DE48E0600543217 /* MyRewardsOfferCollectionViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MyRewardsOfferCollectionViewCell.xib; sourceTree = "<group>"; };
151 1E917CD42DDF64B2002221D8 /* MyRewardsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyRewardsViewController.swift; sourceTree = "<group>"; }; 155 1E917CD42DDF64B2002221D8 /* MyRewardsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyRewardsViewController.swift; sourceTree = "<group>"; };
152 1E917CD52DDF64B2002221D8 /* MyRewardsViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MyRewardsViewController.xib; sourceTree = "<group>"; }; 156 1E917CD52DDF64B2002221D8 /* MyRewardsViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MyRewardsViewController.xib; sourceTree = "<group>"; };
153 1E917CD92DDF68C7002221D8 /* CouponViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CouponViewController.swift; sourceTree = "<group>"; }; 157 1E917CD92DDF68C7002221D8 /* CouponViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CouponViewController.swift; sourceTree = "<group>"; };
...@@ -327,6 +331,15 @@ ...@@ -327,6 +331,15 @@
327 name = Fonts; 331 name = Fonts;
328 sourceTree = "<group>"; 332 sourceTree = "<group>";
329 }; 333 };
334 + 1E64E1802DE48DD600543217 /* MyRewardsOfferCollectionViewCell */ = {
335 + isa = PBXGroup;
336 + children = (
337 + 1E64E1812DE48E0600543217 /* MyRewardsOfferCollectionViewCell.swift */,
338 + 1E64E1822DE48E0600543217 /* MyRewardsOfferCollectionViewCell.xib */,
339 + );
340 + path = MyRewardsOfferCollectionViewCell;
341 + sourceTree = "<group>";
342 + };
330 1E917CD32DDF6472002221D8 /* MyRewardsViewController */ = { 343 1E917CD32DDF6472002221D8 /* MyRewardsViewController */ = {
331 isa = PBXGroup; 344 isa = PBXGroup;
332 children = ( 345 children = (
...@@ -368,6 +381,7 @@ ...@@ -368,6 +381,7 @@
368 1EA8E5BC2DDF34FB00CD3418 /* cells */ = { 381 1EA8E5BC2DDF34FB00CD3418 /* cells */ = {
369 isa = PBXGroup; 382 isa = PBXGroup;
370 children = ( 383 children = (
384 + 1E64E1802DE48DD600543217 /* MyRewardsOfferCollectionViewCell */,
371 1ED41E492DE0C21800836ABA /* MyRewardsBannerOfferCollectionViewCell */, 385 1ED41E492DE0C21800836ABA /* MyRewardsBannerOfferCollectionViewCell */,
372 1EB4F4282DE0A09500D934C0 /* MyRewardsOffersScrollTableViewCell */, 386 1EB4F4282DE0A09500D934C0 /* MyRewardsOffersScrollTableViewCell */,
373 1EB4F4222DE09A4300D934C0 /* MyRewardsBannerOffersScrollTableViewCell */, 387 1EB4F4222DE09A4300D934C0 /* MyRewardsBannerOffersScrollTableViewCell */,
...@@ -822,6 +836,7 @@ ...@@ -822,6 +836,7 @@
822 E6A77905282933E60045BBA8 /* warp_white_back_button@2x.png in Resources */, 836 E6A77905282933E60045BBA8 /* warp_white_back_button@2x.png in Resources */,
823 1EB4F4252DE09AAC00D934C0 /* MyRewardsBannerOffersScrollTableViewCell.xib in Resources */, 837 1EB4F4252DE09AAC00D934C0 /* MyRewardsBannerOffersScrollTableViewCell.xib in Resources */,
824 1EA8E5C02DDF427A00CD3418 /* PingLCG-Bold.otf in Resources */, 838 1EA8E5C02DDF427A00CD3418 /* PingLCG-Bold.otf in Resources */,
839 + 1E64E1832DE48E0600543217 /* MyRewardsOfferCollectionViewCell.xib in Resources */,
825 1EA8E5C12DDF427A00CD3418 /* PingLCG-Light.otf in Resources */, 840 1EA8E5C12DDF427A00CD3418 /* PingLCG-Light.otf in Resources */,
826 1EA8E5C22DDF427A00CD3418 /* PingLCG-Regular.otf in Resources */, 841 1EA8E5C22DDF427A00CD3418 /* PingLCG-Regular.otf in Resources */,
827 E6A77908282933E60045BBA8 /* warp_white_close_button@2x.png in Resources */, 842 E6A77908282933E60045BBA8 /* warp_white_close_button@2x.png in Resources */,
...@@ -886,6 +901,7 @@ ...@@ -886,6 +901,7 @@
886 E6A77954282933E70045BBA8 /* MyApi.m in Sources */, 901 E6A77954282933E70045BBA8 /* MyApi.m in Sources */,
887 E6A778F2282933E60045BBA8 /* WLNativeAdCollectionViewCell.m in Sources */, 902 E6A778F2282933E60045BBA8 /* WLNativeAdCollectionViewCell.m in Sources */,
888 E6A77904282933E60045BBA8 /* WLEvent.m in Sources */, 903 E6A77904282933E60045BBA8 /* WLEvent.m in Sources */,
904 + 1E64E1842DE48E0600543217 /* MyRewardsOfferCollectionViewCell.swift in Sources */,
889 E6A77927282933E70045BBA8 /* UIRefreshControl+AFNetworking.m in Sources */, 905 E6A77927282933E70045BBA8 /* UIRefreshControl+AFNetworking.m in Sources */,
890 E6A77955282933E70045BBA8 /* ViewControllerExtensions.swift in Sources */, 906 E6A77955282933E70045BBA8 /* ViewControllerExtensions.swift in Sources */,
891 A07936762885E9CC00064122 /* UIColorExtensions.swift in Sources */, 907 A07936762885E9CC00064122 /* UIColorExtensions.swift in Sources */,
......
1 +{
2 + "images" : [
3 + {
4 + "filename" : "avis_banner.png",
5 + "idiom" : "universal",
6 + "scale" : "1x"
7 + },
8 + {
9 + "filename" : "avis_banner 1.png",
10 + "idiom" : "universal",
11 + "scale" : "2x"
12 + },
13 + {
14 + "filename" : "avis_banner 2.png",
15 + "idiom" : "universal",
16 + "scale" : "3x"
17 + }
18 + ],
19 + "info" : {
20 + "author" : "xcode",
21 + "version" : 1
22 + }
23 +}
1 +{
2 + "images" : [
3 + {
4 + "filename" : "avis_logo.png",
5 + "idiom" : "universal",
6 + "scale" : "1x"
7 + },
8 + {
9 + "filename" : "avis_logo 1.png",
10 + "idiom" : "universal",
11 + "scale" : "2x"
12 + },
13 + {
14 + "filename" : "avis_logo 2.png",
15 + "idiom" : "universal",
16 + "scale" : "3x"
17 + }
18 + ],
19 + "info" : {
20 + "author" : "xcode",
21 + "version" : 1
22 + }
23 +}
1 +{
2 + "images" : [
3 + {
4 + "filename" : "coffeeisland_banner.png",
5 + "idiom" : "universal",
6 + "scale" : "1x"
7 + },
8 + {
9 + "filename" : "coffeeisland_banner 1.png",
10 + "idiom" : "universal",
11 + "scale" : "2x"
12 + },
13 + {
14 + "filename" : "coffeeisland_banner 2.png",
15 + "idiom" : "universal",
16 + "scale" : "3x"
17 + }
18 + ],
19 + "info" : {
20 + "author" : "xcode",
21 + "version" : 1
22 + }
23 +}
1 +{
2 + "images" : [
3 + {
4 + "filename" : "coffeeisland_logo.png",
5 + "idiom" : "universal",
6 + "scale" : "1x"
7 + },
8 + {
9 + "filename" : "coffeeisland_logo 1.png",
10 + "idiom" : "universal",
11 + "scale" : "2x"
12 + },
13 + {
14 + "filename" : "coffeeisland_logo 2.png",
15 + "idiom" : "universal",
16 + "scale" : "3x"
17 + }
18 + ],
19 + "info" : {
20 + "author" : "xcode",
21 + "version" : 1
22 + }
23 +}
1 +{
2 + "images" : [
3 + {
4 + "filename" : "dominos_banner.png",
5 + "idiom" : "universal",
6 + "scale" : "1x"
7 + },
8 + {
9 + "filename" : "dominos_banner 1.png",
10 + "idiom" : "universal",
11 + "scale" : "2x"
12 + },
13 + {
14 + "filename" : "dominos_banner 2.png",
15 + "idiom" : "universal",
16 + "scale" : "3x"
17 + }
18 + ],
19 + "info" : {
20 + "author" : "xcode",
21 + "version" : 1
22 + }
23 +}
1 +{
2 + "images" : [
3 + {
4 + "filename" : "dominos_logo.png",
5 + "idiom" : "universal",
6 + "scale" : "1x"
7 + },
8 + {
9 + "filename" : "dominos_logo 1.png",
10 + "idiom" : "universal",
11 + "scale" : "2x"
12 + },
13 + {
14 + "filename" : "dominos_logo 2.png",
15 + "idiom" : "universal",
16 + "scale" : "3x"
17 + }
18 + ],
19 + "info" : {
20 + "author" : "xcode",
21 + "version" : 1
22 + }
23 +}
1 +{
2 + "images" : [
3 + {
4 + "filename" : "favorite_empty.png",
5 + "idiom" : "universal",
6 + "scale" : "1x"
7 + },
8 + {
9 + "filename" : "favorite_empty 1.png",
10 + "idiom" : "universal",
11 + "scale" : "2x"
12 + },
13 + {
14 + "filename" : "favorite_empty 2.png",
15 + "idiom" : "universal",
16 + "scale" : "3x"
17 + }
18 + ],
19 + "info" : {
20 + "author" : "xcode",
21 + "version" : 1
22 + }
23 +}
1 +{
2 + "images" : [
3 + {
4 + "filename" : "favorite_filled.png",
5 + "idiom" : "universal",
6 + "scale" : "1x"
7 + },
8 + {
9 + "filename" : "favorite_filled 1.png",
10 + "idiom" : "universal",
11 + "scale" : "2x"
12 + },
13 + {
14 + "filename" : "favorite_filled 2.png",
15 + "idiom" : "universal",
16 + "scale" : "3x"
17 + }
18 + ],
19 + "info" : {
20 + "author" : "xcode",
21 + "version" : 1
22 + }
23 +}
1 +{
2 + "images" : [
3 + {
4 + "filename" : "migato_banner.png",
5 + "idiom" : "universal",
6 + "scale" : "1x"
7 + },
8 + {
9 + "filename" : "migato_banner 1.png",
10 + "idiom" : "universal",
11 + "scale" : "2x"
12 + },
13 + {
14 + "filename" : "migato_banner 2.png",
15 + "idiom" : "universal",
16 + "scale" : "3x"
17 + }
18 + ],
19 + "info" : {
20 + "author" : "xcode",
21 + "version" : 1
22 + }
23 +}
1 +{
2 + "images" : [
3 + {
4 + "filename" : "migato_logo.png",
5 + "idiom" : "universal",
6 + "scale" : "1x"
7 + },
8 + {
9 + "filename" : "migato_logo 1.png",
10 + "idiom" : "universal",
11 + "scale" : "2x"
12 + },
13 + {
14 + "filename" : "migato_logo 2.png",
15 + "idiom" : "universal",
16 + "scale" : "3x"
17 + }
18 + ],
19 + "info" : {
20 + "author" : "xcode",
21 + "version" : 1
22 + }
23 +}
1 +{
2 + "images" : [
3 + {
4 + "filename" : "moustakas_banner.png",
5 + "idiom" : "universal",
6 + "scale" : "1x"
7 + },
8 + {
9 + "filename" : "moustakas_banner 1.png",
10 + "idiom" : "universal",
11 + "scale" : "2x"
12 + },
13 + {
14 + "filename" : "moustakas_banner 2.png",
15 + "idiom" : "universal",
16 + "scale" : "3x"
17 + }
18 + ],
19 + "info" : {
20 + "author" : "xcode",
21 + "version" : 1
22 + }
23 +}
1 +{
2 + "images" : [
3 + {
4 + "filename" : "moustakas_logo.png",
5 + "idiom" : "universal",
6 + "scale" : "1x"
7 + },
8 + {
9 + "filename" : "moustakas_logo 1.png",
10 + "idiom" : "universal",
11 + "scale" : "2x"
12 + },
13 + {
14 + "filename" : "moustakas_logo 2.png",
15 + "idiom" : "universal",
16 + "scale" : "3x"
17 + }
18 + ],
19 + "info" : {
20 + "author" : "xcode",
21 + "version" : 1
22 + }
23 +}
1 +{
2 + "images" : [
3 + {
4 + "filename" : "musa_banner.png",
5 + "idiom" : "universal",
6 + "scale" : "1x"
7 + },
8 + {
9 + "filename" : "musa_banner 1.png",
10 + "idiom" : "universal",
11 + "scale" : "2x"
12 + },
13 + {
14 + "filename" : "musa_banner 2.png",
15 + "idiom" : "universal",
16 + "scale" : "3x"
17 + }
18 + ],
19 + "info" : {
20 + "author" : "xcode",
21 + "version" : 1
22 + }
23 +}
1 +{
2 + "images" : [
3 + {
4 + "filename" : "musa_logo.png",
5 + "idiom" : "universal",
6 + "scale" : "1x"
7 + },
8 + {
9 + "filename" : "musa_logo 1.png",
10 + "idiom" : "universal",
11 + "scale" : "2x"
12 + },
13 + {
14 + "filename" : "musa_logo 2.png",
15 + "idiom" : "universal",
16 + "scale" : "3x"
17 + }
18 + ],
19 + "info" : {
20 + "author" : "xcode",
21 + "version" : 1
22 + }
23 +}
1 +{
2 + "images" : [
3 + {
4 + "filename" : "ninemia_banner.png",
5 + "idiom" : "universal",
6 + "scale" : "1x"
7 + },
8 + {
9 + "filename" : "ninemia_banner 1.png",
10 + "idiom" : "universal",
11 + "scale" : "2x"
12 + },
13 + {
14 + "filename" : "ninemia_banner 2.png",
15 + "idiom" : "universal",
16 + "scale" : "3x"
17 + }
18 + ],
19 + "info" : {
20 + "author" : "xcode",
21 + "version" : 1
22 + }
23 +}
1 +{
2 + "images" : [
3 + {
4 + "filename" : "ninemia_logo.png",
5 + "idiom" : "universal",
6 + "scale" : "1x"
7 + },
8 + {
9 + "filename" : "ninemia_logo 1.png",
10 + "idiom" : "universal",
11 + "scale" : "2x"
12 + },
13 + {
14 + "filename" : "ninemia_logo 2.png",
15 + "idiom" : "universal",
16 + "scale" : "3x"
17 + }
18 + ],
19 + "info" : {
20 + "author" : "xcode",
21 + "version" : 1
22 + }
23 +}
1 +{
2 + "images" : [
3 + {
4 + "filename" : "ranch_banner.png",
5 + "idiom" : "universal",
6 + "scale" : "1x"
7 + },
8 + {
9 + "filename" : "ranch_banner 1.png",
10 + "idiom" : "universal",
11 + "scale" : "2x"
12 + },
13 + {
14 + "filename" : "ranch_banner 2.png",
15 + "idiom" : "universal",
16 + "scale" : "3x"
17 + }
18 + ],
19 + "info" : {
20 + "author" : "xcode",
21 + "version" : 1
22 + }
23 +}
1 +{
2 + "images" : [
3 + {
4 + "filename" : "ranch_logo.png",
5 + "idiom" : "universal",
6 + "scale" : "1x"
7 + },
8 + {
9 + "filename" : "ranch_logo 1.png",
10 + "idiom" : "universal",
11 + "scale" : "2x"
12 + },
13 + {
14 + "filename" : "ranch_logo 2.png",
15 + "idiom" : "universal",
16 + "scale" : "3x"
17 + }
18 + ],
19 + "info" : {
20 + "author" : "xcode",
21 + "version" : 1
22 + }
23 +}
1 +{
2 + "images" : [
3 + {
4 + "filename" : "zuccherino_banner.png",
5 + "idiom" : "universal",
6 + "scale" : "1x"
7 + },
8 + {
9 + "filename" : "zuccherino_banner 1.png",
10 + "idiom" : "universal",
11 + "scale" : "2x"
12 + },
13 + {
14 + "filename" : "zuccherino_banner 2.png",
15 + "idiom" : "universal",
16 + "scale" : "3x"
17 + }
18 + ],
19 + "info" : {
20 + "author" : "xcode",
21 + "version" : 1
22 + }
23 +}
1 +{
2 + "images" : [
3 + {
4 + "filename" : "zuccherino_logo.png",
5 + "idiom" : "universal",
6 + "scale" : "1x"
7 + },
8 + {
9 + "filename" : "zuccherino_logo 1.png",
10 + "idiom" : "universal",
11 + "scale" : "2x"
12 + },
13 + {
14 + "filename" : "zuccherino_logo 2.png",
15 + "idiom" : "universal",
16 + "scale" : "3x"
17 + }
18 + ],
19 + "info" : {
20 + "author" : "xcode",
21 + "version" : 1
22 + }
23 +}
1 +//
2 +// MyRewardsOfferCollectionViewCell.swift
3 +// SwiftWarplyFramework
4 +//
5 +// Created by Manos Chorianopoulos on 26/5/25.
6 +//
7 +
8 +import UIKit
9 +
10 +@objc public class MyRewardsOfferCollectionViewCell: UICollectionViewCell {
11 + @IBOutlet weak var parentView: UIView!
12 + @IBOutlet weak var bannerImage: UIImageView!
13 + @IBOutlet weak var favoriteImage: UIImageView!
14 + @IBOutlet weak var discountView: UIView!
15 + @IBOutlet weak var discountLabel: UILabel!
16 + @IBOutlet weak var titleLabel: UILabel!
17 + @IBOutlet weak var subtitleLabel: UILabel!
18 + @IBOutlet weak var expirationLabel: UILabel!
19 + @IBOutlet weak var logoImage: UIImageView!
20 +
21 + public override func awakeFromNib() {
22 + super.awakeFromNib()
23 + // Initialization code
24 +
25 + parentView.layer.borderWidth = 1.0
26 + parentView.layer.borderColor = UIColor(rgb: 0xCCCCCC).cgColor
27 + parentView.layer.cornerRadius = 8.0
28 +
29 + discountView.layer.cornerRadius = 34.0
30 +
31 + }
32 +
33 + func configureCell(data: OfferModel) {
34 + bannerImage.image = UIImage(named: data.bannerImage, in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
35 + favoriteImage.image = UIImage(named: data.isFavorite ? "favorite_filled" : "favorite_empty", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
36 +
37 + let discountSymbol =
38 + data.discountType == "percentage" ? "%"
39 + : data.discountType == "price" ? "€"
40 + : data.discountType == "buyOneGetOne" ? "1+1"
41 + : data.discountType == "free" ? "Δωρεάν"
42 + : ""
43 +
44 + discountLabel.text = "\(data.discount)\(discountSymbol)"
45 + discountLabel.font = UIFont(name: "PingLCG-Bold", size: 18)
46 + discountLabel.textColor = UIColor(rgb: 0xF2F2F2)
47 +
48 + discountView.backgroundColor = UIColor(rgb: data.color)
49 +
50 + titleLabel.text = data.title
51 + titleLabel.font = UIFont(name: "PingLCG-Bold", size: 17)
52 + titleLabel.textColor = UIColor(rgb: 0x000F1E)
53 +
54 + subtitleLabel.text = data.description
55 + subtitleLabel.font = UIFont(name: "PingLCG-Regular", size: 14)
56 + subtitleLabel.textColor = UIColor(rgb: 0x00111B)
57 +
58 + expirationLabel.text = data.expirationDate
59 + expirationLabel.font = UIFont(name: "PingLCG-Regular", size: 13)
60 + expirationLabel.textColor = UIColor(rgb: 0x00111B)
61 +
62 + logoImage.image = UIImage(named: data.merchantLogo, in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
63 + }
64 +}
...@@ -8,11 +8,57 @@ ...@@ -8,11 +8,57 @@
8 import UIKit 8 import UIKit
9 9
10 @objc public class MyRewardsOffersScrollTableViewCell: UITableViewCell { 10 @objc public class MyRewardsOffersScrollTableViewCell: UITableViewCell {
11 - var section: SectionModel? 11 + @IBOutlet weak var categoryLabel: UILabel!
12 + @IBOutlet weak var allButtonView: UIView!
13 + @IBOutlet weak var allButtonLabel: UILabel!
14 + @IBOutlet weak var collectionView: UICollectionView!
15 +
16 + var data: SectionModel?
12 17
13 public override func awakeFromNib() { 18 public override func awakeFromNib() {
14 super.awakeFromNib() 19 super.awakeFromNib()
15 // Initialization code 20 // Initialization code
21 +
22 + allButtonView.layer.borderWidth = 1.0
23 + allButtonView.layer.borderColor = UIColor(rgb: 0x000F1E).cgColor
24 + allButtonView.layer.cornerRadius = 4.0
25 +
26 + allButtonLabel.text = "Όλα"
27 + allButtonLabel.font = UIFont(name: "PingLCG-Regular", size: 16)
28 + allButtonLabel.textColor = UIColor(rgb: 0x00111B)
29 +
30 + // Register XIBs for collection view cells
31 + collectionView.register(UINib(nibName: "MyRewardsBannerOfferCollectionViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellWithReuseIdentifier: "MyRewardsBannerOfferCollectionViewCell")
32 +
33 + // Fix background colors
34 + collectionView.backgroundColor = UIColor.clear
35 + self.backgroundColor = UIColor.clear
36 + self.contentView.backgroundColor = UIColor.clear
37 +
38 + // Remove content insets and gaps
39 + collectionView.contentInset = UIEdgeInsets.zero
40 + collectionView.scrollIndicatorInsets = UIEdgeInsets.zero
41 +
42 + if #available(iOS 11.0, *) {
43 + collectionView.contentInsetAdjustmentBehavior = .never
44 + }
45 +
46 + // Configure collection view layout
47 + if let layout = collectionView.collectionViewLayout as? UICollectionViewFlowLayout {
48 + layout.scrollDirection = .horizontal
49 + layout.minimumLineSpacing = 0
50 + layout.minimumInteritemSpacing = 0
51 + layout.sectionInset = UIEdgeInsets.zero
52 + }
53 +
54 + // Enable paging for smooth banner scrolling
55 + collectionView.isPagingEnabled = true
56 + collectionView.showsHorizontalScrollIndicator = false
57 +
58 + // Set delegates
59 + collectionView.delegate = self
60 + collectionView.dataSource = self
61 +
16 } 62 }
17 63
18 public override func setSelected(_ selected: Bool, animated: Bool) { 64 public override func setSelected(_ selected: Bool, animated: Bool) {
...@@ -23,5 +69,73 @@ import UIKit ...@@ -23,5 +69,73 @@ import UIKit
23 69
24 func configureCell(data: SectionModel?) { 70 func configureCell(data: SectionModel?) {
25 71
72 +// struct SectionModel {
73 +// let title: String
74 +// let count: Int
75 +// let offers: [OfferModel]
76 +// }
77 +
78 + self.data = data
79 +
80 + let catBoldText = (data?.title ?? "") + " "
81 + let catRegText = String(data?.count ?? 0)
82 +
83 + let attrBold = [NSAttributedString.Key.font : UIFont(name: "PingLCG-Bold", size: 18) ?? UIFont.boldSystemFont(ofSize: 17), NSAttributedString.Key.foregroundColor: UIColor(rgb: 0x000F1E)]
84 + let attrRegular = [NSAttributedString.Key.font : UIFont(name: "PingLCG-Regular", size: 18) ?? UIFont.systemFont(ofSize: 17), NSAttributedString.Key.foregroundColor: UIColor(rgb: 0x000F1E)]
85 +
86 + let catAttributedString = NSMutableAttributedString(string:catBoldText, attributes:attrBold)
87 + let catRegString = NSMutableAttributedString(string: catRegText, attributes:attrRegular)
88 +
89 + catAttributedString.append(catRegString)
90 + categoryLabel.attributedText = catAttributedString
91 +
92 + self.collectionView.reloadData();
93 +
94 + }
95 +}
96 +
97 +extension MyRewardsOffersScrollTableViewCell: UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout {
98 +
99 +
100 + public func numberOfSections(in collectionView: UICollectionView) -> Int {
101 + return 1
102 + }
103 +
104 + public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
105 + return self.data?.offers.count ?? 0
106 + }
107 +
108 + public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
109 + let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "MyRewardsBannerOfferCollectionViewCell", for: indexPath) as! MyRewardsBannerOfferCollectionViewCell
110 +// cell.configureCell(offer: self.data?.offers[indexPath.row])
111 + if let offer = self.data?.offers[indexPath.row] {
112 + cell.configureCell(data: offer)
113 + }
114 + return cell;
115 + }
116 +
117 + public func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
118 +// TODO: open offer
119 + }
120 +
121 + // MARK: - UICollectionViewDelegateFlowLayout
122 + public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
123 +// let screenWidth = UIScreen.main.bounds.width
124 + return CGSize(width: 257, height: 232)
125 + }
126 +
127 + // Distance Between Item Cells
128 + public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
129 + return 7
130 + }
131 +
132 + public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat {
133 + return 0
134 + }
135 +
136 + // Cell Margin
137 + public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets {
138 + return UIEdgeInsets.zero
139 +// UIEdgeInsets(top: 0, left: 7, bottom: 0, right: 0)
26 } 140 }
27 } 141 }
......
...@@ -22,7 +22,7 @@ struct OfferModel { ...@@ -22,7 +22,7 @@ struct OfferModel {
22 let bannerImage: String 22 let bannerImage: String
23 let merchantLogo: String 23 let merchantLogo: String
24 let expirationDate: String 24 let expirationDate: String
25 - let color: String 25 + let color: UInt
26 var isFavorite: Bool 26 var isFavorite: Bool
27 } 27 }
28 28
...@@ -41,7 +41,7 @@ struct OfferModel { ...@@ -41,7 +41,7 @@ struct OfferModel {
41 bannerImage: "contest_banner", 41 bannerImage: "contest_banner",
42 merchantLogo: "contest_logo", 42 merchantLogo: "contest_logo",
43 expirationDate: "30/06/2025", 43 expirationDate: "30/06/2025",
44 - color: "#8A2BE2", // Purple 44 + color: 0x8A2BE2,
45 isFavorite: false 45 isFavorite: false
46 ), 46 ),
47 OfferModel( 47 OfferModel(
...@@ -53,7 +53,7 @@ struct OfferModel { ...@@ -53,7 +53,7 @@ struct OfferModel {
53 bannerImage: "contest_banner", 53 bannerImage: "contest_banner",
54 merchantLogo: "contest_logo", 54 merchantLogo: "contest_logo",
55 expirationDate: "30/06/2025", 55 expirationDate: "30/06/2025",
56 - color: "#8A2BE2", // Purple 56 + color: 0x8A2BE2,
57 isFavorite: false 57 isFavorite: false
58 ), 58 ),
59 OfferModel( 59 OfferModel(
...@@ -65,7 +65,7 @@ struct OfferModel { ...@@ -65,7 +65,7 @@ struct OfferModel {
65 bannerImage: "contest_banner", 65 bannerImage: "contest_banner",
66 merchantLogo: "contest_logo", 66 merchantLogo: "contest_logo",
67 expirationDate: "30/06/2025", 67 expirationDate: "30/06/2025",
68 - color: "#8A2BE2", // Purple 68 + color: 0x8A2BE2,
69 isFavorite: false 69 isFavorite: false
70 ), 70 ),
71 // Top offers 71 // Top offers
...@@ -78,7 +78,7 @@ struct OfferModel { ...@@ -78,7 +78,7 @@ struct OfferModel {
78 bannerImage: "pizza_banner", 78 bannerImage: "pizza_banner",
79 merchantLogo: "dominos_logo", 79 merchantLogo: "dominos_logo",
80 expirationDate: "έως 30/09", 80 expirationDate: "έως 30/09",
81 - color: "#E91E63", // Pink 81 + color: 0xEE417D,
82 isFavorite: true 82 isFavorite: true
83 ), 83 ),
84 OfferModel( 84 OfferModel(
...@@ -90,7 +90,7 @@ struct OfferModel { ...@@ -90,7 +90,7 @@ struct OfferModel {
90 bannerImage: "furniture_banner", 90 bannerImage: "furniture_banner",
91 merchantLogo: "ikea_logo", 91 merchantLogo: "ikea_logo",
92 expirationDate: "έως 30/09", 92 expirationDate: "έως 30/09",
93 - color: "#E91E63", // Pink 93 + color: 0xEE417D,
94 isFavorite: false 94 isFavorite: false
95 ), 95 ),
96 // OfferModel( 96 // OfferModel(
...@@ -102,7 +102,7 @@ struct OfferModel { ...@@ -102,7 +102,7 @@ struct OfferModel {
102 // bannerImage: "delivery_banner", 102 // bannerImage: "delivery_banner",
103 // merchantLogo: "skroutz_logo", 103 // merchantLogo: "skroutz_logo",
104 // expirationDate: "έως 30/09", 104 // expirationDate: "έως 30/09",
105 - // color: "#E91E63", // Pink 105 + // color: 0xEE417D,
106 // isFavorite: false 106 // isFavorite: false
107 // ), 107 // ),
108 108
...@@ -116,7 +116,7 @@ struct OfferModel { ...@@ -116,7 +116,7 @@ struct OfferModel {
116 // bannerImage: "car_rental_banner", 116 // bannerImage: "car_rental_banner",
117 // merchantLogo: "avis_logo", 117 // merchantLogo: "avis_logo",
118 // expirationDate: "έως 30/09", 118 // expirationDate: "έως 30/09",
119 - // color: "#E91E63", // Pink 119 + // color: 0xEE417D,
120 // isFavorite: true 120 // isFavorite: true
121 // ), 121 // ),
122 // OfferModel( 122 // OfferModel(
...@@ -128,7 +128,7 @@ struct OfferModel { ...@@ -128,7 +128,7 @@ struct OfferModel {
128 // bannerImage: "hotel_banner", 128 // bannerImage: "hotel_banner",
129 // merchantLogo: "booking_logo", 129 // merchantLogo: "booking_logo",
130 // expirationDate: "έως 30/09", 130 // expirationDate: "έως 30/09",
131 - // color: "#E91E63", // Pink 131 + // color: 0xEE417D,
132 // isFavorite: true 132 // isFavorite: true
133 // ), 133 // ),
134 134
...@@ -139,10 +139,10 @@ struct OfferModel { ...@@ -139,10 +139,10 @@ struct OfferModel {
139 description: "σε όλα τα προϊόντα", 139 description: "σε όλα τα προϊόντα",
140 discount: "15%", 140 discount: "15%",
141 discountType: "percentage", 141 discountType: "percentage",
142 - bannerImage: "sustainable_fashion_banner", 142 + bannerImage: "musa_banner",
143 - merchantLogo: "ww_logo", 143 + merchantLogo: "musa_logo",
144 expirationDate: "έως 30/09", 144 expirationDate: "έως 30/09",
145 - color: "#4CAF50", // Green 145 + color: 0x09914E,
146 isFavorite: false 146 isFavorite: false
147 ), 147 ),
148 OfferModel( 148 OfferModel(
...@@ -151,10 +151,10 @@ struct OfferModel { ...@@ -151,10 +151,10 @@ struct OfferModel {
151 description: "στην παραγγελία", 151 description: "στην παραγγελία",
152 discount: "20%", 152 discount: "20%",
153 discountType: "percentage", 153 discountType: "percentage",
154 - bannerImage: "sustainable_food_banner", 154 + bannerImage: "musa_banner",
155 - merchantLogo: "biomarket_logo", 155 + merchantLogo: "musa_logo",
156 expirationDate: "έως 30/09", 156 expirationDate: "έως 30/09",
157 - color: "#4CAF50", // Green 157 + color: 0x09914E,
158 isFavorite: true 158 isFavorite: true
159 ), 159 ),
160 160
...@@ -168,7 +168,7 @@ struct OfferModel { ...@@ -168,7 +168,7 @@ struct OfferModel {
168 bannerImage: "ranch_banner", 168 bannerImage: "ranch_banner",
169 merchantLogo: "ranch_logo", 169 merchantLogo: "ranch_logo",
170 expirationDate: "έως 30/09", 170 expirationDate: "έως 30/09",
171 - color: "#FF9800", // Orange 171 + color: 0xFC9F25,
172 isFavorite: false 172 isFavorite: false
173 ), 173 ),
174 OfferModel( 174 OfferModel(
...@@ -177,10 +177,10 @@ struct OfferModel { ...@@ -177,10 +177,10 @@ struct OfferModel {
177 description: "δώρο στην είσοδο του παιδότοπου", 177 description: "δώρο στην είσοδο του παιδότοπου",
178 discount: "1+1", 178 discount: "1+1",
179 discountType: "buyOneGetOne", 179 discountType: "buyOneGetOne",
180 - bannerImage: "playground_banner", 180 + bannerImage: "ranch_banner",
181 - merchantLogo: "playground_logo", 181 + merchantLogo: "ranch_logo",
182 expirationDate: "έως 30/09", 182 expirationDate: "έως 30/09",
183 - color: "#FF9800", // Orange 183 + color: 0xFC9F25,
184 isFavorite: false 184 isFavorite: false
185 ), 185 ),
186 186
...@@ -191,10 +191,10 @@ struct OfferModel { ...@@ -191,10 +191,10 @@ struct OfferModel {
191 description: "στην αγορά σου", 191 description: "στην αγορά σου",
192 discount: "2€", 192 discount: "2€",
193 discountType: "amount", 193 discountType: "amount",
194 - bannerImage: "coffee_banner", 194 + bannerImage: "coffeeisland_banner",
195 - merchantLogo: "mikel_logo", 195 + merchantLogo: "coffeeisland_logo",
196 expirationDate: "έως 30/09", 196 expirationDate: "έως 30/09",
197 - color: "#F44336", // Red 197 + color: 0xEE417D,
198 isFavorite: false 198 isFavorite: false
199 ), 199 ),
200 OfferModel( 200 OfferModel(
...@@ -203,10 +203,10 @@ struct OfferModel { ...@@ -203,10 +203,10 @@ struct OfferModel {
203 description: "σε γλυκά & πεϊνιρλιδες", 203 description: "σε γλυκά & πεϊνιρλιδες",
204 discount: "10%", 204 discount: "10%",
205 discountType: "percentage", 205 discountType: "percentage",
206 - bannerImage: "pastry_banner", 206 + bannerImage: "coffeeisland_banner",
207 - merchantLogo: "bakery_logo", 207 + merchantLogo: "coffeeisland_logo",
208 expirationDate: "έως 30/09", 208 expirationDate: "έως 30/09",
209 - color: "#F44336", // Red 209 + color: 0xEE417D,
210 isFavorite: false 210 isFavorite: false
211 ), 211 ),
212 212
...@@ -217,10 +217,10 @@ struct OfferModel { ...@@ -217,10 +217,10 @@ struct OfferModel {
217 description: "στην διαμονή/διασκέδαση σου", 217 description: "στην διαμονή/διασκέδαση σου",
218 discount: "10%", 218 discount: "10%",
219 discountType: "percentage", 219 discountType: "percentage",
220 - bannerImage: "resort_banner", 220 + bannerImage: "ninemia_banner",
221 - merchantLogo: "agrafa_logo", 221 + merchantLogo: "ninemia_logo",
222 expirationDate: "έως 30/09", 222 expirationDate: "έως 30/09",
223 - color: "#2196F3", // Blue 223 + color: 0xEE417D,
224 isFavorite: true 224 isFavorite: true
225 ), 225 ),
226 OfferModel( 226 OfferModel(
...@@ -229,10 +229,10 @@ struct OfferModel { ...@@ -229,10 +229,10 @@ struct OfferModel {
229 description: "σε όλες τις υπηρεσίες", 229 description: "σε όλες τις υπηρεσίες",
230 discount: "10%", 230 discount: "10%",
231 discountType: "percentage", 231 discountType: "percentage",
232 - bannerImage: "services_banner", 232 + bannerImage: "ninemia_banner",
233 - merchantLogo: "services_logo", 233 + merchantLogo: "ninemia_logo",
234 expirationDate: "έως 30/09", 234 expirationDate: "έως 30/09",
235 - color: "#2196F3", // Blue 235 + color: 0xEE417D,
236 isFavorite: false 236 isFavorite: false
237 ), 237 ),
238 238
...@@ -243,10 +243,10 @@ struct OfferModel { ...@@ -243,10 +243,10 @@ struct OfferModel {
243 description: "για αγορές από τα φυσικά καταστήματα", 243 description: "για αγορές από τα φυσικά καταστήματα",
244 discount: "10%", 244 discount: "10%",
245 discountType: "percentage", 245 discountType: "percentage",
246 - bannerImage: "toys_banner", 246 + bannerImage: "moustakas_banner",
247 - merchantLogo: "jumbo_logo", 247 + merchantLogo: "moustakas_logo",
248 expirationDate: "έως 30/09", 248 expirationDate: "έως 30/09",
249 - color: "#9C27B0", // Purple 249 + color: 0xEE417D,
250 isFavorite: false 250 isFavorite: false
251 ), 251 ),
252 OfferModel( 252 OfferModel(
...@@ -255,10 +255,10 @@ struct OfferModel { ...@@ -255,10 +255,10 @@ struct OfferModel {
255 description: "στην είσοδο του παιδότοπου", 255 description: "στην είσοδο του παιδότοπου",
256 discount: "1+1", 256 discount: "1+1",
257 discountType: "buyOneGetOne", 257 discountType: "buyOneGetOne",
258 - bannerImage: "playarea_banner", 258 + bannerImage: "moustakas_banner",
259 - merchantLogo: "playarea_logo", 259 + merchantLogo: "moustakas_logo",
260 expirationDate: "έως 30/09", 260 expirationDate: "έως 30/09",
261 - color: "#9C27B0", // Purple 261 + color: 0xEE417D,
262 isFavorite: false 262 isFavorite: false
263 ), 263 ),
264 264
...@@ -269,10 +269,10 @@ struct OfferModel { ...@@ -269,10 +269,10 @@ struct OfferModel {
269 description: "για αγορές", 269 description: "για αγορές",
270 discount: "15€", 270 discount: "15€",
271 discountType: "amount", 271 discountType: "amount",
272 - bannerImage: "fashion_banner", 272 + bannerImage: "migato_banner",
273 merchantLogo: "migato_logo", 273 merchantLogo: "migato_logo",
274 expirationDate: "έως 30/09", 274 expirationDate: "έως 30/09",
275 - color: "#FF5722", // Deep Orange 275 + color: 0xEE417D,
276 isFavorite: false 276 isFavorite: false
277 ), 277 ),
278 OfferModel( 278 OfferModel(
...@@ -281,10 +281,10 @@ struct OfferModel { ...@@ -281,10 +281,10 @@ struct OfferModel {
281 description: "στις αγορές σου", 281 description: "στις αγορές σου",
282 discount: "Έως 30%", 282 discount: "Έως 30%",
283 discountType: "percentage", 283 discountType: "percentage",
284 - bannerImage: "shopping_banner", 284 + bannerImage: "migato_banner",
285 - merchantLogo: "shopping_logo", 285 + merchantLogo: "migato_logo",
286 expirationDate: "έως 30/09", 286 expirationDate: "έως 30/09",
287 - color: "#FF5722", // Deep Orange 287 + color: 0xEE417D,
288 isFavorite: false 288 isFavorite: false
289 ) 289 )
290 ] 290 ]
......