추후 작성 예정
뷰의 테두리를 점선으로 하고 싶을 때 아래 코드처럼 작성해주면 된다.
func setLineDot(view: UIView, color: String){
**let borderLayer = CAShapeLayer()
borderLayer.strokeColor = UIColor(named: color)?.cgColor
borderLayer.lineDashPattern = [2, 2]
borderLayer.frame = view.bounds
borderLayer.fillColor = nil
borderLayer.path = UIBezierPath(rect: view.bounds).cgPath
view.layer.addSublayer(borderLayer)**
}
cornerRadius가 적용된 점선
func setLineDot(view: UIView, color: String, radius: CGFloat){
let borderLayer = CAShapeLayer()
borderLayer.strokeColor = UIColor(named: color)?.cgColor
borderLayer.lineDashPattern = [2, 2]
borderLayer.frame = view.bounds
borderLayer.fillColor = nil
**borderLayer.path = UIBezierPath(roundedRect: view.bounds, cornerRadius: radius).cgPath**
view.layer.addSublayer(borderLayer)
}
final class FriendListView: UIView {
...(중략)...
**// 점선 테두리 배경
lazy var borderLayer: CAShapeLayer = {
let borderLayer = CAShapeLayer()
borderLayer.strokeColor = UIColor.theme.blue3?.cgColor
borderLayer.lineDashPattern = [4, 4]
borderLayer.fillColor = nil
return borderLayer
}()**
// 비어있음 라벨
lazy var emptyFriendLabel: UILabel = {
let emptyFriendLabel = UILabel()
emptyFriendLabel.text = "아직 친구가 없습니다.\n새 친구를 추가해보세요!"
emptyFriendLabel.numberOfLines = 0
emptyFriendLabel.font = UIFont.carmuFont.headline1
emptyFriendLabel.textColor = UIColor.semantic.textBody
emptyFriendLabel.textAlignment = .center
return emptyFriendLabel
}()
...(중략)...
override func layoutSubviews() {
super.layoutSubviews()
**borderLayer.frame = emptyFriendLabel.bounds
borderLayer.path = UIBezierPath(roundedRect: emptyFriendLabel.bounds, cornerRadius: 16).cgPath**
}
override func draw(_ rect: CGRect) {
setupViews()
setAutoLayout()
}
func setupViews() {
addSubview(friendListTableView)
addSubview(emptyView)
addSubview(emptyFriendLabel)
**emptyFriendLabel.layer.addSublayer(borderLayer)**
}
...(중략)...
}

[iOS - swift] 블러 효과, 색상 필터링 효과 주는 방법 (UIVisualEffectView, UIBlurEffect, UIVibrancyEffect)
How to set the BlurRadius of UIBlurEffectStyle.Light