-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDecorationViewConfig.swift
42 lines (33 loc) · 1.24 KB
/
DecorationViewConfig.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//
// DecorationViewConfig.swift
// RakuyoKit
//
// Created by Rakuyo on 2025/2/17.
// Copyright © 2024 RakuyoKit. All rights reserved.
//
import UIKit
// MARK: - DecorationViewConfig
public struct DecorationViewConfig {
public let backgroundColor: UIColor?
public let cornerRadius: CGFloat?
public let maskedCorners: CACornerMask
public init(backgroundColor: UIColor? = nil, cornerRadius: CGFloat? = nil, maskedCorners: CACornerMask = []) {
self.backgroundColor = backgroundColor
self.cornerRadius = cornerRadius
self.maskedCorners = maskedCorners
}
}
extension DecorationViewConfig {
public static func topCornerRadiusDecorationView(with cornerRadius: CGFloat, backgroundColor: UIColor? = nil) -> Self {
.init(backgroundColor: backgroundColor, cornerRadius: cornerRadius, maskedCorners: [
.layerMinXMinYCorner,
.layerMaxXMinYCorner,
])
}
public static func bottomCornerRadiusDecorationView(with cornerRadius: CGFloat, backgroundColor: UIColor? = nil) -> Self {
.init(backgroundColor: backgroundColor, cornerRadius: cornerRadius, maskedCorners: [
.layerMinXMaxYCorner,
.layerMaxXMaxYCorner,
])
}
}