@@ -45,11 +45,13 @@ class ActionSheetViewController: UIViewController {
4545 }
4646 }
4747
48+ let headerView : UIView ?
4849 let buttons : [ ActionSheetButton ]
49- let headerTitle : String
50+ let buttonHeaderTitle : String
5051
51- init ( headerTitle: String , buttons: [ ActionSheetButton ] ) {
52- self . headerTitle = headerTitle
52+ init ( headerView: UIView ? = nil , buttonHeaderTitle: String , buttons: [ ActionSheetButton ] ) {
53+ self . headerView = headerView
54+ self . buttonHeaderTitle = buttonHeaderTitle
5355 self . buttons = buttons
5456 super. init ( nibName: nil , bundle: nil )
5557 }
@@ -83,7 +85,7 @@ class ActionSheetViewController: UIViewController {
8385 headerLabelView. pinSubviewToAllEdges ( headerLabel, insets: Constants . Header. insets)
8486
8587 headerLabel. font = WPStyleGuide . fontForTextStyle ( . headline)
86- headerLabel. text = headerTitle
88+ headerLabel. text = buttonHeaderTitle
8789 headerLabel. translatesAutoresizingMaskIntoConstraints = false
8890
8991 let buttonViews = buttons. map ( { ( buttonInfo) -> UIButton in
@@ -100,10 +102,13 @@ class ActionSheetViewController: UIViewController {
100102
101103 NSLayoutConstraint . activate ( buttonConstraints)
102104
103- let stackView = UIStackView ( arrangedSubviews: [
104- gripButton,
105- headerLabelView
106- ] + buttonViews)
105+ let stackView = UIStackView ( arrangedSubviews: [ gripButton] )
106+
107+ if let headerView = headerView {
108+ stackView. addArrangedSubview ( headerView)
109+ }
110+
111+ stackView. addArrangedSubviews ( [ headerLabelView] + buttonViews)
107112
108113 stackView. setCustomSpacing ( Constants . Header. spacing, after: gripButton)
109114 stackView. setCustomSpacing ( Constants . Header. spacing, after: headerLabelView)
0 commit comments