Manos Chorianopoulos

LoyaltyViewController part3

...@@ -13,6 +13,7 @@ import UIKit ...@@ -13,6 +13,7 @@ import UIKit
13 @IBOutlet weak var logoImage: UIImageView! 13 @IBOutlet weak var logoImage: UIImageView!
14 @IBOutlet weak var filtersView: UIView! 14 @IBOutlet weak var filtersView: UIView!
15 @IBOutlet weak var collectionView: UICollectionView! 15 @IBOutlet weak var collectionView: UICollectionView!
16 + @IBOutlet weak var containerView: UIView!
16 17
17 var selectedScreen: String = "Offers" 18 var selectedScreen: String = "Offers"
18 var filtersList: Array<String> = ["Screen", "Όλα", "Σπίτι", "Έξοδος", "Υγεία"] 19 var filtersList: Array<String> = ["Screen", "Όλα", "Σπίτι", "Έξοδος", "Υγεία"]
...@@ -35,6 +36,33 @@ import UIKit ...@@ -35,6 +36,33 @@ import UIKit
35 36
36 collectionView.contentInset.left = 20 37 collectionView.contentInset.left = 20
37 collectionView.contentInset.right = 20 38 collectionView.contentInset.right = 20
39 +
40 + loadVC(vcName: "OffersViewController");
41 + }
42 +
43 + func loadVC(vcName: String) {
44 + let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
45 +
46 + var vc: UIViewController;
47 +
48 + if (vcName == "OffersViewController") {
49 + vc = storyboard.instantiateViewController(withIdentifier: "OffersViewController") as! SwiftWarplyFramework.OffersViewController
50 + } else {
51 + vc = storyboard.instantiateViewController(withIdentifier: "MapViewController") as! SwiftWarplyFramework.MapViewController
52 + }
53 +
54 + addChild(vc)
55 + vc.view.translatesAutoresizingMaskIntoConstraints = false
56 + containerView.addSubview(vc.view)
57 +
58 + NSLayoutConstraint.activate([
59 + vc.view.leadingAnchor.constraint(equalTo: containerView.leadingAnchor, constant: 0),
60 + vc.view.trailingAnchor.constraint(equalTo: containerView.trailingAnchor, constant: 0),
61 + vc.view.topAnchor.constraint(equalTo: containerView.topAnchor, constant: 0),
62 + vc.view.bottomAnchor.constraint(equalTo: containerView.bottomAnchor, constant: 0)
63 + ])
64 +
65 + vc.didMove(toParent: self)
38 } 66 }
39 67
40 } 68 }
...@@ -66,6 +94,7 @@ extension LoyaltyViewController: UICollectionViewDataSource,UICollectionViewDele ...@@ -66,6 +94,7 @@ extension LoyaltyViewController: UICollectionViewDataSource,UICollectionViewDele
66 if (indexPath.row == 0) { 94 if (indexPath.row == 0) {
67 let offersSelected = selectedScreen == "Offers"; 95 let offersSelected = selectedScreen == "Offers";
68 selectedScreen = offersSelected ? "Map" : "Offers" 96 selectedScreen = offersSelected ? "Map" : "Offers"
97 + loadVC(vcName: selectedScreen == "Offers" ? "OffersViewController" : "MapViewController");
69 98
70 } else { 99 } else {
71 let currentFilter = filtersList[indexPath.row]; 100 let currentFilter = filtersList[indexPath.row];
......
...@@ -4169,15 +4169,26 @@ ...@@ -4169,15 +4169,26 @@
4169 <constraint firstItem="3Ff-i2-KRi" firstAttribute="top" secondItem="ZDd-1H-T7x" secondAttribute="top" constant="15" id="ZOb-HP-thS"/> 4169 <constraint firstItem="3Ff-i2-KRi" firstAttribute="top" secondItem="ZDd-1H-T7x" secondAttribute="top" constant="15" id="ZOb-HP-thS"/>
4170 </constraints> 4170 </constraints>
4171 </view> 4171 </view>
4172 + <containerView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="JYn-ad-sj7">
4173 + <rect key="frame" x="0.0" y="265" width="414" height="631"/>
4174 + <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
4175 + <connections>
4176 + <segue destination="B4y-Pl-zNk" kind="embed" id="OPh-Qb-zce"/>
4177 + </connections>
4178 + </containerView>
4172 </subviews> 4179 </subviews>
4173 <color key="backgroundColor" systemColor="systemBackgroundColor"/> 4180 <color key="backgroundColor" systemColor="systemBackgroundColor"/>
4174 <constraints> 4181 <constraints>
4182 + <constraint firstItem="JYn-ad-sj7" firstAttribute="top" secondItem="ZDd-1H-T7x" secondAttribute="bottom" id="Kua-T7-oY0"/>
4175 <constraint firstItem="ZDd-1H-T7x" firstAttribute="leading" secondItem="XsW-fz-6VQ" secondAttribute="leading" id="LSl-4t-R39"/> 4183 <constraint firstItem="ZDd-1H-T7x" firstAttribute="leading" secondItem="XsW-fz-6VQ" secondAttribute="leading" id="LSl-4t-R39"/>
4176 <constraint firstItem="Iq3-R0-fBz" firstAttribute="leading" secondItem="XsW-fz-6VQ" secondAttribute="leading" id="PAL-j8-olw"/> 4184 <constraint firstItem="Iq3-R0-fBz" firstAttribute="leading" secondItem="XsW-fz-6VQ" secondAttribute="leading" id="PAL-j8-olw"/>
4177 <constraint firstAttribute="trailing" secondItem="Iq3-R0-fBz" secondAttribute="trailing" id="PLY-Y8-vLt"/> 4185 <constraint firstAttribute="trailing" secondItem="Iq3-R0-fBz" secondAttribute="trailing" id="PLY-Y8-vLt"/>
4186 + <constraint firstAttribute="trailing" secondItem="JYn-ad-sj7" secondAttribute="trailing" id="WHV-5Y-kAr"/>
4178 <constraint firstAttribute="trailing" secondItem="ZDd-1H-T7x" secondAttribute="trailing" id="eYH-Gm-SBy"/> 4187 <constraint firstAttribute="trailing" secondItem="ZDd-1H-T7x" secondAttribute="trailing" id="eYH-Gm-SBy"/>
4188 + <constraint firstItem="JYn-ad-sj7" firstAttribute="leading" secondItem="XsW-fz-6VQ" secondAttribute="leading" id="n8j-bS-Kg1"/>
4179 <constraint firstItem="ZDd-1H-T7x" firstAttribute="top" secondItem="Iq3-R0-fBz" secondAttribute="bottom" id="rhx-zr-AVs"/> 4189 <constraint firstItem="ZDd-1H-T7x" firstAttribute="top" secondItem="Iq3-R0-fBz" secondAttribute="bottom" id="rhx-zr-AVs"/>
4180 <constraint firstItem="Iq3-R0-fBz" firstAttribute="top" secondItem="XsW-fz-6VQ" secondAttribute="top" id="rqp-ps-RYb"/> 4190 <constraint firstItem="Iq3-R0-fBz" firstAttribute="top" secondItem="XsW-fz-6VQ" secondAttribute="top" id="rqp-ps-RYb"/>
4191 + <constraint firstAttribute="bottom" secondItem="JYn-ad-sj7" secondAttribute="bottom" id="woo-KR-rGp"/>
4181 </constraints> 4192 </constraints>
4182 </view> 4193 </view>
4183 </subviews> 4194 </subviews>
...@@ -4193,6 +4204,7 @@ ...@@ -4193,6 +4204,7 @@
4193 <connections> 4204 <connections>
4194 <outlet property="closeImage" destination="b5d-hX-vcb" id="esI-7p-Ycc"/> 4205 <outlet property="closeImage" destination="b5d-hX-vcb" id="esI-7p-Ycc"/>
4195 <outlet property="collectionView" destination="3Ff-i2-KRi" id="7GZ-4D-yqt"/> 4206 <outlet property="collectionView" destination="3Ff-i2-KRi" id="7GZ-4D-yqt"/>
4207 + <outlet property="containerView" destination="JYn-ad-sj7" id="hpH-B5-4uH"/>
4196 <outlet property="filtersView" destination="ZDd-1H-T7x" id="HUd-Ox-bcV"/> 4208 <outlet property="filtersView" destination="ZDd-1H-T7x" id="HUd-Ox-bcV"/>
4197 <outlet property="headerView" destination="Iq3-R0-fBz" id="E4T-bn-yYD"/> 4209 <outlet property="headerView" destination="Iq3-R0-fBz" id="E4T-bn-yYD"/>
4198 <outlet property="logoImage" destination="GZK-rw-pZV" id="qwb-ae-QFc"/> 4210 <outlet property="logoImage" destination="GZK-rw-pZV" id="qwb-ae-QFc"/>
......