@@ -55,7 +55,7 @@ private enum STAlertLayoutConstant {
5555 static let titleMessageSpacing : CGFloat = 10
5656}
5757
58- public enum STAlertBtnClickType {
58+ public enum STAlertBtnClickType : String {
5959 case btnClick
6060 case leftBtnClick
6161 case rightBtnClick
@@ -300,7 +300,7 @@ open class STAlertController: UIViewController {
300300 handler ( true , sender. titleLabel? . text ?? " " )
301301 }
302302 } else {
303- if let type = sender. identifier as? STAlertBtnClickType , type == . leftBtnClick {
303+ if sender. stringIdentifier == STAlertBtnClickType . leftBtnClick. rawValue {
304304 if let handler = self . alertInfo. buttonHandlers. first {
305305 handler ( true , sender. titleLabel? . text ?? " " )
306306 }
@@ -335,7 +335,7 @@ open class STAlertController: UIViewController {
335335 } ( )
336336 let btn = self . createBtn ( action: singleAction)
337337 btn. tag = 0
338- btn. identifier = STAlertBtnClickType . btnClick
338+ btn. stringIdentifier = STAlertBtnClickType . btnClick. rawValue
339339 btn. addTarget ( self , action: #selector( alertButtonClick) , for: . touchUpInside)
340340 self . alertView. addSubview ( btn)
341341 self . view. addConstraints ( [
@@ -370,7 +370,7 @@ open class STAlertController: UIViewController {
370370 } ( )
371371 let leftBtn = self . createBtn ( action: leftAction)
372372 leftBtn. tag = 0
373- leftBtn. identifier = STAlertBtnClickType . leftBtnClick
373+ leftBtn. stringIdentifier = STAlertBtnClickType . leftBtnClick. rawValue
374374 leftBtn. addTarget ( self , action: #selector( alertButtonClick) , for: . touchUpInside)
375375 self . alertView. addSubview ( leftBtn)
376376
@@ -390,7 +390,7 @@ open class STAlertController: UIViewController {
390390 } ( )
391391 let rightBtn = self . createBtn ( action: rightAction)
392392 rightBtn. tag = 1
393- rightBtn. identifier = STAlertBtnClickType . rightBtnClick
393+ rightBtn. stringIdentifier = STAlertBtnClickType . rightBtnClick. rawValue
394394 rightBtn. addTarget ( self , action: #selector( alertButtonClick) , for: . touchUpInside)
395395 self . alertView. addSubview ( rightBtn)
396396 self . view. addConstraints ( [
0 commit comments