Manos Chorianopoulos

MyRewardsViewController part1

......@@ -17,6 +17,10 @@
1EA8E5C02DDF427A00CD3418 /* PingLCG-Bold.otf in Resources */ = {isa = PBXBuildFile; fileRef = 1EA8E5BD2DDF427A00CD3418 /* PingLCG-Bold.otf */; };
1EA8E5C12DDF427A00CD3418 /* PingLCG-Light.otf in Resources */ = {isa = PBXBuildFile; fileRef = 1EA8E5BE2DDF427A00CD3418 /* PingLCG-Light.otf */; };
1EA8E5C22DDF427A00CD3418 /* PingLCG-Regular.otf in Resources */ = {isa = PBXBuildFile; fileRef = 1EA8E5BF2DDF427A00CD3418 /* PingLCG-Regular.otf */; };
1EB4F4252DE09AAC00D934C0 /* MyRewardsBannerOffersScrollTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1EB4F4242DE09AAC00D934C0 /* MyRewardsBannerOffersScrollTableViewCell.xib */; };
1EB4F4262DE09AAC00D934C0 /* MyRewardsBannerOffersScrollTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EB4F4232DE09AAC00D934C0 /* MyRewardsBannerOffersScrollTableViewCell.swift */; };
1EB4F42B2DE0A0AF00D934C0 /* MyRewardsOffersScrollTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1EB4F42A2DE0A0AF00D934C0 /* MyRewardsOffersScrollTableViewCell.xib */; };
1EB4F42C2DE0A0AF00D934C0 /* MyRewardsOffersScrollTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EB4F4292DE0A0AF00D934C0 /* MyRewardsOffersScrollTableViewCell.swift */; };
1EBF5F072840E13F00B8B17F /* SwiftEventBus in Frameworks */ = {isa = PBXBuildFile; productRef = 1EBF5F062840E13F00B8B17F /* SwiftEventBus */; };
7630AD9A6242D60846D6750C /* Pods_SwiftWarplyFramework.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C0D5F56DD4E5371A50AD2D87 /* Pods_SwiftWarplyFramework.framework */; };
A07936762885E9CC00064122 /* UIColorExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = A07936752885E9CC00064122 /* UIColorExtensions.swift */; };
......@@ -151,6 +155,10 @@
1EA8E5BD2DDF427A00CD3418 /* PingLCG-Bold.otf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "PingLCG-Bold.otf"; path = "fonts/PingLCG-Bold.otf"; sourceTree = "<group>"; };
1EA8E5BE2DDF427A00CD3418 /* PingLCG-Light.otf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "PingLCG-Light.otf"; path = "fonts/PingLCG-Light.otf"; sourceTree = "<group>"; };
1EA8E5BF2DDF427A00CD3418 /* PingLCG-Regular.otf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "PingLCG-Regular.otf"; path = "fonts/PingLCG-Regular.otf"; sourceTree = "<group>"; };
1EB4F4232DE09AAC00D934C0 /* MyRewardsBannerOffersScrollTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyRewardsBannerOffersScrollTableViewCell.swift; sourceTree = "<group>"; };
1EB4F4242DE09AAC00D934C0 /* MyRewardsBannerOffersScrollTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MyRewardsBannerOffersScrollTableViewCell.xib; sourceTree = "<group>"; };
1EB4F4292DE0A0AF00D934C0 /* MyRewardsOffersScrollTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyRewardsOffersScrollTableViewCell.swift; sourceTree = "<group>"; };
1EB4F42A2DE0A0AF00D934C0 /* MyRewardsOffersScrollTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MyRewardsOffersScrollTableViewCell.xib; sourceTree = "<group>"; };
A07936752885E9CC00064122 /* UIColorExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIColorExtensions.swift; sourceTree = "<group>"; };
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>"; };
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>"; };
......@@ -290,6 +298,13 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
1E00E6A22DDF71BD0012F164 /* models */ = {
isa = PBXGroup;
children = (
);
path = models;
sourceTree = "<group>";
};
1E108A8B28A3F8FF0008B8E7 /* Resources */ = {
isa = PBXGroup;
children = (
......@@ -349,10 +364,30 @@
1EA8E5BC2DDF34FB00CD3418 /* cells */ = {
isa = PBXGroup;
children = (
1EB4F4282DE0A09500D934C0 /* MyRewardsOffersScrollTableViewCell */,
1EB4F4222DE09A4300D934C0 /* MyRewardsBannerOffersScrollTableViewCell */,
);
path = cells;
sourceTree = "<group>";
};
1EB4F4222DE09A4300D934C0 /* MyRewardsBannerOffersScrollTableViewCell */ = {
isa = PBXGroup;
children = (
1EB4F4232DE09AAC00D934C0 /* MyRewardsBannerOffersScrollTableViewCell.swift */,
1EB4F4242DE09AAC00D934C0 /* MyRewardsBannerOffersScrollTableViewCell.xib */,
);
path = MyRewardsBannerOffersScrollTableViewCell;
sourceTree = "<group>";
};
1EB4F4282DE0A09500D934C0 /* MyRewardsOffersScrollTableViewCell */ = {
isa = PBXGroup;
children = (
1EB4F4292DE0A0AF00D934C0 /* MyRewardsOffersScrollTableViewCell.swift */,
1EB4F42A2DE0A0AF00D934C0 /* MyRewardsOffersScrollTableViewCell.xib */,
);
path = MyRewardsOffersScrollTableViewCell;
sourceTree = "<group>";
};
98AD36FA62350CEABCD961A7 /* Frameworks */ = {
isa = PBXGroup;
children = (
......@@ -402,6 +437,7 @@
1E108A9728A3FA9B0008B8E7 /* Info.plist */,
1EA8E5B42DDF315600CD3418 /* screens */,
1EA8E5BC2DDF34FB00CD3418 /* cells */,
1E00E6A22DDF71BD0012F164 /* models */,
1E108A8B28A3F8FF0008B8E7 /* Resources */,
A07936742885E96A00064122 /* utilities */,
E6A7785A282933E40045BBA8 /* Helpers */,
......@@ -769,10 +805,12 @@
E6A778F3282933E60045BBA8 /* WLNativeAdTableViewCell.xib in Resources */,
E6A77A38282BC3530045BBA8 /* Media.xcassets in Resources */,
E6A77905282933E60045BBA8 /* warp_white_back_button@2x.png in Resources */,
1EB4F4252DE09AAC00D934C0 /* MyRewardsBannerOffersScrollTableViewCell.xib in Resources */,
1EA8E5C02DDF427A00CD3418 /* PingLCG-Bold.otf in Resources */,
1EA8E5C12DDF427A00CD3418 /* PingLCG-Light.otf in Resources */,
1EA8E5C22DDF427A00CD3418 /* PingLCG-Regular.otf in Resources */,
E6A77908282933E60045BBA8 /* warp_white_close_button@2x.png in Resources */,
1EB4F42B2DE0A0AF00D934C0 /* MyRewardsOffersScrollTableViewCell.xib in Resources */,
1E917CDB2DDF68C7002221D8 /* CouponViewController.xib in Resources */,
E6A77909282933E60045BBA8 /* warp_white_forward_button@2x.png in Resources */,
E6A77906282933E60045BBA8 /* warp_white_forward_button.png in Resources */,
......@@ -836,6 +874,7 @@
E6A77955282933E70045BBA8 /* ViewControllerExtensions.swift in Sources */,
A07936762885E9CC00064122 /* UIColorExtensions.swift in Sources */,
E6A7795A28293D390045BBA8 /* swiftApi.swift in Sources */,
1EB4F42C2DE0A0AF00D934C0 /* MyRewardsOffersScrollTableViewCell.swift in Sources */,
E6A77935282933E70045BBA8 /* UIWebView+AFNetworking.m in Sources */,
E6A77925282933E70045BBA8 /* UIProgressView+AFNetworking.m in Sources */,
E6A77944282933E70045BBA8 /* AFSecurityPolicy.m in Sources */,
......@@ -861,6 +900,7 @@
E6A77903282933E60045BBA8 /* WLAPSItem.m in Sources */,
E6A7790B282933E60045BBA8 /* WLPushManager.m in Sources */,
E6A77950282933E70045BBA8 /* FMResultSet.m in Sources */,
1EB4F4262DE09AAC00D934C0 /* MyRewardsBannerOffersScrollTableViewCell.swift in Sources */,
E6A77936282933E70045BBA8 /* AFAutoPurgingImageCache.m in Sources */,
E6A778FF282933E60045BBA8 /* WLBeacon.m in Sources */,
E6A7791A282933E60045BBA8 /* WLAPPActionHandler.m in Sources */,
......
{
"images" : [
{
"filename" : "profile_pic_default.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "profile_pic_default 1.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "profile_pic_default 2.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
//
// MyRewardsBannerOffersScrollTableViewCell.swift
// SwiftWarplyFramework
//
// Created by Manos Chorianopoulos on 23/5/25.
//
import UIKit
@objc public class MyRewardsBannerOffersScrollTableViewCell: UITableViewCell {
@IBOutlet weak var tagView1: UIView!
@IBOutlet weak var tagLabel1: UILabel!
@IBOutlet weak var tagView2: UIView!
@IBOutlet weak var tagLabel2: UILabel!
@IBOutlet weak var profileImage: UIImageView!
var section: SectionModel?
public override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
profileImage.image = UIImage(named: "profile_pic_default", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
tagView1.backgroundColor = UIColor(rgb: 0x09914E)
tagView1.layer.cornerRadius = 4.0
tagLabel1.font = UIFont(name: "PingLCG-Regular", size: 17)
tagLabel1.textColor = UIColor(rgb: 0xFFFFFF)
tagView2.backgroundColor = UIColor(rgb: 0xFC9F25)
tagView2.layer.cornerRadius = 4.0
tagLabel2.font = UIFont(name: "PingLCG-Regular", size: 17)
tagLabel2.textColor = UIColor(rgb: 0xFFFFFF)
}
public override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
func configureCell(data: SectionModel?) {
self.section = data
}
}
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23094" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23084"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="MyRewardsBannerOffersScrollTableViewCell" rowHeight="119" id="KGk-i7-Jjw" customClass="MyRewardsBannerOffersScrollTableViewCell" customModule="SwiftWarplyFramework" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="388" height="119"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" ambiguous="YES" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="388" height="119"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="VzF-dQ-3Wa" userLabel="Parent View">
<rect key="frame" x="0.0" y="0.0" width="388" height="298"/>
<subviews>
<view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="JTs-J5-DO2" userLabel="Top View">
<rect key="frame" x="24" y="36" width="340" height="43"/>
<subviews>
<view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="h09-MS-XKy">
<rect key="frame" x="128.33333333333334" y="8.6666666666666643" width="58" height="26"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Green" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="4m7-JY-MDY">
<rect key="frame" x="6" y="3" width="46" height="20"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="0.035294117647058823" green="0.56862745098039214" blue="0.30588235294117649" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="4m7-JY-MDY" secondAttribute="bottom" constant="3" id="lbW-sK-uoN"/>
<constraint firstItem="4m7-JY-MDY" firstAttribute="leading" secondItem="h09-MS-XKy" secondAttribute="leading" constant="6" id="oRk-5c-ko2"/>
<constraint firstAttribute="trailing" secondItem="4m7-JY-MDY" secondAttribute="trailing" constant="6" id="rOt-tf-dSS"/>
<constraint firstItem="4m7-JY-MDY" firstAttribute="top" secondItem="h09-MS-XKy" secondAttribute="top" constant="3" id="tui-5x-ntO"/>
</constraints>
</view>
<view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="H5g-xq-68p">
<rect key="frame" x="194.33333333333337" y="8.6666666666666643" width="61.666666666666629" height="26"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Family" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="WN9-wM-hV8">
<rect key="frame" x="5.9999999999999716" y="3" width="49.666666666666664" height="20"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="0.9882352941176471" green="0.62352941176470589" blue="0.14509803921568626" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="WN9-wM-hV8" secondAttribute="bottom" constant="3" id="12P-zS-ZRM"/>
<constraint firstItem="WN9-wM-hV8" firstAttribute="leading" secondItem="H5g-xq-68p" secondAttribute="leading" constant="6" id="O5x-bk-yjz"/>
<constraint firstAttribute="trailing" secondItem="WN9-wM-hV8" secondAttribute="trailing" constant="6" id="lnW-mb-d4H"/>
<constraint firstItem="WN9-wM-hV8" firstAttribute="top" secondItem="H5g-xq-68p" secondAttribute="top" constant="3" id="pwW-Ed-yv2"/>
</constraints>
</view>
<view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="5cf-tr-Vjf">
<rect key="frame" x="297" y="0.0" width="43" height="43"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="fZO-NB-UyL">
<rect key="frame" x="0.0" y="0.0" width="43" height="43"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="width" constant="43" id="Obc-SE-A5u"/>
<constraint firstAttribute="height" constant="43" id="lZJ-VG-4fl"/>
</constraints>
</imageView>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="fZO-NB-UyL" firstAttribute="leading" secondItem="5cf-tr-Vjf" secondAttribute="leading" id="Bfw-5S-wqz"/>
<constraint firstItem="fZO-NB-UyL" firstAttribute="top" secondItem="5cf-tr-Vjf" secondAttribute="top" id="WCt-TJ-XQc"/>
<constraint firstAttribute="trailing" secondItem="fZO-NB-UyL" secondAttribute="trailing" id="Z0D-wE-fgE"/>
<constraint firstAttribute="bottom" secondItem="fZO-NB-UyL" secondAttribute="bottom" id="nuy-88-N5B"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="5cf-tr-Vjf" firstAttribute="top" secondItem="JTs-J5-DO2" secondAttribute="top" id="GGh-C1-OfA"/>
<constraint firstItem="H5g-xq-68p" firstAttribute="centerY" secondItem="JTs-J5-DO2" secondAttribute="centerY" id="Lwo-5b-tgm"/>
<constraint firstAttribute="trailing" secondItem="5cf-tr-Vjf" secondAttribute="trailing" id="PBw-4p-3qC"/>
<constraint firstItem="5cf-tr-Vjf" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="H5g-xq-68p" secondAttribute="trailing" constant="8" id="Wot-lB-jmI"/>
<constraint firstAttribute="bottom" secondItem="5cf-tr-Vjf" secondAttribute="bottom" id="geG-Wp-p9Z"/>
<constraint firstItem="h09-MS-XKy" firstAttribute="centerY" secondItem="JTs-J5-DO2" secondAttribute="centerY" id="j5f-Os-TZ0"/>
<constraint firstItem="H5g-xq-68p" firstAttribute="leading" secondItem="h09-MS-XKy" secondAttribute="trailing" constant="8" id="wqx-Hc-3YH"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="JTs-J5-DO2" firstAttribute="top" secondItem="VzF-dQ-3Wa" secondAttribute="top" constant="36" id="Ac5-fx-J3w"/>
<constraint firstItem="JTs-J5-DO2" firstAttribute="leading" secondItem="VzF-dQ-3Wa" secondAttribute="leading" constant="24" id="B98-id-FLf"/>
<constraint firstAttribute="trailing" secondItem="JTs-J5-DO2" secondAttribute="trailing" constant="24" id="Rdi-FK-2Ft"/>
<constraint firstAttribute="bottom" secondItem="JTs-J5-DO2" secondAttribute="bottom" constant="20" id="Ubp-Qg-xtv"/>
</constraints>
</view>
</subviews>
<constraints>
<constraint firstItem="VzF-dQ-3Wa" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="7Ut-VE-YGv"/>
<constraint firstAttribute="trailing" secondItem="VzF-dQ-3Wa" secondAttribute="trailing" id="Hic-ok-g96"/>
<constraint firstItem="VzF-dQ-3Wa" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="PZE-CV-H0c"/>
<constraint firstAttribute="bottom" secondItem="VzF-dQ-3Wa" secondAttribute="bottom" id="hVw-ot-Ywc"/>
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<connections>
<outlet property="profileImage" destination="fZO-NB-UyL" id="l05-qG-DJv"/>
<outlet property="tagLabel1" destination="4m7-JY-MDY" id="Min-YW-AN2"/>
<outlet property="tagLabel2" destination="WN9-wM-hV8" id="yWk-1S-4Zk"/>
<outlet property="tagView1" destination="h09-MS-XKy" id="Hxa-cN-6i4"/>
<outlet property="tagView2" destination="H5g-xq-68p" id="Vcv-Si-g68"/>
</connections>
<point key="canvasLocation" x="53.435114503816791" y="14.43661971830986"/>
</tableViewCell>
</objects>
<resources>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>
//
// MyRewardsOffersScrollTableViewCell.swift
// SwiftWarplyFramework
//
// Created by Manos Chorianopoulos on 23/5/25.
//
import UIKit
@objc public class MyRewardsOffersScrollTableViewCell: UITableViewCell {
var section: SectionModel?
public override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
public override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
func configureCell(data: SectionModel?) {
}
}
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23094" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23084"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="MyRewardsOffersScrollTableViewCell" id="KGk-i7-Jjw" customClass="MyRewardsOffersScrollTableViewCell" customModule="SwiftWarplyFramework" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<point key="canvasLocation" x="37" y="-11"/>
</tableViewCell>
</objects>
</document>
......@@ -7,23 +7,480 @@
import UIKit
struct SectionModel {
let title: String
let count: Int
let offers: [OfferModel]
}
struct OfferModel {
let category: String
let title: String
let description: String
let discount: String
let discountType: String // e.g., "price", "percentage", "free", "buyOneGetOne", etc.
let bannerImage: String
let merchantLogo: String
let expirationDate: String
let color: String
var isFavorite: Bool
}
@objc public class MyRewardsViewController: UIViewController {
@IBOutlet weak var tableView: UITableView!
// MARK: - Dummy Data
let allOffers: [OfferModel] = [
// Banner Offers
OfferModel(
category: "Διαγωνισμός",
title: "Διαγωνισμός Κού-πονς!",
description: "13 Απίθανα ΔΩΡΑ σε περιμένουν!",
discount: "",
discountType: "contest",
bannerImage: "contest_banner",
merchantLogo: "contest_logo",
expirationDate: "30/06/2025",
color: "#8A2BE2", // Purple
isFavorite: false
),
OfferModel(
category: "Διαγωνισμός",
title: "Διαγωνισμός Κού-πονς!",
description: "13 Απίθανα ΔΩΡΑ σε περιμένουν!",
discount: "",
discountType: "contest",
bannerImage: "contest_banner",
merchantLogo: "contest_logo",
expirationDate: "30/06/2025",
color: "#8A2BE2", // Purple
isFavorite: false
),
OfferModel(
category: "Διαγωνισμός",
title: "Διαγωνισμός Κού-πονς!",
description: "13 Απίθανα ΔΩΡΑ σε περιμένουν!",
discount: "",
discountType: "contest",
bannerImage: "contest_banner",
merchantLogo: "contest_logo",
expirationDate: "30/06/2025",
color: "#8A2BE2", // Purple
isFavorite: false
),
// Top offers
OfferModel(
category: "Top offers",
title: "Μόνο 17.95",
description: "2 πίτσες & Coca-COLA 1,5lt",
discount: "17.95€",
discountType: "price",
bannerImage: "pizza_banner",
merchantLogo: "dominos_logo",
expirationDate: "έως 30/09",
color: "#E91E63", // Pink
isFavorite: true
),
OfferModel(
category: "Top offers",
title: "20% έκπτωση",
description: "για όλες τις online αγορές σας",
discount: "20%",
discountType: "percentage",
bannerImage: "furniture_banner",
merchantLogo: "ikea_logo",
expirationDate: "έως 30/09",
color: "#E91E63", // Pink
isFavorite: false
),
// OfferModel(
// category: "Top offers",
// title: "Δωρεάν μεταφορικά",
// description: "για αγορές άνω των 50€",
// discount: "Δωρεάν",
// discountType: "free",
// bannerImage: "delivery_banner",
// merchantLogo: "skroutz_logo",
// expirationDate: "έως 30/09",
// color: "#E91E63", // Pink
// isFavorite: false
// ),
// Αγαπημένα
// OfferModel(
// category: "Αγαπημένα",
// title: "15% έκπτωση",
// description: "στην ενοικίαση αυτοκινήτου",
// discount: "15%",
// discountType: "percentage",
// bannerImage: "car_rental_banner",
// merchantLogo: "avis_logo",
// expirationDate: "έως 30/09",
// color: "#E91E63", // Pink
// isFavorite: true
// ),
// OfferModel(
// category: "Αγαπημένα",
// title: "20€ έως και",
// description: "έκπτωση στα πακέτα",
// discount: "20€",
// discountType: "amount",
// bannerImage: "hotel_banner",
// merchantLogo: "booking_logo",
// expirationDate: "έως 30/09",
// color: "#E91E63", // Pink
// isFavorite: true
// ),
// Βιωσιμότητα
OfferModel(
category: "Βιωσιμότητα",
title: "15% έκπτωση",
description: "σε όλα τα προϊόντα",
discount: "15%",
discountType: "percentage",
bannerImage: "sustainable_fashion_banner",
merchantLogo: "ww_logo",
expirationDate: "έως 30/09",
color: "#4CAF50", // Green
isFavorite: false
),
OfferModel(
category: "Βιωσιμότητα",
title: "20% έκπτωση",
description: "στην παραγγελία",
discount: "20%",
discountType: "percentage",
bannerImage: "sustainable_food_banner",
merchantLogo: "biomarket_logo",
expirationDate: "έως 30/09",
color: "#4CAF50", // Green
isFavorite: true
),
// Family
OfferModel(
category: "Family",
title: "10% έκπτωση",
description: "στην κατασκήνωση στο The Ranch",
discount: "10%",
discountType: "percentage",
bannerImage: "ranch_banner",
merchantLogo: "ranch_logo",
expirationDate: "έως 30/09",
color: "#FF9800", // Orange
isFavorite: false
),
OfferModel(
category: "Family",
title: "1+1 εισιτήριο",
description: "δώρο στην είσοδο του παιδότοπου",
discount: "1+1",
discountType: "buyOneGetOne",
bannerImage: "playground_banner",
merchantLogo: "playground_logo",
expirationDate: "έως 30/09",
color: "#FF9800", // Orange
isFavorite: false
),
// Φαγητό και καφές
OfferModel(
category: "Φαγητό και καφές",
title: "2€ έκπτωση",
description: "στην αγορά σου",
discount: "2€",
discountType: "amount",
bannerImage: "coffee_banner",
merchantLogo: "mikel_logo",
expirationDate: "έως 30/09",
color: "#F44336", // Red
isFavorite: false
),
OfferModel(
category: "Φαγητό και καφές",
title: "10% έκπτωση",
description: "σε γλυκά & πεϊνιρλιδες",
discount: "10%",
discountType: "percentage",
bannerImage: "pastry_banner",
merchantLogo: "bakery_logo",
expirationDate: "έως 30/09",
color: "#F44336", // Red
isFavorite: false
),
// Απόδραση
OfferModel(
category: "Απόδραση",
title: "10% έκπτωση",
description: "στην διαμονή/διασκέδαση σου",
discount: "10%",
discountType: "percentage",
bannerImage: "resort_banner",
merchantLogo: "agrafa_logo",
expirationDate: "έως 30/09",
color: "#2196F3", // Blue
isFavorite: true
),
OfferModel(
category: "Απόδραση",
title: "10% έκπτωση",
description: "σε όλες τις υπηρεσίες",
discount: "10%",
discountType: "percentage",
bannerImage: "services_banner",
merchantLogo: "services_logo",
expirationDate: "έως 30/09",
color: "#2196F3", // Blue
isFavorite: false
),
// Παιδί
OfferModel(
category: "Παιδί",
title: "10% έκπτωση",
description: "για αγορές από τα φυσικά καταστήματα",
discount: "10%",
discountType: "percentage",
bannerImage: "toys_banner",
merchantLogo: "jumbo_logo",
expirationDate: "έως 30/09",
color: "#9C27B0", // Purple
isFavorite: false
),
OfferModel(
category: "Παιδί",
title: "1+1 Δώρο",
description: "στην είσοδο του παιδότοπου",
discount: "1+1",
discountType: "buyOneGetOne",
bannerImage: "playarea_banner",
merchantLogo: "playarea_logo",
expirationDate: "έως 30/09",
color: "#9C27B0", // Purple
isFavorite: false
),
// Αγορές
OfferModel(
category: "Αγορές",
title: "15€ έκπτωση",
description: "για αγορές",
discount: "15€",
discountType: "amount",
bannerImage: "fashion_banner",
merchantLogo: "migato_logo",
expirationDate: "έως 30/09",
color: "#FF5722", // Deep Orange
isFavorite: false
),
OfferModel(
category: "Αγορές",
title: "Έως 30% έκπτωση",
description: "στις αγορές σου",
discount: "Έως 30%",
discountType: "percentage",
bannerImage: "shopping_banner",
merchantLogo: "shopping_logo",
expirationDate: "έως 30/09",
color: "#FF5722", // Deep Orange
isFavorite: false
)
]
var bannerOffersSection: SectionModel?
var topOffersSection: SectionModel?
var favoriteOffersSection: SectionModel?
var sustainableOffersSection: SectionModel?
var familyOffersSection: SectionModel?
var foodOffersSection: SectionModel?
var escapeOffersSection: SectionModel?
var childOffersSection: SectionModel?
var shoppingOffersSection: SectionModel?
public override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
// Register XIBs for table view cells
tableView.register(UINib(nibName: "MyRewardsBannerOffersScrollTableViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellReuseIdentifier: "BannerCell")
tableView.register(UINib(nibName: "MyRewardsOffersScrollTableViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellReuseIdentifier: "OffersCell")
// Set up table view
tableView.delegate = self
tableView.dataSource = self
tableView.separatorStyle = .none
tableView.estimatedRowHeight = 200
tableView.rowHeight = UITableView.automaticDimension
initializeSections()
}
// MARK: Function
func initializeSections() {
// Banner Offers (for the promotional banner at the top)
let bannerOffers = allOffers.filter { $0.category == "Διαγωνισμός" }
bannerOffersSection = SectionModel(
title: "Διαγωνισμός",
count: bannerOffers.count,
offers: bannerOffers
)
// Top Offers
let topOffers = allOffers.filter { $0.category == "Top offers" }
topOffersSection = SectionModel(
title: "Top offers",
count: topOffers.count,
offers: topOffers
)
// Favorite Offers
let favoriteOffers = allOffers.filter { $0.isFavorite }
favoriteOffersSection = SectionModel(
title: "Αγαπημένα",
count: favoriteOffers.count,
offers: favoriteOffers
)
// Sustainable Offers
let sustainableOffers = allOffers.filter { $0.category == "Βιωσιμότητα" }
sustainableOffersSection = SectionModel(
title: "Βιωσιμότητα",
count: sustainableOffers.count,
offers: sustainableOffers
)
// Family Offers
let familyOffers = allOffers.filter { $0.category == "Family" }
familyOffersSection = SectionModel(
title: "Family",
count: familyOffers.count,
offers: familyOffers
)
// Food Offers
let foodOffers = allOffers.filter { $0.category == "Φαγητό και καφές" }
foodOffersSection = SectionModel(
title: "Φαγητό και καφές",
count: foodOffers.count,
offers: foodOffers
)
// Escape Offers
let escapeOffers = allOffers.filter { $0.category == "Απόδραση" }
escapeOffersSection = SectionModel(
title: "Απόδραση",
count: escapeOffers.count,
offers: escapeOffers
)
// Child Offers
let childOffers = allOffers.filter { $0.category == "Παιδί" }
childOffersSection = SectionModel(
title: "Παιδί",
count: childOffers.count,
offers: childOffers
)
// Shopping Offers
let shoppingOffers = allOffers.filter { $0.category == "Αγορές" }
shoppingOffersSection = SectionModel(
title: "Αγορές",
count: shoppingOffers.count,
offers: shoppingOffers
)
self.tableView.reloadData()
}
}
// MARK: - TableView
extension MyRewardsViewController: UITableViewDelegate, UITableViewDataSource{
/*
// MARK: - Navigation
public func numberOfSections(in tableView: UITableView) -> Int {
return 9
}
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}
*/
public func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return UITableView.automaticDimension
}
public func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
return nil
}
public func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 0.0
}
public func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
// return CGFloat.leastNormalMagnitude
return 0.0
}
public func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
return nil
}
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if (indexPath.section == 0) {
let cell = tableView.dequeueReusableCell(withIdentifier: "MyRewardsBannerOffersScrollTableViewCell", for: indexPath) as! MyRewardsBannerOffersScrollTableViewCell
let smCount = 1
cell.configureCell(data: self.bannerOffersSection)
// cell.parent = self
return cell
} else {
let cell = tableView.dequeueReusableCell(withIdentifier: "MyRewardsOffersScrollTableViewCell", for: indexPath) as! MyRewardsOffersScrollTableViewCell
if (indexPath.section == 1) {
cell.configureCell(data: self.topOffersSection)
} else if (indexPath.section == 2) {
cell.configureCell(data: self.favoriteOffersSection)
} else if (indexPath.section == 3) {
cell.configureCell(data: self.sustainableOffersSection)
} else if (indexPath.section == 4) {
cell.configureCell(data: self.familyOffersSection)
} else if (indexPath.section == 5) {
cell.configureCell(data: self.foodOffersSection)
} else if (indexPath.section == 6) {
cell.configureCell(data: self.escapeOffersSection)
} else if (indexPath.section == 7) {
cell.configureCell(data: self.childOffersSection)
} else {
cell.configureCell(data: self.shoppingOffersSection)
}
return cell
}
}
public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if (indexPath.section == 0) {
// Do nothing - Each button is handled differently
} else if (indexPath.section == 1) {
// Do nothing
} else if (indexPath.section == 2) {
// Do nothing
} else if (indexPath.section == 3) {
// Do nothing
} else if (indexPath.section == 4) {
// Do nothing
} else if (indexPath.section == 5) {
// Do nothing
} else if (indexPath.section == 6) {
// Do nothing
} else if (indexPath.section == 7) {
// Do nothing
} else {
// Do nothing
}
}
}
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13142" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23094" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12042"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23084"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="MyRewardsViewController" customModuleProvider="target">
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="MyRewardsViewController" customModule="SwiftWarplyFramework" customModuleProvider="target">
<connections>
<outlet property="tableView" destination="2it-5M-CR6" id="uM3-ZJ-zKB"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="scR-yg-okd" userLabel="Main View">
<rect key="frame" x="0.0" y="59" width="393" height="793"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="none" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="1" estimatedSectionHeaderHeight="-1" sectionFooterHeight="1" estimatedSectionFooterHeight="-1" contentViewInsetsToSafeArea="NO" translatesAutoresizingMaskIntoConstraints="NO" id="2it-5M-CR6">
<rect key="frame" x="0.0" y="0.0" width="393" height="793"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="separatorColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="sectionIndexBackgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<connections>
<outlet property="dataSource" destination="-1" id="avy-hE-15l"/>
<outlet property="delegate" destination="-1" id="tmq-4b-xNt"/>
</connections>
</tableView>
</subviews>
<color key="backgroundColor" red="0.94901960780000005" green="0.94901960780000005" blue="0.94901960780000005" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstItem="2it-5M-CR6" firstAttribute="top" secondItem="scR-yg-okd" secondAttribute="top" id="8Qy-L0-5ab"/>
<constraint firstAttribute="trailing" secondItem="2it-5M-CR6" secondAttribute="trailing" id="AXe-zP-ef8"/>
<constraint firstItem="2it-5M-CR6" firstAttribute="leading" secondItem="scR-yg-okd" secondAttribute="leading" id="NeU-gh-skU"/>
<constraint firstAttribute="bottom" secondItem="2it-5M-CR6" secondAttribute="bottom" id="bpx-U5-A8r"/>
</constraints>
</view>
</subviews>
<viewLayoutGuide key="safeArea" id="fnl-2z-Ty3"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="scR-yg-okd" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="Nwv-jZ-0HT"/>
<constraint firstItem="scR-yg-okd" firstAttribute="top" secondItem="fnl-2z-Ty3" secondAttribute="top" id="OFK-BH-zlp"/>
<constraint firstAttribute="trailing" secondItem="scR-yg-okd" secondAttribute="trailing" id="Wgk-0e-fYU"/>
<constraint firstAttribute="bottom" secondItem="scR-yg-okd" secondAttribute="bottom" id="ogA-sg-Lij"/>
</constraints>
<point key="canvasLocation" x="11" y="-11"/>
</view>
</objects>
<resources>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>
......