Manos Chorianopoulos

LoyaltyViewController part2

......@@ -8,5 +8,12 @@
import UIKit
@objc public class FiltersCollectionViewCell: UICollectionViewCell {
@IBOutlet weak var filterLabel: UILabel!
@IBOutlet weak var borderView: UIView!
func configureCell(filterName: String, isSelected: Bool) {
filterLabel.text = filterName
borderView.backgroundColor = isSelected ? UIColor(rgb: 0xE8002A) : .clear
filterLabel.textColor = isSelected ? UIColor(rgb: 0x484848) : UIColor(rgb: 0xD3D3D3)
}
}
......
......@@ -11,9 +11,11 @@ import UIKit
@IBOutlet weak var headerView: UIView!
@IBOutlet weak var closeImage: UIImageView!
@IBOutlet weak var logoImage: UIImageView!
@IBOutlet weak var filtersView: UIView!
@IBOutlet weak var collectionView: UICollectionView!
var selectedScreen: String = ""
var filtersList: Array<String> = ["Όλα", "Σπίτι", "Έξοδος", "Υγεία"]
var selectedScreen: String = "Offers"
var filtersList: Array<String> = ["Screen", "Όλα", "Σπίτι", "Έξοδος", "Υγεία"]
var selectedFilter: String = "Όλα"
public override func viewDidLoad() {
......@@ -24,6 +26,15 @@ import UIKit
closeImage.image = UIImage(named: "close_btn_white", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
logoImage.image = UIImage(named: "epistrofi_logo", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
// Add shadow
filtersView.layer.shadowColor = UIColor(rgb: 0x000000).cgColor
filtersView.layer.shadowOffset = CGSize(width: 0.0, height: 10.0)
filtersView.layer.shadowOpacity = 0.05
filtersView.layer.shadowRadius = 6.0
collectionView.contentInset.left = 20
collectionView.contentInset.right = 20
}
}
......@@ -38,8 +49,29 @@ extension LoyaltyViewController: UICollectionViewDataSource,UICollectionViewDele
}
public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "ScreenCollectionViewCellId", for: indexPath) as! ScreenCollectionViewCell
// cell.myLabel.text = "ABCD"
return cell;
if (indexPath.row == 0) {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "ScreenCollectionViewCellId", for: indexPath) as! ScreenCollectionViewCell
cell.configureCell(screen: selectedScreen)
return cell;
} else {
let currentFilter = filtersList[indexPath.row];
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "FiltersCollectionViewCellId", for: indexPath) as! FiltersCollectionViewCell
cell.configureCell(filterName: currentFilter, isSelected: currentFilter == selectedFilter)
return cell;
}
}
public func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
if (indexPath.row == 0) {
let offersSelected = selectedScreen == "Offers";
selectedScreen = offersSelected ? "Map" : "Offers"
} else {
let currentFilter = filtersList[indexPath.row];
selectedFilter = currentFilter;
}
collectionView.reloadData();
}
}
......
......@@ -3991,7 +3991,7 @@
<!--Loyalty View Controller-->
<scene sceneID="wdU-7S-AU1">
<objects>
<viewController storyboardIdentifier="LoyaltyViewController" id="zKA-A2-Dl8" customClass="LoyaltyViewController" customModule="ResourcesBundle" customModuleProvider="target" sceneMemberID="viewController">
<viewController storyboardIdentifier="LoyaltyViewController" id="zKA-A2-Dl8" customClass="LoyaltyViewController" customModule="SwiftWarplyFramework" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="YeC-iK-Hrq">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
......@@ -4027,13 +4027,13 @@
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ZDd-1H-T7x" userLabel="Filters View">
<rect key="frame" x="0.0" y="176" width="414" height="100"/>
<rect key="frame" x="0.0" y="176" width="414" height="89"/>
<subviews>
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="3Ff-i2-KRi">
<rect key="frame" x="0.0" y="0.0" width="414" height="100"/>
<rect key="frame" x="0.0" y="15" width="414" height="49"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="height" constant="100" id="pnI-y1-sVK"/>
<constraint firstAttribute="height" constant="49" id="pnI-y1-sVK"/>
</constraints>
<collectionViewFlowLayout key="collectionViewLayout" scrollDirection="horizontal" automaticEstimatedItemSize="YES" minimumLineSpacing="10" minimumInteritemSpacing="10" id="bwb-bV-3Wq">
<size key="itemSize" width="128" height="128"/>
......@@ -4042,22 +4042,117 @@
<inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
</collectionViewFlowLayout>
<cells>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="ScreenCollectionViewCellId" id="oyy-X4-NUR">
<rect key="frame" x="0.0" y="-14" width="128" height="128"/>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="ScreenCollectionViewCellId" id="oyy-X4-NUR" customClass="ScreenCollectionViewCell" customModule="SwiftWarplyFramework">
<rect key="frame" x="0.0" y="0.0" width="98" height="49"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<collectionViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" id="neg-3H-s9N">
<rect key="frame" x="0.0" y="0.0" width="128" height="128"/>
<rect key="frame" x="0.0" y="0.0" width="98" height="49"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<view contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="9OA-DS-AH2">
<rect key="frame" x="-56" y="0.0" width="240" height="128"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="9OA-DS-AH2">
<rect key="frame" x="0.0" y="0.0" width="98" height="45"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="SIx-84-Ls3">
<rect key="frame" x="15" y="14" width="16" height="17"/>
<constraints>
<constraint firstAttribute="width" constant="16" id="LkV-Qi-2xD"/>
<constraint firstAttribute="height" constant="17" id="yPN-uU-UeI"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xvH-T7-AJf">
<rect key="frame" x="39" y="12" width="44" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="18"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="0.91764705882352937" green="0.0" blue="0.16470588235294117" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstItem="xvH-T7-AJf" firstAttribute="leading" secondItem="SIx-84-Ls3" secondAttribute="trailing" constant="8" id="0kE-Nh-Zm5"/>
<constraint firstItem="SIx-84-Ls3" firstAttribute="leading" secondItem="9OA-DS-AH2" secondAttribute="leading" constant="15" id="9Oh-Zp-fq4"/>
<constraint firstAttribute="height" constant="45" id="Lc2-Ef-Q1g"/>
<constraint firstItem="SIx-84-Ls3" firstAttribute="centerY" secondItem="9OA-DS-AH2" secondAttribute="centerY" id="kDa-Yw-Fka"/>
<constraint firstAttribute="trailing" secondItem="xvH-T7-AJf" secondAttribute="trailing" constant="15" id="pkU-1m-NGy"/>
<constraint firstItem="xvH-T7-AJf" firstAttribute="centerY" secondItem="9OA-DS-AH2" secondAttribute="centerY" id="rxp-3F-6jz"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="9OA-DS-AH2" firstAttribute="top" secondItem="neg-3H-s9N" secondAttribute="top" id="FoU-pB-CWF"/>
<constraint firstAttribute="trailing" secondItem="9OA-DS-AH2" secondAttribute="trailing" id="YGo-uQ-rbP"/>
<constraint firstAttribute="bottom" secondItem="9OA-DS-AH2" secondAttribute="bottom" constant="4" id="cd6-6H-RLY"/>
<constraint firstItem="9OA-DS-AH2" firstAttribute="leading" secondItem="neg-3H-s9N" secondAttribute="leading" id="s7T-Pi-y62"/>
</constraints>
</collectionViewCellContentView>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<connections>
<outlet property="containerView" destination="9OA-DS-AH2" id="iYe-FL-wvD"/>
<outlet property="filterImage" destination="SIx-84-Ls3" id="eYj-3y-Y48"/>
<outlet property="filterLabel" destination="xvH-T7-AJf" id="0IL-GW-Daf"/>
</connections>
</collectionViewCell>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="FiltersCollectionViewCellId" id="Sak-h8-xcG" customClass="FiltersCollectionViewCell" customModule="SwiftWarplyFramework">
<rect key="frame" x="108" y="2" width="65" height="45"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<collectionViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" id="MDo-0S-AaL">
<rect key="frame" x="0.0" y="0.0" width="65" height="45"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="c0z-js-0Cx">
<rect key="frame" x="0.0" y="0.0" width="65" height="45"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="lE0-Fh-ZOu" userLabel="Top View">
<rect key="frame" x="10" y="0.0" width="45" height="41"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fqT-n0-qFj">
<rect key="frame" x="0.0" y="10" width="45" height="21"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="18"/>
<color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="fqT-n0-qFj" secondAttribute="trailing" id="WO9-x0-czQ"/>
<constraint firstItem="fqT-n0-qFj" firstAttribute="centerY" secondItem="lE0-Fh-ZOu" secondAttribute="centerY" id="v9r-ZL-nlz"/>
<constraint firstItem="fqT-n0-qFj" firstAttribute="leading" secondItem="lE0-Fh-ZOu" secondAttribute="leading" id="zH9-zP-uIO"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="1uI-vE-hfs">
<rect key="frame" x="10" y="41" width="45" height="4"/>
<color key="backgroundColor" red="0.90980392156862744" green="0.0" blue="0.16470588235294117" alpha="0.0" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="4" id="IPx-4M-kWs"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="lE0-Fh-ZOu" secondAttribute="trailing" constant="10" id="D3X-JA-gEh"/>
<constraint firstAttribute="height" constant="45" id="Dn3-yl-Bcw"/>
<constraint firstItem="1uI-vE-hfs" firstAttribute="leading" secondItem="c0z-js-0Cx" secondAttribute="leading" constant="10" id="Sl8-Jv-AIe"/>
<constraint firstAttribute="bottom" secondItem="1uI-vE-hfs" secondAttribute="bottom" id="YvN-iI-gHZ"/>
<constraint firstItem="lE0-Fh-ZOu" firstAttribute="top" secondItem="c0z-js-0Cx" secondAttribute="top" id="gRF-JW-kwP"/>
<constraint firstAttribute="trailing" secondItem="1uI-vE-hfs" secondAttribute="trailing" constant="10" id="gXe-kC-b7J"/>
<constraint firstItem="lE0-Fh-ZOu" firstAttribute="leading" secondItem="c0z-js-0Cx" secondAttribute="leading" constant="10" id="jji-Lb-RLX"/>
<constraint firstItem="1uI-vE-hfs" firstAttribute="top" secondItem="lE0-Fh-ZOu" secondAttribute="bottom" id="tV3-RZ-jsb"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="c0z-js-0Cx" secondAttribute="bottom" id="9Ig-w0-cIW"/>
<constraint firstItem="c0z-js-0Cx" firstAttribute="leading" secondItem="MDo-0S-AaL" secondAttribute="leading" id="B9b-Fp-CIM"/>
<constraint firstAttribute="trailing" secondItem="c0z-js-0Cx" secondAttribute="trailing" id="Beo-UQ-FZi"/>
<constraint firstItem="c0z-js-0Cx" firstAttribute="top" secondItem="MDo-0S-AaL" secondAttribute="top" id="nek-ca-jRj"/>
</constraints>
</collectionViewCellContentView>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<connections>
<outlet property="borderView" destination="1uI-vE-hfs" id="PXN-Zb-GTx"/>
<outlet property="filterLabel" destination="fqT-n0-qFj" id="8b3-pW-Z3d"/>
</connections>
</collectionViewCell>
</cells>
<connections>
......@@ -4069,9 +4164,9 @@
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="3Ff-i2-KRi" firstAttribute="leading" secondItem="ZDd-1H-T7x" secondAttribute="leading" id="BjC-Ge-MmK"/>
<constraint firstAttribute="bottom" secondItem="3Ff-i2-KRi" secondAttribute="bottom" id="VEJ-Z8-lMd"/>
<constraint firstAttribute="bottom" secondItem="3Ff-i2-KRi" secondAttribute="bottom" constant="25" id="VEJ-Z8-lMd"/>
<constraint firstAttribute="trailing" secondItem="3Ff-i2-KRi" secondAttribute="trailing" id="VPb-oz-go1"/>
<constraint firstItem="3Ff-i2-KRi" firstAttribute="top" secondItem="ZDd-1H-T7x" secondAttribute="top" id="ZOb-HP-thS"/>
<constraint firstItem="3Ff-i2-KRi" firstAttribute="top" secondItem="ZDd-1H-T7x" secondAttribute="top" constant="15" id="ZOb-HP-thS"/>
</constraints>
</view>
</subviews>
......@@ -4097,6 +4192,8 @@
</view>
<connections>
<outlet property="closeImage" destination="b5d-hX-vcb" id="esI-7p-Ycc"/>
<outlet property="collectionView" destination="3Ff-i2-KRi" id="7GZ-4D-yqt"/>
<outlet property="filtersView" destination="ZDd-1H-T7x" id="HUd-Ox-bcV"/>
<outlet property="headerView" destination="Iq3-R0-fBz" id="E4T-bn-yYD"/>
<outlet property="logoImage" destination="GZK-rw-pZV" id="qwb-ae-QFc"/>
</connections>
......
......@@ -8,5 +8,25 @@
import UIKit
@objc public class ScreenCollectionViewCell: UICollectionViewCell {
@IBOutlet weak var containerView: UIView!
@IBOutlet weak var filterImage: UIImageView!
@IBOutlet weak var filterLabel: UILabel!
public override func awakeFromNib() {
super.awakeFromNib()
containerView.layer.cornerRadius = 23.0
containerView.clipsToBounds = true
}
func configureCell(screen: String) {
if (screen == "Offers") {
filterImage.image = UIImage(named: "list", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
filterLabel.text = "Λίστα"
} else {
filterImage.image = UIImage(named: "map_pin", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
filterLabel.text = "Χάρτης"
}
}
}
......