File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed
Sources/ComponentsKit/Components/Alert Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -66,7 +66,12 @@ extension AlertVM {
6666 }
6767
6868 var primaryButtonVM : ButtonVM ? {
69- return self . primaryButton. map ( self . mapAlertButtonVM)
69+ let buttonVM = self . primaryButton. map ( self . mapAlertButtonVM)
70+ if self . secondaryButton. isNotNil {
71+ return buttonVM
72+ } else {
73+ return buttonVM ?? Self . defaultButtonVM
74+ }
7075 }
7176
7277 var secondaryButtonVM : ButtonVM ? {
Original file line number Diff line number Diff line change @@ -91,14 +91,11 @@ public class UKAlertController: UKCenterModalController {
9191 }
9292 self . footer = self . buttonsStackView
9393
94- switch ( self . alertVM. primaryButton. isNotNil, self . alertVM. secondaryButton. isNotNil) {
95- case ( true , true ) :
94+ if self . alertVM. primaryButtonVM. isNotNil {
9695 self . buttonsStackView. addArrangedSubview ( self . primaryButton)
96+ }
97+ if self . alertVM. secondaryButtonVM. isNotNil {
9798 self . buttonsStackView. addArrangedSubview ( self . secondaryButton)
98- case ( false , true ) :
99- self . buttonsStackView. addArrangedSubview ( self . secondaryButton)
100- case ( _, false ) :
101- self . buttonsStackView. addArrangedSubview ( self . primaryButton)
10299 }
103100
104101 self . primaryButton. action = { [ weak self] in
@@ -128,7 +125,6 @@ public class UKAlertController: UKCenterModalController {
128125 if let primaryButtonVM = self . alertVM. primaryButtonVM {
129126 self . primaryButton. model = primaryButtonVM
130127 }
131- self . primaryButton. model = self . alertVM. primaryButtonVM ?? AlertVM . defaultButtonVM
132128 if let secondaryButtonVM = self . alertVM. secondaryButtonVM {
133129 self . secondaryButton. model = secondaryButtonVM
134130 }
You can’t perform that action at this time.
0 commit comments