Renaming parameters in Notification component

This commit is contained in:
Sumanth Nadigadda 2023-03-30 23:13:32 +05:30
parent 7d14ab1f5c
commit fee33a17da

View File

@ -35,7 +35,7 @@ public class Notification: View {
} }
} }
public enum ButtonsPosition: String, CaseIterable { public enum ButtonsLayout: String, CaseIterable {
case bottom, right case bottom, right
} }
@ -138,15 +138,15 @@ public class Notification: View {
open var type: NotificationStyle = .info { didSet{didChange()}} open var type: NotificationStyle = .info { didSet{didChange()}}
var _buttonPosition: ButtonsPosition = .bottom var _layout: ButtonsLayout = .bottom
open var buttonPosition: ButtonsPosition { open var layout: ButtonsLayout {
set { set {
if !UIDevice.isIPad, newValue == .right { return } if !UIDevice.isIPad, newValue == .right { return }
_buttonPosition = newValue _layout = newValue
buttonsView.buttonPosition = _buttonPosition == .right ? .center : .left buttonsView.buttonPosition = _layout == .right ? .center : .left
didChange() didChange()
} }
get { _buttonPosition } get { _layout }
} }
//-------------------------------------------------- //--------------------------------------------------
@ -218,7 +218,7 @@ public class Notification: View {
type = .info type = .info
typeIcon.name = .infoBold typeIcon.name = .infoBold
closeButton.name = .close closeButton.name = .close
buttonPosition = .bottom layout = .bottom
} }
//-------------------------------------------------- //--------------------------------------------------
@ -281,7 +281,7 @@ public class Notification: View {
labelsView.setCustomSpacing(VDSLayout.Spacing.space3X.value, after: subTitleLabel) labelsView.setCustomSpacing(VDSLayout.Spacing.space3X.value, after: subTitleLabel)
buttonsView.buttons = buttons buttonsView.buttons = buttons
labelButtonView.axis = buttonPosition == .bottom ? .vertical : .horizontal labelButtonView.axis = layout == .bottom ? .vertical : .horizontal
labelButtonView.addArrangedSubview(buttonsView) labelButtonView.addArrangedSubview(buttonsView)
buttonsView buttonsView