From ef53ffa4adf118af454988b2c6fa11133a5bec18 Mon Sep 17 00:00:00 2001 From: jeongdung-eo Date: Sun, 14 Jul 2024 09:52:47 +0900 Subject: [PATCH 1/4] =?UTF-8?q?[Feat]=20#279=20-=20GBStackView=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GEON-PPANG-iOS.xcodeproj/project.pbxproj | 12 ++++ .../View/StackView/GBStackView.swift | 59 +++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 GEON-PPANG-iOS/Core/DesignSystem/UIComponents/View/StackView/GBStackView.swift diff --git a/GEON-PPANG-iOS.xcodeproj/project.pbxproj b/GEON-PPANG-iOS.xcodeproj/project.pbxproj index 26c95b75..482a2cf8 100644 --- a/GEON-PPANG-iOS.xcodeproj/project.pbxproj +++ b/GEON-PPANG-iOS.xcodeproj/project.pbxproj @@ -28,6 +28,7 @@ 0915C1722A5C3D3700ACB8D4 /* PaddingLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0915C1712A5C3D3700ACB8D4 /* PaddingLabel.swift */; }; 0915C1752A5C533900ACB8D4 /* HomeReviewCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0915C1742A5C533900ACB8D4 /* HomeReviewCollectionViewCell.swift */; }; 0924632F2A5BA0F200B6F65D /* HomeBakeryCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0924632E2A5BA0F200B6F65D /* HomeBakeryCollectionViewCell.swift */; }; + 0926989E2C3EB19600A9349D /* GBStackView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0926989D2C3EB19600A9349D /* GBStackView.swift */; }; 092EFCA42A6195D900E7C262 /* CommonTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 092EFCA32A6195D900E7C262 /* CommonTextView.swift */; }; 0930D25B2A928B8000A75C7E /* CertificationMarkResponseType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0930D25A2A928B8000A75C7E /* CertificationMarkResponseType.swift */; }; 0930D25D2A928BF200A75C7E /* NearStationResponseDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0930D25C2A928BF200A75C7E /* NearStationResponseDTO.swift */; }; @@ -283,6 +284,7 @@ 0915C1742A5C533900ACB8D4 /* HomeReviewCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeReviewCollectionViewCell.swift; sourceTree = ""; }; 091AFD412ABD79380001DD02 /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Settings.bundle; sourceTree = ""; }; 0924632E2A5BA0F200B6F65D /* HomeBakeryCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeBakeryCollectionViewCell.swift; sourceTree = ""; }; + 0926989D2C3EB19600A9349D /* GBStackView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GBStackView.swift; sourceTree = ""; }; 092EFCA32A6195D900E7C262 /* CommonTextView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommonTextView.swift; sourceTree = ""; }; 0930D25A2A928B8000A75C7E /* CertificationMarkResponseType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CertificationMarkResponseType.swift; sourceTree = ""; }; 0930D25C2A928BF200A75C7E /* NearStationResponseDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NearStationResponseDTO.swift; sourceTree = ""; }; @@ -584,6 +586,14 @@ path = Label; sourceTree = ""; }; + 0926989C2C3EB18600A9349D /* StackView */ = { + isa = PBXGroup; + children = ( + 0926989D2C3EB19600A9349D /* GBStackView.swift */, + ); + path = StackView; + sourceTree = ""; + }; 092F11B12A69A6CC00852CA5 /* Cell */ = { isa = PBXGroup; children = ( @@ -1158,6 +1168,7 @@ 3E2A0B822BE72373004F8D6B /* View */ = { isa = PBXGroup; children = ( + 0926989C2C3EB18600A9349D /* StackView */, 0989547B2C1C07B30000D650 /* TextField */, 3E2A0B832BE74E49004F8D6B /* Chip */, ); @@ -2228,6 +2239,7 @@ 3EAC950D2A9FAF4500D2AADC /* WebViewController.swift in Sources */, 3ED40E002A608B4700C7D5DA /* MyPageBasicCell.swift in Sources */, 09E445392AA3BA07008E3D33 /* SortBakeryFilterView.swift in Sources */, + 0926989E2C3EB19600A9349D /* GBStackView.swift in Sources */, 3E06F8D92A9E1588001302F4 /* AlertViewController.swift in Sources */, 3EF9F8A82BBD116F00F3E366 /* DummyResDTO.swift in Sources */, 097682E52A5C99340008F4FB /* BakeryFilterItems.swift in Sources */, diff --git a/GEON-PPANG-iOS/Core/DesignSystem/UIComponents/View/StackView/GBStackView.swift b/GEON-PPANG-iOS/Core/DesignSystem/UIComponents/View/StackView/GBStackView.swift new file mode 100644 index 00000000..58e59fc5 --- /dev/null +++ b/GEON-PPANG-iOS/Core/DesignSystem/UIComponents/View/StackView/GBStackView.swift @@ -0,0 +1,59 @@ +// +// GBStackView.swift +// GEON-PPANG-iOS +// +// Created by JEONGEUN KIM on 7/10/24. +// + +import UIKit + +enum GBStackType { + case big + case small + + var images: [UIImage] { + switch self { + case .big: return [.haccpMark28px, .veganMark28px, .gmoMark28px] + case .small: return [.haccpMark22px, .veganMark22px, .gmoMark22px] + } + } + + var size: Int { + switch self { + case .big: return 28 + case .small: return 24 + } + } +} + +final class GBStackView: UIStackView { + + init(type: GBStackType, data: [Bool]) { + super.init(frame: .zero) + setUI() + addCertifiedImageViews(type: type, data: data) + } + + required init(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + private func setUI() { + axis = .horizontal + spacing = -8 + } + + private func addCertifiedImageViews(type: GBStackType, data: [Bool]) { + data.enumerated() + .filter { $0.element } + .map { $0.offset } + .forEach { index in + let imageView = UIImageView(image: type.images[index]) + imageView.contentMode = .topLeft + addArrangedSubview(imageView) + imageView.snp.makeConstraints { + $0.size.equalTo(type.size) + } + } + } +} From 8d4ef5bcc6f23ec3197f218372487822bc5abc08 Mon Sep 17 00:00:00 2001 From: jeongdung-eo Date: Fri, 19 Jul 2024 15:22:53 +0900 Subject: [PATCH 2/4] =?UTF-8?q?[Fix]=20#279=20-=20=EC=BD=94=EB=93=9C?= =?UTF-8?q?=EB=A6=AC=EB=B7=B0=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xcshareddata/swiftpm/Package.resolved | 104 ++++++++++++++++++ .../View/StackView/GBStackView.swift | 4 +- 2 files changed, 106 insertions(+), 2 deletions(-) create mode 100644 GEON-PPANG-iOS.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved diff --git a/GEON-PPANG-iOS.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/GEON-PPANG-iOS.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved new file mode 100644 index 00000000..70ac360e --- /dev/null +++ b/GEON-PPANG-iOS.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,104 @@ +{ + "pins" : [ + { + "identity" : "alamofire", + "kind" : "remoteSourceControl", + "location" : "https://github.com/Alamofire/Alamofire.git", + "state" : { + "revision" : "f455c2975872ccd2d9c81594c658af65716e9b9a", + "version" : "5.9.1" + } + }, + { + "identity" : "amplitude-ios", + "kind" : "remoteSourceControl", + "location" : "https://github.com/amplitude/Amplitude-iOS", + "state" : { + "branch" : "main", + "revision" : "bfdec453a31fd35942a619ef472fcf2f09e2313a" + } + }, + { + "identity" : "analytics-connector-ios", + "kind" : "remoteSourceControl", + "location" : "https://github.com/amplitude/analytics-connector-ios.git", + "state" : { + "revision" : "e2ca17ac735bcbc48b13062484541702ef45153d", + "version" : "1.0.3" + } + }, + { + "identity" : "kakao-ios-sdk", + "kind" : "remoteSourceControl", + "location" : "https://github.com/kakao/kakao-ios-sdk", + "state" : { + "revision" : "08089eeffc9b442da1c7343a70bf66c6de1a72c9", + "version" : "2.22.4" + } + }, + { + "identity" : "kingfisher", + "kind" : "remoteSourceControl", + "location" : "https://github.com/onevcat/Kingfisher.git", + "state" : { + "revision" : "2ef543ee21d63734e1c004ad6c870255e8716c50", + "version" : "7.12.0" + } + }, + { + "identity" : "moya", + "kind" : "remoteSourceControl", + "location" : "https://github.com/Moya/Moya", + "state" : { + "branch" : "master", + "revision" : "10a9dd1577c4de5135a29f99410863d2e9ee034a" + } + }, + { + "identity" : "reactiveswift", + "kind" : "remoteSourceControl", + "location" : "https://github.com/ReactiveCocoa/ReactiveSwift.git", + "state" : { + "revision" : "c43bae3dac73fdd3cb906bd5a1914686ca71ed3c", + "version" : "6.7.0" + } + }, + { + "identity" : "rxswift", + "kind" : "remoteSourceControl", + "location" : "https://github.com/ReactiveX/RxSwift.git", + "state" : { + "revision" : "b06a8c8596e4c3e8e7788e08e720e3248563ce6a", + "version" : "6.7.1" + } + }, + { + "identity" : "sentry-cocoa", + "kind" : "remoteSourceControl", + "location" : "https://github.com/getsentry/sentry-cocoa.git", + "state" : { + "revision" : "7339fcbab2ded21fe5753687022f2b673a1a1865", + "version" : "8.31.1" + } + }, + { + "identity" : "snapkit", + "kind" : "remoteSourceControl", + "location" : "https://github.com/SnapKit/SnapKit", + "state" : { + "revision" : "2842e6e84e82eb9a8dac0100ca90d9444b0307f4", + "version" : "5.7.1" + } + }, + { + "identity" : "then", + "kind" : "remoteSourceControl", + "location" : "https://github.com/devxoul/Then", + "state" : { + "revision" : "d41ef523faef0f911369f79c0b96815d9dbb6d7a", + "version" : "3.0.0" + } + } + ], + "version" : 2 +} diff --git a/GEON-PPANG-iOS/Core/DesignSystem/UIComponents/View/StackView/GBStackView.swift b/GEON-PPANG-iOS/Core/DesignSystem/UIComponents/View/StackView/GBStackView.swift index 58e59fc5..c8a33f3c 100644 --- a/GEON-PPANG-iOS/Core/DesignSystem/UIComponents/View/StackView/GBStackView.swift +++ b/GEON-PPANG-iOS/Core/DesignSystem/UIComponents/View/StackView/GBStackView.swift @@ -28,10 +28,10 @@ enum GBStackType { final class GBStackView: UIStackView { - init(type: GBStackType, data: [Bool]) { + init(type: GBStackType, isHaccp: Bool, isVegan: Bool, isNonGMO: Bool) { super.init(frame: .zero) setUI() - addCertifiedImageViews(type: type, data: data) + addCertifiedImageViews(type: type, data: [isHaccp, isVegan, isNonGMO]) } required init(coder: NSCoder) { From a9bc7a3e46c8e208f20bf5bc08b0be22be27f442 Mon Sep 17 00:00:00 2001 From: jeongdung-eo Date: Fri, 19 Jul 2024 15:35:37 +0900 Subject: [PATCH 3/4] =?UTF-8?q?[Fix]=20#279=20-=20=EB=A7=A4=EA=B0=9C?= =?UTF-8?q?=EB=B3=80=EC=88=98=20=EB=84=A4=EC=9D=B4=EB=B0=8D=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UIComponents/View/StackView/GBStackView.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/GEON-PPANG-iOS/Core/DesignSystem/UIComponents/View/StackView/GBStackView.swift b/GEON-PPANG-iOS/Core/DesignSystem/UIComponents/View/StackView/GBStackView.swift index c8a33f3c..db808a61 100644 --- a/GEON-PPANG-iOS/Core/DesignSystem/UIComponents/View/StackView/GBStackView.swift +++ b/GEON-PPANG-iOS/Core/DesignSystem/UIComponents/View/StackView/GBStackView.swift @@ -31,7 +31,7 @@ final class GBStackView: UIStackView { init(type: GBStackType, isHaccp: Bool, isVegan: Bool, isNonGMO: Bool) { super.init(frame: .zero) setUI() - addCertifiedImageViews(type: type, data: [isHaccp, isVegan, isNonGMO]) + addCertifiedImageViews(type: type, certifications: [isHaccp, isVegan, isNonGMO]) } required init(coder: NSCoder) { @@ -43,8 +43,8 @@ final class GBStackView: UIStackView { spacing = -8 } - private func addCertifiedImageViews(type: GBStackType, data: [Bool]) { - data.enumerated() + private func addCertifiedImageViews(type: GBStackType, certifications: [Bool]) { + certifications.enumerated() .filter { $0.element } .map { $0.offset } .forEach { index in From f33e6ce88629ecf2ed554e0b18b6d06f1fb8832d Mon Sep 17 00:00:00 2001 From: jeongdung-eo Date: Fri, 19 Jul 2024 16:10:45 +0900 Subject: [PATCH 4/4] =?UTF-8?q?[Fix]=20#279=20-=20=EB=A9=94=EC=84=9C?= =?UTF-8?q?=EB=93=9C=20=EC=97=AD=ED=95=A0=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../View/StackView/GBStackView.swift | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/GEON-PPANG-iOS/Core/DesignSystem/UIComponents/View/StackView/GBStackView.swift b/GEON-PPANG-iOS/Core/DesignSystem/UIComponents/View/StackView/GBStackView.swift index db808a61..6b38dff4 100644 --- a/GEON-PPANG-iOS/Core/DesignSystem/UIComponents/View/StackView/GBStackView.swift +++ b/GEON-PPANG-iOS/Core/DesignSystem/UIComponents/View/StackView/GBStackView.swift @@ -48,12 +48,21 @@ final class GBStackView: UIStackView { .filter { $0.element } .map { $0.offset } .forEach { index in - let imageView = UIImageView(image: type.images[index]) - imageView.contentMode = .topLeft - addArrangedSubview(imageView) - imageView.snp.makeConstraints { - $0.size.equalTo(type.size) - } + let imageView = createCertificationImageView(type: type, index: index) + addImageViewToStack(imageView: imageView, size: type.size) } } + + private func createCertificationImageView(type: GBStackType, index: Int) -> UIImageView { + let imageView = UIImageView(image: type.images[index]) + imageView.contentMode = .topLeft + return imageView + } + + private func addImageViewToStack(imageView: UIImageView, size: Int) { + addArrangedSubview(imageView) + imageView.snp.makeConstraints { + $0.size.equalTo(size) + } + } }