From 5758d9f7137417faf2cd08afccd322367ad23e6c Mon Sep 17 00:00:00 2001 From: jalynneyoon Date: Mon, 23 Dec 2024 21:13:47 +0900 Subject: [PATCH 1/3] =?UTF-8?q?[MP-5326]=20Notice=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Notice/DealiNotice.swift | 139 ++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 Sources/DealiDesignKit/Components/Notice/DealiNotice.swift diff --git a/Sources/DealiDesignKit/Components/Notice/DealiNotice.swift b/Sources/DealiDesignKit/Components/Notice/DealiNotice.swift new file mode 100644 index 0000000..b844cc0 --- /dev/null +++ b/Sources/DealiDesignKit/Components/Notice/DealiNotice.swift @@ -0,0 +1,139 @@ +// +// DealiNotice.swift +// DealiDesignKit +// +// Created by JohyeonYoon on 12/23/24. +// + +import UIKit +//**TODO: @윤조현 창호님 작업 머지 후 변경 +public class LabeledText: UIView { + override init(frame: CGRect) { + super.init(frame: frame) + + let label = UILabel() + self.addSubview(label) + label.then { + $0.numberOfLines = 0 + $0.attributedText = NSMutableAttributedString(string: "내용 가나다라마바사아자차카타파하가나다라마바사아자차카타파하") + .font(.b3r13) + .color(.g80) + .setLineHeight() + }.snp.makeConstraints { + $0.edges.equalToSuperview() + } + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} + +public final class DealiNotice: UIView { + + public func setTextLinkButton(_ textLink: TextLink) { + self.textLinkButton = textLink + + self.addSubview(textLink) + textLink.snp.makeConstraints { + $0.left.greaterThanOrEqualTo(self.titleLabel.snp.right).offset(16.0) + $0.centerY.equalTo(self.titleLabel) + $0.left.right.equalToSuperview().inset(16.0) + } + } + + public var title: String? { + didSet { + self.titleLabel.text = title + } + } + + private let titleLabel = UILabel() + private var textLinkButton: TextLink? + private let contentView = UIView() + + override internal init(frame: CGRect) { + super.init(frame: frame) + + self.setUI() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + public func addContents(_ view: UIView) { + self.contentView.addSubview(view) + view.snp.makeConstraints { + $0.edges.equalToSuperview() + } + } + + public func addLabeledTexts(_ labeledTextArray: [LabeledText]) { + let stackView = UIStackView().then { + $0.axis = .vertical + $0.spacing = 8.0 + $0.isLayoutMarginsRelativeArrangement = true + $0.layoutMargins = UIEdgeInsets(top: 16.0, left: 16.0, bottom: 16.0, right: 16.0) + } + + for labeledText in labeledTextArray { + stackView.addArrangedSubview(labeledText) + } + + self.addContents(stackView) + } +} + +private extension DealiNotice { + func setUI() { + + self.backgroundColor = .g10 + self.layer.cornerRadius = 10.0 + self.layer.masksToBounds = true + + let titleView = self.titleView() + self.addSubview(titleView) + titleView.snp.makeConstraints { + $0.top.left.right.equalToSuperview().inset(16.0) + } + + let dividerView = UIView() + self.addSubview(dividerView) + dividerView.then { + $0.backgroundColor = .g30 + }.snp.makeConstraints { + $0.height.equalTo(1.0) + $0.left.right.equalToSuperview().inset(16.0) + $0.top.equalTo(titleView.snp.bottom).offset(16.0) + } + + self.addSubview(self.contentView) + self.contentView.snp.makeConstraints { + $0.top.equalTo(dividerView.snp.bottom) + $0.left.right.bottom.equalToSuperview() + } + } + + func titleView() -> UIView { + let titleContentView = UIView() + + let iconImageView = UIImageView() + titleContentView.addSubview(iconImageView) + iconImageView.then { + $0.image = UIImage.dealiIcon(named: "ic_notice") + }.snp.makeConstraints { + $0.left.centerY.equalToSuperview() + $0.size.equalTo(16.0) + } + + titleContentView.addSubview(self.titleLabel) + self.titleLabel.snp.makeConstraints { + $0.left.equalTo(iconImageView.snp.right).offset(8.0) + } + + return titleContentView + } + + +} From beb3d15adbb0a025b85cab44fbed53f6992ed5d8 Mon Sep 17 00:00:00 2001 From: Johyeon Yoon Date: Tue, 24 Dec 2024 16:03:29 +0900 Subject: [PATCH 2/3] =?UTF-8?q?[MP-5326]=20Notice=20=EC=83=98=ED=94=8C=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80,=20LabeledText=20=EB=8C=80=EC=9D=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project.pbxproj | 12 ++ .../ViewControllers/MainViewController.swift | 11 ++ .../Sub/Notice/NoticeViewController.swift | 126 ++++++++++++++++++ .../LabeledText/DealiLabeledTextView.swift | 4 + .../Components/Notice/DealiNotice.swift | 101 +++++++------- 5 files changed, 206 insertions(+), 48 deletions(-) create mode 100644 DealiDesignSystemSampleApp/DealiDesignSystemSampleApp/ViewControllers/Sub/Notice/NoticeViewController.swift diff --git a/DealiDesignSystemSampleApp/DealiDesignSystemSampleApp.xcodeproj/project.pbxproj b/DealiDesignSystemSampleApp/DealiDesignSystemSampleApp.xcodeproj/project.pbxproj index bb53d7d..aac7ebe 100644 --- a/DealiDesignSystemSampleApp/DealiDesignSystemSampleApp.xcodeproj/project.pbxproj +++ b/DealiDesignSystemSampleApp/DealiDesignSystemSampleApp.xcodeproj/project.pbxproj @@ -36,6 +36,7 @@ 4D1FA9292AFC778E00AA510F /* SwitchViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D1FA9282AFC778E00AA510F /* SwitchViewController.swift */; }; 4D5326D52AB15FFF00A9509A /* ButtonViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D5326D42AB15FFF00A9509A /* ButtonViewController.swift */; }; 4D58315E2B033EC4009F7B48 /* SliderBarViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D58315D2B033EC4009F7B48 /* SliderBarViewController.swift */; }; + 4D584A1E2D1A82BF007BB775 /* NoticeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D584A1D2D1A82BF007BB775 /* NoticeViewController.swift */; }; 4D96495B2BDA227D00AC1BDE /* RxKeyboard in Frameworks */ = {isa = PBXBuildFile; productRef = 4D96495A2BDA227D00AC1BDE /* RxKeyboard */; }; 4DB2D6F42AFB281100DFF053 /* BottomSheetViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4DB2D6F32AFB281100DFF053 /* BottomSheetViewController.swift */; }; 4DE326202CDB61CF00E67FEC /* ImageChipViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4DE3261F2CDB61CF00E67FEC /* ImageChipViewController.swift */; }; @@ -82,6 +83,7 @@ 4D1FA9282AFC778E00AA510F /* SwitchViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwitchViewController.swift; sourceTree = ""; }; 4D5326D42AB15FFF00A9509A /* ButtonViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonViewController.swift; sourceTree = ""; }; 4D58315D2B033EC4009F7B48 /* SliderBarViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SliderBarViewController.swift; sourceTree = ""; }; + 4D584A1D2D1A82BF007BB775 /* NoticeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoticeViewController.swift; sourceTree = ""; }; 4DB2D6F32AFB281100DFF053 /* BottomSheetViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BottomSheetViewController.swift; sourceTree = ""; }; 4DE3261F2CDB61CF00E67FEC /* ImageChipViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageChipViewController.swift; sourceTree = ""; }; 4DF5ABEA2CC25E1300BFB7D6 /* ColorItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColorItemView.swift; sourceTree = ""; }; @@ -202,6 +204,7 @@ 4D1FA9272AFC740000AA510F /* Sub */ = { isa = PBXGroup; children = ( + 4D584A1C2D1A82A1007BB775 /* Notice */, FC0838852D06C0B70028AE27 /* TextLink */, 4DF5ABE82CC25C2300BFB7D6 /* Color */, 4DE3261E2CDB611400E67FEC /* ImageChip */, @@ -232,6 +235,14 @@ path = Sub; sourceTree = ""; }; + 4D584A1C2D1A82A1007BB775 /* Notice */ = { + isa = PBXGroup; + children = ( + 4D584A1D2D1A82BF007BB775 /* NoticeViewController.swift */, + ); + path = Notice; + sourceTree = ""; + }; 4DE3261E2CDB611400E67FEC /* ImageChip */ = { isa = PBXGroup; children = ( @@ -372,6 +383,7 @@ 3990E48D2CC61E90007C2D9E /* LabeledTextComponentViewController.swift in Sources */, FC0838872D06C0DB0028AE27 /* TextLinkViewController.swift in Sources */, 392C38A22C467A540088D176 /* DropdownViewController.swift in Sources */, + 4D584A1E2D1A82BF007BB775 /* NoticeViewController.swift in Sources */, FC52E5FF2AA0315B00CADB39 /* RadioButtonViewController.swift in Sources */, 396EF4C22BDA04EE006CEF43 /* SearchInputViewController.swift in Sources */, 042EA8A92A14C7D500370706 /* AppDelegate.swift in Sources */, diff --git a/DealiDesignSystemSampleApp/DealiDesignSystemSampleApp/ViewControllers/MainViewController.swift b/DealiDesignSystemSampleApp/DealiDesignSystemSampleApp/ViewControllers/MainViewController.swift index 8330b36..7b6f9d9 100644 --- a/DealiDesignSystemSampleApp/DealiDesignSystemSampleApp/ViewControllers/MainViewController.swift +++ b/DealiDesignSystemSampleApp/DealiDesignSystemSampleApp/ViewControllers/MainViewController.swift @@ -205,6 +205,13 @@ final class MainViewController: UIViewController { $0.title = "Accordion Components" $0.addTarget(self, action: #selector(accordionComponentsPressed), for: .touchUpInside) } + + let noticeComponents = DealiControl.btnOutlineLarge03() + contentStackView.addArrangedSubview(noticeComponents) + noticeComponents.do { + $0.title = "Notice Components" + $0.addTarget(self, action: #selector(noticeComponentsPressed), for: .touchUpInside) + } } override func viewDidLoad() { @@ -308,4 +315,8 @@ extension MainViewController { @objc func accordionComponentsPressed() { self.navigationController?.pushViewController(AccordionComponentViewController(), animated: true) } + + @objc func noticeComponentsPressed() { + self.navigationController?.pushViewController(NoticeViewController(), animated: true) + } } diff --git a/DealiDesignSystemSampleApp/DealiDesignSystemSampleApp/ViewControllers/Sub/Notice/NoticeViewController.swift b/DealiDesignSystemSampleApp/DealiDesignSystemSampleApp/ViewControllers/Sub/Notice/NoticeViewController.swift new file mode 100644 index 0000000..5206314 --- /dev/null +++ b/DealiDesignSystemSampleApp/DealiDesignSystemSampleApp/ViewControllers/Sub/Notice/NoticeViewController.swift @@ -0,0 +1,126 @@ +// +// NoticeViewController.swift +// DealiDesignSystemSampleApp +// +// Created by 윤조현 on 12/24/24. +// Copyright © 2024 Dealicious Inc. All rights reserved. +// + +import UIKit +import DealiDesignKit + +final class NoticeViewController: UIViewController { + + private let noticeView = DealiNotice() + + private let noticeViewWithTitle = DealiNotice() + private let noticeViewWithLabeledTexts = DealiNotice() + private let noticeViewWithLabeledTextGroup = DealiNotice() + + override func loadView() { + self.view = .init() + + self.setUI() + } + + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + } + +} + +private extension NoticeViewController { + func setUI() { + self.view.backgroundColor = .primary04 + + let contentScrollView = UIScrollView() + self.view.addSubview(contentScrollView) + contentScrollView.then { + $0.bounces = false + }.snp.makeConstraints { + $0.edges.equalToSuperview() + } + + let contentView = UIView() + contentScrollView.addSubview(contentView) + contentView.then { + $0.backgroundColor = .clear + }.snp.makeConstraints { + $0.edges.equalToSuperview() + $0.width.equalToSuperview() + } + + let customBodyView = UIView().then { + $0.backgroundColor = .success + } + + contentView.addSubview(noticeView) + noticeView.then { + $0.setTextLinkButton(DealiControl.textLinkSmall01().then { + $0.title = ("TextLink") + }) + + $0.addContents(customBodyView) { + $0.edges.equalToSuperview().inset(16.0) + $0.height.equalTo(200.0) + } + }.snp.makeConstraints { + $0.top.left.right.equalToSuperview().inset(16.0) + } + + contentView.addSubview(noticeViewWithTitle) + noticeViewWithTitle.then { + $0.title = "Notice with Custom Body" + $0.setTextLinkButton(DealiControl.textLinkSmall01().then { + $0.title = ("TextLink") + }) + + $0.addContents(customBodyView) { + $0.edges.equalToSuperview().inset(16.0) + $0.height.equalTo(200.0) + } + }.snp.makeConstraints { + $0.top.equalTo(noticeView.snp.bottom).offset(16.0) + $0.left.right.equalToSuperview().inset(16.0) + } + + + let labeledTextViewModel: [DealiLabeledTextModel] = [ + DealiLabeledTextModel(message: "내용 가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하"), + DealiLabeledTextModel(message: "내용 가나다라마바사아자차카타파하가나다라마바사아자차카타파하가나다라마바사아자차카타파하 하하하"), + ] + + let labeledTextViews = labeledTextViewModel.enumerated().map { (index, model) in + if index == 0 { + return DealiLabeledTextView(preset: .labeledTextBullet01, model: model) + + } + return DealiLabeledTextView(preset: .labeledTextBullet02, model: model) + } + + contentView.addSubview(noticeViewWithLabeledTexts) + noticeViewWithLabeledTexts.then { + $0.title = "Notice with LabeledText Array" + $0.addLabeledTexts(labeledTextViews) + }.snp.makeConstraints { + $0.left.right.equalToSuperview().inset(16.0) + $0.top.equalTo(noticeViewWithTitle.snp.bottom).offset(16.0) + } + + let labeledTextGroupView = DealiLabeledText.labeledTextNumber01().then { + $0.configure(modelArray: labeledTextViewModel) + } + + contentView.addSubview(noticeViewWithLabeledTextGroup) + noticeViewWithLabeledTextGroup.then { + $0.title = "Notice with LabeledText Group" + $0.addLabeledTextGroup(labeledTextGroupView) + }.snp.makeConstraints { + $0.left.right.equalToSuperview().inset(16.0) + $0.top.equalTo(noticeViewWithLabeledTexts.snp.bottom).offset(16.0) + } + + } +} diff --git a/Sources/DealiDesignKit/Components/LabeledText/DealiLabeledTextView.swift b/Sources/DealiDesignKit/Components/LabeledText/DealiLabeledTextView.swift index 2f79331..563ac42 100644 --- a/Sources/DealiDesignKit/Components/LabeledText/DealiLabeledTextView.swift +++ b/Sources/DealiDesignKit/Components/LabeledText/DealiLabeledTextView.swift @@ -130,4 +130,8 @@ final public class DealiLabeledTextView: UIView { self.labeledCustomView = model.labeledCustomView } + public convenience init(preset: DealiLabeledTextPreset, model: DealiLabeledTextModel) { + self.init(preset: preset) + self.configure(model: model) + } } diff --git a/Sources/DealiDesignKit/Components/Notice/DealiNotice.swift b/Sources/DealiDesignKit/Components/Notice/DealiNotice.swift index b844cc0..bc3fd95 100644 --- a/Sources/DealiDesignKit/Components/Notice/DealiNotice.swift +++ b/Sources/DealiDesignKit/Components/Notice/DealiNotice.swift @@ -6,28 +6,7 @@ // import UIKit -//**TODO: @윤조현 창호님 작업 머지 후 변경 -public class LabeledText: UIView { - override init(frame: CGRect) { - super.init(frame: frame) - - let label = UILabel() - self.addSubview(label) - label.then { - $0.numberOfLines = 0 - $0.attributedText = NSMutableAttributedString(string: "내용 가나다라마바사아자차카타파하가나다라마바사아자차카타파하") - .font(.b3r13) - .color(.g80) - .setLineHeight() - }.snp.makeConstraints { - $0.edges.equalToSuperview() - } - } - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } -} +import SnapKit public final class DealiNotice: UIView { @@ -38,13 +17,21 @@ public final class DealiNotice: UIView { textLink.snp.makeConstraints { $0.left.greaterThanOrEqualTo(self.titleLabel.snp.right).offset(16.0) $0.centerY.equalTo(self.titleLabel) - $0.left.right.equalToSuperview().inset(16.0) + $0.right.equalToSuperview().inset(16.0) } } public var title: String? { didSet { - self.titleLabel.text = title + self.titleContentView.isHidden = title == nil + + guard let title else { return } + let attributedTitle = NSMutableAttributedString(string: title) + .font(.b2sb14) + .color(.g100) + .setLineHeight() + + self.titleLabel.attributedText = attributedTitle } } @@ -52,6 +39,7 @@ public final class DealiNotice: UIView { private var textLinkButton: TextLink? private let contentView = UIView() + private var titleContentView = UIView() override internal init(frame: CGRect) { super.init(frame: frame) @@ -62,14 +50,25 @@ public final class DealiNotice: UIView { fatalError("init(coder:) has not been implemented") } - public func addContents(_ view: UIView) { + public func addContents(_ view: UIView, layout: ((_ make: ConstraintMaker) -> Void)? = nil) { self.contentView.addSubview(view) - view.snp.makeConstraints { - $0.edges.equalToSuperview() + + if let layout { + view.snp.makeConstraints(layout) + } else { + view.snp.makeConstraints { + $0.edges.equalToSuperview() + } } } - public func addLabeledTexts(_ labeledTextArray: [LabeledText]) { + public func addLabeledTextGroup(_ group: DealiLabeledTextGroupView) { + self.addContents(group) { + $0.edges.equalToSuperview().inset(16.0) + } + } + + public func addLabeledTexts(_ labeledTextArray: [DealiLabeledTextView]) { let stackView = UIStackView().then { $0.axis = .vertical $0.spacing = 8.0 @@ -92,27 +91,22 @@ private extension DealiNotice { self.layer.cornerRadius = 10.0 self.layer.masksToBounds = true - let titleView = self.titleView() - self.addSubview(titleView) - titleView.snp.makeConstraints { - $0.top.left.right.equalToSuperview().inset(16.0) + let stackView = UIStackView().then { + $0.axis = .vertical + $0.spacing = 0.0 } - let dividerView = UIView() - self.addSubview(dividerView) - dividerView.then { - $0.backgroundColor = .g30 - }.snp.makeConstraints { - $0.height.equalTo(1.0) - $0.left.right.equalToSuperview().inset(16.0) - $0.top.equalTo(titleView.snp.bottom).offset(16.0) + self.addSubview(stackView) + stackView.snp.makeConstraints { + $0.edges.equalToSuperview() } - - self.addSubview(self.contentView) - self.contentView.snp.makeConstraints { - $0.top.equalTo(dividerView.snp.bottom) - $0.left.right.bottom.equalToSuperview() + + self.titleContentView = self.titleView().then { + $0.isHidden = true } + + stackView.addArrangedSubview(self.titleContentView) + stackView.addArrangedSubview(self.contentView) } func titleView() -> UIView { @@ -123,17 +117,28 @@ private extension DealiNotice { iconImageView.then { $0.image = UIImage.dealiIcon(named: "ic_notice") }.snp.makeConstraints { - $0.left.centerY.equalToSuperview() + $0.left.equalToSuperview().inset(16.0) + $0.centerY.equalToSuperview() $0.size.equalTo(16.0) } titleContentView.addSubview(self.titleLabel) self.titleLabel.snp.makeConstraints { + $0.top.bottom.equalToSuperview().inset(16.0) $0.left.equalTo(iconImageView.snp.right).offset(8.0) + $0.centerY.equalToSuperview() + } + + let dividerView = UIView() + titleContentView.addSubview(dividerView) + dividerView.then { + $0.backgroundColor = .g30 + }.snp.makeConstraints { + $0.height.equalTo(1.0) + $0.left.right.equalToSuperview().inset(16.0) + $0.bottom.equalToSuperview() } return titleContentView } - - } From 63798d000f02be7728f4ed44e4ccb2509f98e046 Mon Sep 17 00:00:00 2001 From: jalynneyoon Date: Thu, 2 Jan 2025 18:43:18 +0900 Subject: [PATCH 3/3] =?UTF-8?q?[MP-5326]=20=EC=97=AC=EB=9F=AC=20LabeledTex?= =?UTF-8?q?tGroups=20=EB=A5=BC=20=EB=B0=9B=EC=9D=84=20=EC=88=98=20?= =?UTF-8?q?=EC=9E=88=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sub/Notice/NoticeViewController.swift | 2 +- .../Components/Notice/DealiNotice.swift | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/DealiDesignSystemSampleApp/DealiDesignSystemSampleApp/ViewControllers/Sub/Notice/NoticeViewController.swift b/DealiDesignSystemSampleApp/DealiDesignSystemSampleApp/ViewControllers/Sub/Notice/NoticeViewController.swift index 5206314..af86755 100644 --- a/DealiDesignSystemSampleApp/DealiDesignSystemSampleApp/ViewControllers/Sub/Notice/NoticeViewController.swift +++ b/DealiDesignSystemSampleApp/DealiDesignSystemSampleApp/ViewControllers/Sub/Notice/NoticeViewController.swift @@ -116,7 +116,7 @@ private extension NoticeViewController { contentView.addSubview(noticeViewWithLabeledTextGroup) noticeViewWithLabeledTextGroup.then { $0.title = "Notice with LabeledText Group" - $0.addLabeledTextGroup(labeledTextGroupView) + $0.addLabeledTextGroups(labeledTextGroupView) }.snp.makeConstraints { $0.left.right.equalToSuperview().inset(16.0) $0.top.equalTo(noticeViewWithLabeledTexts.snp.bottom).offset(16.0) diff --git a/Sources/DealiDesignKit/Components/Notice/DealiNotice.swift b/Sources/DealiDesignKit/Components/Notice/DealiNotice.swift index bc3fd95..ee48325 100644 --- a/Sources/DealiDesignKit/Components/Notice/DealiNotice.swift +++ b/Sources/DealiDesignKit/Components/Notice/DealiNotice.swift @@ -62,10 +62,19 @@ public final class DealiNotice: UIView { } } - public func addLabeledTextGroup(_ group: DealiLabeledTextGroupView) { - self.addContents(group) { - $0.edges.equalToSuperview().inset(16.0) + public func addLabeledTextGroups(_ groups: DealiLabeledTextGroupView..., spacing: CGFloat = 8.0) { + let stackView = UIStackView().then { + $0.axis = .vertical + $0.spacing = spacing + $0.isLayoutMarginsRelativeArrangement = true + $0.layoutMargins = UIEdgeInsets(top: 16.0, left: 16.0, bottom: 16.0, right: 16.0) } + + for group in groups { + stackView.addArrangedSubview(group) + } + + self.addContents(stackView) } public func addLabeledTexts(_ labeledTextArray: [DealiLabeledTextView]) {