88
99import Foundation
1010
11-
11+ /// Internal AlertType protocol
1212internal protocol _AlertType : class {
13+ /// inner alertController
1314 var _alertController : InnerAlertController ! { get set }
1415}
1516
1617extension _AlertType where Self: AlertType {
18+ /// build AlertController
1719 func buildAlertControlelr( title: String ? = nil , message: String ? = nil , style: UIAlertControllerStyle ) {
1820 _alertController = InnerAlertController ( title: title, message: message, preferredStyle: style)
1921 _alertController. alertBackgroundColor = type ( of: self ) . backgroundColor
@@ -23,18 +25,29 @@ extension _AlertType where Self: AlertType {
2325 }
2426}
2527
28+ /// AlertType protocol
2629public protocol AlertType : class {
30+ /// UIAlertController
2731 var alertController : UIAlertController { get }
32+ /// default background color of Alert(ActionSheet).
2833 static var backgroundColor : UIColor ? { get set }
34+
35+ /// default button text color of Alert(ActionSheet).
2936 static var buttonTextColor : UIColor ? { get set }
37+
38+ /// default title text color of Alert(ActionSheet).
3039 static var titleTextColor : UIColor ? { get set }
40+
41+ /// default message text color of Alert(ActionSheet).
3142 static var messageTextColor : UIColor ? { get set }
3243}
3344
3445extension AlertType {
46+ /// get InnerAlertController.
3547 private var _alertController : InnerAlertController {
3648 return alertController as! InnerAlertController
3749 }
50+
3851 /// Build **UIAlertAction** using **Alertift.Action** and handler.
3952 ///
4053 /// - Parameters:
@@ -54,21 +67,37 @@ extension AlertType {
5467 return self
5568 }
5669
70+ /// Change background color
71+ ///
72+ /// - Parameter color: UIColor
73+ /// - Returns: Myself
5774 public func backgroundColor( _ color: UIColor ? ) -> Self {
5875 _alertController. alertBackgroundColor = color
5976 return self
6077 }
6178
62- public func buttonColor( _ color: UIColor ? ) -> Self {
79+ /// Change button text color
80+ ///
81+ /// - Parameter color: UIColor
82+ /// - Returns: Myself
83+ public func buttonTextColor( _ color: UIColor ? ) -> Self {
6384 _alertController. view. tintColor = color
6485 return self
6586 }
6687
88+ /// Change title text color
89+ ///
90+ /// - Parameter color: UIColor
91+ /// - Returns: Myself
6792 public func titleTextColor( _ color: UIColor ? ) -> Self {
6893 _alertController. titleTextColor = color
6994 return self
7095 }
7196
97+ /// Change message text color
98+ ///
99+ /// - Parameter color: UIColor
100+ /// - Returns: Myself
72101 public func messageTextColor( _ color: UIColor ? ) -> Self {
73102 _alertController. messageTextColor = color
74103 return self
0 commit comments