Skip to content

Commit

Permalink
[Feat] #279 - 디자인 시스템 GBStackView구현
Browse files Browse the repository at this point in the history
[Feat] #279 - 디자인 시스템 GBStackView구현
  • Loading branch information
jeongdung-eo authored Jul 21, 2024
2 parents 3f77c85 + f33e6ce commit 5508fd9
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 4 deletions.
12 changes: 12 additions & 0 deletions GEON-PPANG-iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -285,6 +286,7 @@
0915C1742A5C533900ACB8D4 /* HomeReviewCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeReviewCollectionViewCell.swift; sourceTree = "<group>"; };
091AFD412ABD79380001DD02 /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Settings.bundle; sourceTree = "<group>"; };
0924632E2A5BA0F200B6F65D /* HomeBakeryCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeBakeryCollectionViewCell.swift; sourceTree = "<group>"; };
0926989D2C3EB19600A9349D /* GBStackView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GBStackView.swift; sourceTree = "<group>"; };
092EFCA32A6195D900E7C262 /* CommonTextView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommonTextView.swift; sourceTree = "<group>"; };
0930D25A2A928B8000A75C7E /* CertificationMarkResponseType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CertificationMarkResponseType.swift; sourceTree = "<group>"; };
0930D25C2A928BF200A75C7E /* NearStationResponseDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NearStationResponseDTO.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -588,6 +590,14 @@
path = Label;
sourceTree = "<group>";
};
0926989C2C3EB18600A9349D /* StackView */ = {
isa = PBXGroup;
children = (
0926989D2C3EB19600A9349D /* GBStackView.swift */,
);
path = StackView;
sourceTree = "<group>";
};
092F11B12A69A6CC00852CA5 /* Cell */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1172,6 +1182,7 @@
isa = PBXGroup;
children = (
096446352C2C063800D5E85A /* Bubble */,
0926989C2C3EB18600A9349D /* StackView */,
0989547B2C1C07B30000D650 /* TextField */,
3E2A0B832BE74E49004F8D6B /* Chip */,
);
Expand Down Expand Up @@ -2244,6 +2255,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 */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/kakao/kakao-ios-sdk",
"state" : {
"revision" : "e9e649d3ba823c3673867d3d09010fc77005a940",
"version" : "2.22.3"
"revision" : "08089eeffc9b442da1c7343a70bf66c6de1a72c9",
"version" : "2.22.4"
}
},
{
Expand Down Expand Up @@ -77,8 +77,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/getsentry/sentry-cocoa.git",
"state" : {
"revision" : "8fd4e804f2e72e0b9c1b189ce4e8349c4d10b6a2",
"version" : "8.30.0"
"revision" : "7339fcbab2ded21fe5753687022f2b673a1a1865",
"version" : "8.31.1"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
//
// 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, isHaccp: Bool, isVegan: Bool, isNonGMO: Bool) {
super.init(frame: .zero)
setUI()
addCertifiedImageViews(type: type, certifications: [isHaccp, isVegan, isNonGMO])
}

required init(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

private func setUI() {
axis = .horizontal
spacing = -8
}

private func addCertifiedImageViews(type: GBStackType, certifications: [Bool]) {
certifications.enumerated()
.filter { $0.element }
.map { $0.offset }
.forEach { index in
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)
}
}
}

0 comments on commit 5508fd9

Please sign in to comment.