I am attempting to cast a shadow to my customView but it is not showing. This customView is added to the window using window?.addSubview(customView)
.
Implementation so far:
//CustomView setup
lazy var customView: UIView = {
let v = UIView()
v.translatesAutoresizingMaskIntoConstraints = false
v.layer.cornerRadius = 8
v.layer.shadowColor = UIColor.darkGray.cgColor
v.layer.shadowOffset = CGSize(width: 0, height: 10)
v.layer.shadowOpacity = 10.5
v.layer.shadowRadius = 15.0
v.layer.masksToBounds = true
return v
}()
//Adding view to window
window?.addSubview(customView)
NSLayoutConstraint.activate([
customView.leadingAnchor.constraint(equalTo: window!.leadingAnchor),
customView.trailingAnchor.constraint(equalTo: window!.trailingAnchor),
customView.heightAnchor.constraint(equalTo: window!.heightAnchor, multiplier: 1),
customView.topAnchor.constraint(equalTo: window!.safeAreaLayoutGuide.bottomAnchor, constant: -100)
])
I have followed advice from this post and this post, but somehow it doesn't show up for views added to window.