Files
Woka_Native_iOS/WOKA/Helpers/Shadows/SwiftyInnerShadowLayer.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

92 lines
2.3 KiB
Swift

//
// SwiftyInnerShadowLayer.swift
// SwiftyShadowExample
//
// Created by luan on 7/11/17.
// Copyright © 2017 luantran. All rights reserved.
//
import UIKit
public class SwiftyInnerShadowLayer: CAShapeLayer {
override init() {
super.init()
initShadow()
}
override public init(layer: Any) {
super.init(layer: layer)
}
required public init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
initShadow()
}
override public var shadowOffset: CGSize {
didSet {
setNeedsLayout()
}
}
override public var shadowOpacity: Float {
didSet {
setNeedsLayout()
}
}
override public var shadowRadius: CGFloat {
didSet {
setNeedsLayout()
}
}
override public var shadowColor: CGColor? {
didSet {
setNeedsLayout()
}
}
func initShadow() {
masksToBounds = true
shouldRasterize = true
fillRule = CAShapeLayerFillRule.evenOdd
borderColor = UIColor.clear.cgColor
}
override public func layoutSublayers() {
super.layoutSublayers()
generateShadowPath()
}
func generateShadowPath() {
let top = shadowRadius - shadowOffset.height
let bottom = shadowRadius + shadowOffset.height
let left = shadowRadius - shadowOffset.width
let right = shadowRadius + shadowOffset.width
let shadowRect = CGRect(x: bounds.origin.x - left,
y: bounds.origin.y - top,
width: bounds.width + left + right,
height: bounds.height + top + bottom)
let path = CGMutablePath()
let delta: CGFloat = 1
let rect = CGRect(x: bounds.origin.x - delta, y: bounds.origin.y - delta, width: bounds.width + delta * 2, height: bounds.height + delta * 2)
let bezier: UIBezierPath = {
if cornerRadius > 0 {
return UIBezierPath(roundedRect: rect, cornerRadius: cornerRadius)
} else {
return UIBezierPath(rect: rect)
}
}()
path.addPath(bezier.cgPath)
path.addRect(shadowRect)
path.closeSubpath()
self.path = path
}
}