You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
988 B
37 lines
988 B
//
|
|
// ShadowView.swift
|
|
// GME Remit
|
|
//
|
|
// Created by InKwon James Kim on 28/08/2019.
|
|
// Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
class ShadowView: UIView {
|
|
private var shadowLayer: CAShapeLayer!
|
|
private var cornerRadius: CGFloat = 5.0
|
|
|
|
private var shadowBackground: UIColor = .themeMainBackground
|
|
|
|
override func layoutSubviews() {
|
|
super.layoutSubviews()
|
|
|
|
if shadowLayer == nil {
|
|
shadowLayer = CAShapeLayer()
|
|
} else {
|
|
shadowLayer.removeFromSuperlayer()
|
|
}
|
|
|
|
shadowLayer.path = UIBezierPath(roundedRect: bounds, cornerRadius: cornerRadius).cgPath
|
|
shadowLayer.fillColor = shadowBackground.cgColor
|
|
|
|
shadowLayer.shadowColor = UIColor.black.cgColor
|
|
shadowLayer.shadowPath = shadowLayer.path
|
|
shadowLayer.shadowOffset = CGSize(width: 0.0, height: 0.5)
|
|
shadowLayer.shadowOpacity = 0.5
|
|
shadowLayer.shadowRadius = 1
|
|
|
|
layer.insertSublayer(shadowLayer, at: 0)
|
|
}
|
|
}
|