Commit 534581ae by Fahad Sparrow

favourites vc. label for count added, function to reload table view added

home1vc: remove action and add action for popular and recommended products implemented
seeallitemsCollectionViewCell: popular products and product list code implemented
seeAllItemsVC:header changed, add action and remove action added, popular products implementation added
parent 4f6a1636
...@@ -127,7 +127,6 @@ ...@@ -127,7 +127,6 @@
18A4E1CD29718CC400557B75 /* OrderDetailsFinalModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18A4E1CC29718CC400557B75 /* OrderDetailsFinalModel.swift */; }; 18A4E1CD29718CC400557B75 /* OrderDetailsFinalModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18A4E1CC29718CC400557B75 /* OrderDetailsFinalModel.swift */; };
18B4F90C293E0C350064967A /* PaymentListVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18B4F90B293E0C350064967A /* PaymentListVC.swift */; }; 18B4F90C293E0C350064967A /* PaymentListVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18B4F90B293E0C350064967A /* PaymentListVC.swift */; };
59B2221CAFEA4B0B8EA214CC /* Pods_Garmentoo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DEE54B8FF00F9468A18D28C2 /* Pods_Garmentoo.framework */; }; 59B2221CAFEA4B0B8EA214CC /* Pods_Garmentoo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DEE54B8FF00F9468A18D28C2 /* Pods_Garmentoo.framework */; };
CE2986F6298032DD00CF1EF6 /* LazyImageLoad.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE2986F5298032DD00CF1EF6 /* LazyImageLoad.swift */; };
CE5A90622977FDBD002631BA /* OrderTrackingVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE5A90612977FDBD002631BA /* OrderTrackingVM.swift */; }; CE5A90622977FDBD002631BA /* OrderTrackingVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE5A90612977FDBD002631BA /* OrderTrackingVM.swift */; };
CE5A90642977FE1D002631BA /* OrderTrackingModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE5A90632977FE1D002631BA /* OrderTrackingModel.swift */; }; CE5A90642977FE1D002631BA /* OrderTrackingModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE5A90632977FE1D002631BA /* OrderTrackingModel.swift */; };
CE6C4C7D297655D200E29EEB /* HomeCarousalCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE6C4C7C297655D200E29EEB /* HomeCarousalCollectionViewCell.swift */; }; CE6C4C7D297655D200E29EEB /* HomeCarousalCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE6C4C7C297655D200E29EEB /* HomeCarousalCollectionViewCell.swift */; };
...@@ -257,7 +256,6 @@ ...@@ -257,7 +256,6 @@
18B4F90B293E0C350064967A /* PaymentListVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PaymentListVC.swift; sourceTree = "<group>"; }; 18B4F90B293E0C350064967A /* PaymentListVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PaymentListVC.swift; sourceTree = "<group>"; };
53BB753FA89C2964F65C4795 /* Pods-Garmentoo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Garmentoo.debug.xcconfig"; path = "Target Support Files/Pods-Garmentoo/Pods-Garmentoo.debug.xcconfig"; sourceTree = "<group>"; }; 53BB753FA89C2964F65C4795 /* Pods-Garmentoo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Garmentoo.debug.xcconfig"; path = "Target Support Files/Pods-Garmentoo/Pods-Garmentoo.debug.xcconfig"; sourceTree = "<group>"; };
7CF6274E82055F93DB69F7B2 /* Pods-Garmentoo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Garmentoo.release.xcconfig"; path = "Target Support Files/Pods-Garmentoo/Pods-Garmentoo.release.xcconfig"; sourceTree = "<group>"; }; 7CF6274E82055F93DB69F7B2 /* Pods-Garmentoo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Garmentoo.release.xcconfig"; path = "Target Support Files/Pods-Garmentoo/Pods-Garmentoo.release.xcconfig"; sourceTree = "<group>"; };
CE2986F5298032DD00CF1EF6 /* LazyImageLoad.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LazyImageLoad.swift; sourceTree = "<group>"; };
CE5A90612977FDBD002631BA /* OrderTrackingVM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderTrackingVM.swift; sourceTree = "<group>"; }; CE5A90612977FDBD002631BA /* OrderTrackingVM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderTrackingVM.swift; sourceTree = "<group>"; };
CE5A90632977FE1D002631BA /* OrderTrackingModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderTrackingModel.swift; sourceTree = "<group>"; }; CE5A90632977FE1D002631BA /* OrderTrackingModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderTrackingModel.swift; sourceTree = "<group>"; };
CE6C4C7C297655D200E29EEB /* HomeCarousalCollectionViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HomeCarousalCollectionViewCell.swift; sourceTree = "<group>"; }; CE6C4C7C297655D200E29EEB /* HomeCarousalCollectionViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HomeCarousalCollectionViewCell.swift; sourceTree = "<group>"; };
...@@ -674,7 +672,6 @@ ...@@ -674,7 +672,6 @@
04EA059427EEF0FF003106F9 /* Validation.swift */, 04EA059427EEF0FF003106F9 /* Validation.swift */,
045A256A283B8887005C2ED8 /* activityLoader.swift */, 045A256A283B8887005C2ED8 /* activityLoader.swift */,
045A256D283B8C02005C2ED8 /* ShimmerEffect.swift */, 045A256D283B8C02005C2ED8 /* ShimmerEffect.swift */,
CE2986F5298032DD00CF1EF6 /* LazyImageLoad.swift */,
); );
path = Helpers; path = Helpers;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -919,7 +916,6 @@ ...@@ -919,7 +916,6 @@
044C03AC27EDA4BD0036D21B /* OnboardingNavVC.swift in Sources */, 044C03AC27EDA4BD0036D21B /* OnboardingNavVC.swift in Sources */,
041CEE8F2849E75C00D05C61 /* SubCategoryVC.swift in Sources */, 041CEE8F2849E75C00D05C61 /* SubCategoryVC.swift in Sources */,
046618D027EC2CD800D65702 /* SceneDelegate.swift in Sources */, 046618D027EC2CD800D65702 /* SceneDelegate.swift in Sources */,
CE2986F6298032DD00CF1EF6 /* LazyImageLoad.swift in Sources */,
041D02AC288EC61700D82125 /* CartModel.swift in Sources */, 041D02AC288EC61700D82125 /* CartModel.swift in Sources */,
18A4E1CB297186E100557B75 /* OrderDetailsFinalVM.swift in Sources */, 18A4E1CB297186E100557B75 /* OrderDetailsFinalVM.swift in Sources */,
04C9EEE9287C236500A9F075 /* AddressListVM.swift in Sources */, 04C9EEE9287C236500A9F075 /* AddressListVM.swift in Sources */,
......
...@@ -9,29 +9,59 @@ import Foundation ...@@ -9,29 +9,59 @@ import Foundation
import UIKit import UIKit
class SeeAllItemsCollectionViewCell: UICollectionViewCell { class SeeAllItemsCollectionViewCell: UICollectionViewCell {
@IBOutlet weak var outerView: UIView! @IBOutlet weak var outerView: UIView!
@IBOutlet weak var priceLabel: UILabel! @IBOutlet weak var priceLabel: UILabel!
@IBOutlet weak var btnFavAddRemove: UIButton!
@IBOutlet weak var img:UIImageView! @IBOutlet weak var img:UIImageView!
@IBOutlet weak var name:UILabel! @IBOutlet weak var name:UILabel!
@IBOutlet weak var isFavImg: UIImageView!
var popularProductsDetails : Popular_products?
var popularProductsDetails : Popular_products?
{ {
didSet didSet
{ {
self.name.text = popularProductsDetails?.product_name self.name.text = popularProductsDetails?.product_name
self.priceLabel.text = "Rs. " + (popularProductsDetails?.price)! self.priceLabel.text = "Rs. " + (popularProductsDetails?.price)!
// let imagelink = popularProductsDetails?.product_images if popularProductsDetails?.is_favourite == true
// if imagelink != nil {
// { self.isFavImg.image = UIImage(named: "heartFilled")
// let url = URL(string:(imagelink!)) }
// self.img.kf.indicatorType = .activity else
// self.img.kf.setImage(with: url, placeholder: UIImage(named: "placeholderImage"), options: .none, completionHandler: nil) {
// } self.isFavImg.image = UIImage(named: "heart")
}
let imagelink = popularProductsDetails?.product_images![0]
if imagelink != nil
{
let url = URL(string:(imagelink!))
self.img.kf.indicatorType = .activity
self.img.kf.setImage(with: url, placeholder: UIImage(named: "placeholderImage"), options: .none, completionHandler: nil)
}
} }
} }
var allProducts : Product_list?
{
didSet
{
self.name.text = allProducts?.name
self.priceLabel.text = "Rs. " + (allProducts?.price)!
let imagelink = allProducts?.images![0]
if imagelink != nil
{
let url = URL(string:(imagelink!))
self.img.kf.indicatorType = .activity
self.img.kf.setImage(with: url, placeholder: UIImage(named: "placeholderImage"), options: .none, completionHandler: nil)
}
}
}
......
...@@ -10,14 +10,16 @@ import UIKit ...@@ -10,14 +10,16 @@ import UIKit
class FavouritesVC: UIViewController { class FavouritesVC: UIViewController {
@IBOutlet weak var favtable: UITableView! @IBOutlet weak var favtable: UITableView!
@IBOutlet weak var itemsCount: UILabel!
var favModel = FavouritesVM() var favModel = FavouritesVM()
var favritesData = [Favourite]() var favritesData = [Favourite]()
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
self.loadFavouriteList() self.loadFavouriteList()
} }
override func viewWillAppear(_ animated: Bool) { override func viewWillAppear(_ animated: Bool) {
...@@ -92,6 +94,8 @@ extension FavouritesVC:UIScrollViewDelegate{ ...@@ -92,6 +94,8 @@ extension FavouritesVC:UIScrollViewDelegate{
animations: {tabBar!.frame.origin.y = offset}, animations: {tabBar!.frame.origin.y = offset},
completion:nil) completion:nil)
} }
} }
...@@ -115,6 +119,7 @@ extension FavouritesVC ...@@ -115,6 +119,7 @@ extension FavouritesVC
//self.favModel.favListModel = favData //self.favModel.favListModel = favData
self.favritesData = (favData?.favourite)! self.favritesData = (favData?.favourite)!
DispatchQueue.main.async { DispatchQueue.main.async {
self.itemsCount.text = "\(self.favritesData.count) Items"
self.favtable.reloadData() self.favtable.reloadData()
} }
} }
...@@ -131,7 +136,7 @@ extension FavouritesVC ...@@ -131,7 +136,7 @@ extension FavouritesVC
{ {
@objc func favouriteRemoveAction(_ sender : UIButton) @objc func favouriteRemoveAction(_ sender : UIButton)
{ {
do {
let favId = self.favModel.favListModel?.favourite?[sender.tag].product_id ?? "" let favId = self.favModel.favListModel?.favourite?[sender.tag].product_id ?? ""
DispatchQueue.main.async { DispatchQueue.main.async {
AppInstance.showLoader() AppInstance.showLoader()
...@@ -145,12 +150,23 @@ extension FavouritesVC ...@@ -145,12 +150,23 @@ extension FavouritesVC
if favData?.status == true if favData?.status == true
{ {
self.loadFavouriteList() self.loadFavouriteList()
} }
else else
{ {
self.showSnackBar(Message: favData?.message ?? "Something went wrong!!!", duration: .middle) self.showSnackBar(Message: favData?.message ?? "Something went wrong!!!", duration: .middle)
} }
} }
} }
self.loadFavouriteList()
}
} }
...@@ -36,15 +36,11 @@ class HomeRecommendedCollectionViewCell: UICollectionViewCell { ...@@ -36,15 +36,11 @@ class HomeRecommendedCollectionViewCell: UICollectionViewCell {
if imagelink != nil if imagelink != nil
{ {
let url = URL(string:(imagelink!)) let url = URL(string:(imagelink!))
self.img.kf.indicatorType = .activity self.img.kf.indicatorType = .activity
self.img.kf.setImage(with: url, placeholder: UIImage(named: "placeholderImage"), options: .none, completionHandler: nil) self.img.kf.setImage(with: url, placeholder: UIImage(named: "placeholderImage"), options: .none, completionHandler: nil)
} }
// let imagelink = banner?.image
// if imagelink != nil
// {
// self.img.downloaded(from: imagelink!)
// }
} }
} }
......
...@@ -24,9 +24,6 @@ class HomemadeforyouCollectionViewCell: UICollectionViewCell { ...@@ -24,9 +24,6 @@ class HomemadeforyouCollectionViewCell: UICollectionViewCell {
{ {
let url = URL(string:(imagelink!)) let url = URL(string:(imagelink!))
self.img.kf.indicatorType = .activity self.img.kf.indicatorType = .activity
let imageData = try? Data(contentsOf: url!)
let image = UIImage(data: imageData!)!
self.img.image = image
self.img.kf.setImage(with: url, placeholder: UIImage(named: "placeholderImage"), options: .none, completionHandler: nil) self.img.kf.setImage(with: url, placeholder: UIImage(named: "placeholderImage"), options: .none, completionHandler: nil)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment