Skip to content

Commit a6b1909

Browse files
author
蔡龙君
committed
feat |> 配置类新增背景颜色&修改为class
1 parent 95acbae commit a6b1909

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

SFAlertController/Classes/SFAlertControllerConfiguration.swift

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,32 @@
77

88
import UIKit
99

10-
public struct SFAlertControllerConfiguration {
10+
public class SFAlertControllerConfiguration {
11+
/// 背景颜色
12+
public var backgroundColor: UIColor = UIColor.white
1113
/// 内容距离上下左右间距
12-
var insets: UIEdgeInsets = UIEdgeInsets(top: 8, left: 8, bottom: 8, right: 8)
14+
public var insets: UIEdgeInsets = UIEdgeInsets(top: 8, left: 8, bottom: 8, right: 8)
1315
/// 标题颜色
14-
var titleColor: UIColor = UIColor.black
16+
public var titleColor: UIColor = UIColor.black
1517
/// 标题字体
16-
var titleFont: UIFont = UIFont.systemFont(ofSize: 17, weight: .medium)
18+
public var titleFont: UIFont = UIFont.systemFont(ofSize: 17, weight: .medium)
1719
/// message颜色
18-
var messageColor: UIColor = UIColor.black
20+
public var messageColor: UIColor = UIColor.black
1921
/// message字体
20-
var messageFont: UIFont = UIFont.systemFont(ofSize: 13, weight: .regular)
22+
public var messageFont: UIFont = UIFont.systemFont(ofSize: 13, weight: .regular)
2123
/// 分割线颜色
22-
var separatorColor: UIColor = UIColor(red: 0, green: 0, blue: 0.31, alpha: 0.05)
24+
public var separatorColor: UIColor = UIColor(red: 0, green: 0, blue: 0.31, alpha: 0.05)
2325
/// defaultButtonColor
24-
var defaultButtonColor: UIColor = UIColor(red: 0, green: 0.48, blue: 1, alpha: 1)
26+
public var defaultButtonColor: UIColor = UIColor(red: 0, green: 0.48, blue: 1, alpha: 1)
2527
/// cancelButtonColor
26-
var cancelButtonColor: UIColor = UIColor(red: 0, green: 0.48, blue: 1, alpha: 1)
28+
public var cancelButtonColor: UIColor = UIColor(red: 0, green: 0.48, blue: 1, alpha: 1)
2729
/// destructiveButtonColor
28-
var destructiveButtonColor: UIColor = UIColor(red: 1, green: 0.23, blue: 0.19, alpha: 1)
30+
public var destructiveButtonColor: UIColor = UIColor(red: 1, green: 0.23, blue: 0.19, alpha: 1)
2931
/// 子控件间距
30-
var subviewSpacing: CGFloat = 10
32+
public var subviewSpacing: CGFloat = 10
3133

32-
init(insets: UIEdgeInsets = UIEdgeInsets(top: 8, left: 8, bottom: 8, right: 8),
34+
public init(backgroundColor: UIColor = UIColor.white,
35+
insets: UIEdgeInsets = UIEdgeInsets(top: 8, left: 8, bottom: 8, right: 8),
3336
titleColor: UIColor = UIColor.black,
3437
titleFont: UIFont = UIFont.systemFont(ofSize: 17, weight: .medium),
3538
messageColor: UIColor = UIColor.black,
@@ -40,6 +43,7 @@ public struct SFAlertControllerConfiguration {
4043
destructiveButtonColor: UIColor = UIColor(red: 1, green: 0.23, blue: 0.19, alpha: 1),
4144
subviewSpacing: CGFloat = 10
4245
) {
46+
self.backgroundColor = backgroundColor
4347
self.insets = insets
4448
self.titleColor = titleColor
4549
self.titleFont = titleFont

0 commit comments

Comments
 (0)