Files
Woka_Native_iOS/WOKA/Helpers/LoadingIndicatorImageView.swift
BilalKhanWDI 22796ec0b1 - Made new module for Cart
- Finalised Listing of CartList
- Added pull to refresh and swipe to delete
- Handled manual delete on icon click
- Made CouponCart listing view controller
- Added api to fetch the coupons
- Added api to apply coupon with model
- Made a coupon discount stack , will show up
2024-07-23 19:53:12 +05:30

38 lines
1.6 KiB
Swift

//
// LoadingIndicatorImageView.swift
// WOKA
//
// Created by MacBook Pro on 08/05/24.
//
import UIKit
import SDWebImage
extension UIImageView {
func imageURL(_ url: String, color : UIColor = UIColor.black) {
let activityIndicator = UIActivityIndicatorView(style: .medium)
activityIndicator.tintColor = UIColor.darkGray
activityIndicator.color = color
activityIndicator.frame = CGRect(x: 0, y: 0, width: 64, height: 64)
activityIndicator.hidesWhenStopped = true
activityIndicator.startAnimating()
activityIndicator.translatesAutoresizingMaskIntoConstraints = true
// activityIndicator.center = CGPoint(x: self.frame.size.width / 2, y: self.frame.size.height / 2)
activityIndicator.center = CGPointMake(CGRectGetMidX(self.bounds), CGRectGetMidY(self.bounds))
// bottom is for resizing the indicator to be perfect in center
activityIndicator.autoresizingMask = (UIView.AutoresizingMask(rawValue: UIView.AutoresizingMask.RawValue(UInt8(UIView.AutoresizingMask.flexibleRightMargin.rawValue) | UInt8(UIView.AutoresizingMask.flexibleLeftMargin.rawValue) | UInt8(UIView.AutoresizingMask.flexibleBottomMargin.rawValue) | UInt8(UIView.AutoresizingMask.flexibleTopMargin.rawValue))))
self.addSubview(activityIndicator)
// self.sd_setImage(with: <#T##URL?#>, placeholderImage: <#T##UIImage?#>)
self.sd_setImage(with: URL(string: url.replacingOccurrences(of: " ", with: "%20"))) { (image, error, cacheType, url) in
activityIndicator.stopAnimating()
}
// }
}
}