@@ -184,7 +184,6 @@ open class STAlertController: UIViewController {
184184
185185 /// 是否在点击动作后自动关闭,默认 true
186186 @available ( * , deprecated, renamed: " setAutoDismiss(_:) " )
187- // swiftlint:disable:next st_avoid_bool_flag_param
188187 public func setAutoDismissOnAction( _ enabled: Bool ) {
189188 self . autoDismissOnAction = enabled
190189 }
@@ -250,7 +249,7 @@ open class STAlertController: UIViewController {
250249 ] . compactMap { $0 } )
251250 }
252251
253- if self . alertInfo. title. text != " " && self . alertInfo. message. text != " " {
252+ if ! self . alertInfo. title. text. isEmpty && ! self . alertInfo. message. text. isEmpty {
254253 self . titleLabel. text = self . alertInfo. title. text
255254 self . messageLabel. text = self . alertInfo. message. text
256255 self . alertView. addSubview ( self . titleLabel)
@@ -265,15 +264,15 @@ open class STAlertController: UIViewController {
265264 NSLayoutConstraint ( item: self . messageLabel, attribute: . left, relatedBy: . equal, toItem: self . titleLabel, attribute: . left, multiplier: 1 , constant: STAlertLayoutConstant . contentHorizontal) ,
266265 NSLayoutConstraint ( item: self . messageLabel, attribute: . right, relatedBy: . equal, toItem: self . titleLabel, attribute: . right, multiplier: 1 , constant: - STAlertLayoutConstant. contentHorizontal)
267266 ] )
268- } else if self . alertInfo. title. text != " " && self . alertInfo. message. text == " " {
267+ } else if ! self . alertInfo. title. text. isEmpty && self . alertInfo. message. text. isEmpty {
269268 self . titleLabel. text = self . alertInfo. title. text
270269 self . alertView. addSubview ( self . titleLabel)
271270 self . view. addConstraints ( [
272271 NSLayoutConstraint ( item: self . titleLabel, attribute: . top, relatedBy: . equal, toItem: self . alertView, attribute: . top, multiplier: 1 , constant: STAlertLayoutConstant . contentTop) ,
273272 NSLayoutConstraint ( item: self . titleLabel, attribute: . left, relatedBy: . equal, toItem: self . alertView, attribute: . left, multiplier: 1 , constant: STAlertLayoutConstant . contentHorizontal) ,
274273 NSLayoutConstraint ( item: self . titleLabel, attribute: . right, relatedBy: . equal, toItem: self . alertView, attribute: . right, multiplier: 1 , constant: - STAlertLayoutConstant. contentHorizontal)
275274 ] )
276- } else if self . alertInfo. title. text == " " && self . alertInfo. message. text != " " {
275+ } else if self . alertInfo. title. text. isEmpty && ! self . alertInfo. message. text. isEmpty {
277276 self . messageLabel. text = self . alertInfo. message. text
278277 self . alertView. addSubview ( self . messageLabel)
279278 self . view. addConstraints ( [
@@ -420,9 +419,9 @@ open class STAlertController: UIViewController {
420419 ] )
421420 }
422421 self . view. layoutIfNeeded ( )
423- if self . alertInfo. message. text != " " {
422+ if ! self . alertInfo. message. text. isEmpty {
424423 self . newConstraint? . constant = self . messageLabel. frame. maxY + 54
425- } else if self . alertInfo. title. text != " " {
424+ } else if ! self . alertInfo. title. text. isEmpty {
426425 self . newConstraint? . constant = self . titleLabel. frame. maxY + 54
427426 }
428427 UIView . animate ( withDuration: 0.3 ) {
0 commit comments