Files
Woka_Native_iOS/WOKA/Cart/Controller/AddressListVC.swift
Bilal adb2e2684c - solved issue of fullscreen for player. now transforming the view
- updated api for shop procuts, with lazy loading and proper structure
- added loading indicator when user navigates to bottom indicator will be shown
- Made shop product details view.
- Added carousel with page indicator
- added shadows to the images
- added selection option for address
- made address table dynamic
- added pincode_serviceability_check_edd for checking the delivery date of the selected address.
2024-07-26 23:21:09 +05:30

86 lines
2.7 KiB
Swift

//
// AddressListVC.swift
// WOKA
//
// Created by MacBook Pro on 25/07/24.
//
import UIKit
class AddressListVC: UIViewController {
@IBOutlet weak var innerView: UIView!
@IBOutlet weak var tableView: UITableView!
@IBOutlet weak var useSelectedAddBtn : LocalisedElementsButton!
@IBOutlet weak var addNewAddressBtn : LocalisedElementsButton!
var vm = AddressListVM()
override func viewDidLoad() {
super.viewDidLoad()
vm.vc = self
vm.initView()
navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
navigationController?.navigationBar.shadowImage = UIImage()
}
override func viewDidLayoutSubviews() {
vm.addBtnGradient()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
navigationController?.setNavigationBarHidden(false, animated: animated)
}
override func viewDidAppear(_ animated: Bool) {
self.navigationController?.setColor(color: .white)
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
self.navigationController?.setNavigationBarHidden(true, animated: animated)
}
override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
// Customize the navigation bar's appearance
self.navigationController?.setColor(color: .black)
}
@IBAction func btnTapped(_ sender: LocalisedElementsButton) {
}
}
// MARK: - TableView DataSource , Delegates
extension AddressListVC : TableViewSRC{
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return vm.addressData.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: K.CellIdentifier.Cart.addressCell) as! AddressCell
let data = vm.addressData[indexPath.row]
cell.setData(data: data)
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
for index in vm.addressData.indices {
vm.addressData[index].isDefault = false
}
if vm.addressData[indexPath.row].eddDate == nil || vm.addressData[indexPath.row].eddDate == ""{
if let pincode = vm.addressData[indexPath.row].pincode, let id = vm.addressData[indexPath.row].id{
vm.checkEstimatedDeliveryData(pinCode: pincode, id: id)
}
}
vm.addressData[indexPath.row].isDefault = true
tableView.reloadData()
}
}