Files
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

87 lines
4.1 KiB
Swift

//
// UIView.swift
// SwiftyShadow
//
// Created by luan on 7/23/17.
//
//
import UIKit
extension UIView {
public func generateOuterShadow() {
let view = UIView()
view.translatesAutoresizingMaskIntoConstraints = false
view.layer.cornerRadius = layer.cornerRadius
view.layer.shadowRadius = layer.shadowRadius
view.layer.shadowOpacity = layer.shadowOpacity
view.layer.shadowColor = layer.shadowColor
view.layer.shadowOffset = layer.shadowOffset
view.clipsToBounds = false
view.backgroundColor = .clear
view.isUserInteractionEnabled = false
// superview?.insertSubview(view, belowSubview: self)
superview?.insertSubview(view, aboveSubview: self)
let constraints = [
NSLayoutConstraint(item: view, attribute: .left, relatedBy: .equal, toItem: self, attribute: .left, multiplier: 1.0, constant: 0.0),
NSLayoutConstraint(item: view, attribute: .right, relatedBy: .equal, toItem: self, attribute: .right, multiplier: 1.0, constant: 0.0),
NSLayoutConstraint(item: view, attribute: .top, relatedBy: .equal, toItem: self, attribute: .top, multiplier: 1.0, constant: 0.0),
NSLayoutConstraint(item: view, attribute: .bottom, relatedBy: .equal, toItem: self, attribute: .bottom, multiplier: 1.0, constant: 0.0),
]
superview?.addConstraints(constraints)
}
public func generateInnerShadow() {
let view = SwiftyInnerShadowView()
view.translatesAutoresizingMaskIntoConstraints = false
view.shadowLayer.cornerRadius = layer.cornerRadius
view.shadowLayer.shadowRadius = layer.shadowRadius
view.shadowLayer.shadowOpacity = layer.shadowOpacity
view.shadowLayer.shadowColor = layer.shadowColor
view.shadowLayer.shadowOffset = layer.shadowOffset
view.clipsToBounds = false
view.backgroundColor = .clear
superview?.insertSubview(view, aboveSubview: self)
let constraints = [
NSLayoutConstraint(item: view, attribute: .left, relatedBy: .equal, toItem: self, attribute: .left, multiplier: 1.0, constant: 0.0),
NSLayoutConstraint(item: view, attribute: .right, relatedBy: .equal, toItem: self, attribute: .right, multiplier: 1.0, constant: 0.0),
NSLayoutConstraint(item: view, attribute: .top, relatedBy: .equal, toItem: self, attribute: .top, multiplier: 1.0, constant: 0.0),
NSLayoutConstraint(item: view, attribute: .bottom, relatedBy: .equal, toItem: self, attribute: .bottom, multiplier: 1.0, constant: 0.0),
]
superview?.addConstraints(constraints)
}
public func generateEllipticalShadow() {
let view = UIView()
view.translatesAutoresizingMaskIntoConstraints = false
view.layer.cornerRadius = layer.cornerRadius
view.layer.shadowRadius = layer.shadowRadius
view.layer.shadowOpacity = layer.shadowOpacity
view.layer.shadowColor = layer.shadowColor
view.layer.shadowOffset = layer.shadowOffset
view.clipsToBounds = false
view.backgroundColor = .clear
let ovalRect = CGRect(x: 0, y: frame.size.height + 10, width: frame.size.width, height: 15)
let path = UIBezierPath(ovalIn: ovalRect)
view.layer.shadowPath = path.cgPath
superview?.insertSubview(view, belowSubview: self)
let constraints = [
NSLayoutConstraint(item: view, attribute: .left, relatedBy: .equal, toItem: self, attribute: .left, multiplier: 1.0, constant: 0.0),
NSLayoutConstraint(item: view, attribute: .right, relatedBy: .equal, toItem: self, attribute: .right, multiplier: 1.0, constant: 0.0),
NSLayoutConstraint(item: view, attribute: .top, relatedBy: .equal, toItem: self, attribute: .top, multiplier: 1.0, constant: 0.0),
NSLayoutConstraint(item: view, attribute: .bottom, relatedBy: .equal, toItem: self, attribute: .bottom, multiplier: 1.0, constant: 0.0),
]
superview?.addConstraints(constraints)
}
}