diff --git a/PyeonHaeng-iOS.xcodeproj/project.pbxproj b/PyeonHaeng-iOS.xcodeproj/project.pbxproj index ead67dc..7185227 100644 --- a/PyeonHaeng-iOS.xcodeproj/project.pbxproj +++ b/PyeonHaeng-iOS.xcodeproj/project.pbxproj @@ -34,6 +34,7 @@ BAB569612B639F3000D1E0F9 /* DesignSystem in Frameworks */ = {isa = PBXBuildFile; productRef = BAB569602B639F3000D1E0F9 /* DesignSystem */; }; BAE159D82B65FA6F002DCF94 /* HomeProductDetailSelectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAE159D72B65FA6F002DCF94 /* HomeProductDetailSelectionView.swift */; }; BAE159DA2B65FC35002DCF94 /* HomeProductListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAE159D92B65FC35002DCF94 /* HomeProductListView.swift */; }; + BAE159DE2B663A9A002DCF94 /* HomeProductSorterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAE159DD2B663A9A002DCF94 /* HomeProductSorterView.swift */; }; BAF2BEB32B61236100931AF0 /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = BAF2BEB22B61236100931AF0 /* Localizable.xcstrings */; }; /* End PBXBuildFile section */ @@ -77,6 +78,7 @@ BABFEA6F2B6399C30084C0EC /* Shared */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = Shared; sourceTree = ""; }; BAE159D72B65FA6F002DCF94 /* HomeProductDetailSelectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeProductDetailSelectionView.swift; sourceTree = ""; }; BAE159D92B65FC35002DCF94 /* HomeProductListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeProductListView.swift; sourceTree = ""; }; + BAE159DD2B663A9A002DCF94 /* HomeProductSorterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeProductSorterView.swift; sourceTree = ""; }; BAF2BEB22B61236100931AF0 /* Localizable.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; path = Localizable.xcstrings; sourceTree = ""; }; /* End PBXFileReference section */ @@ -179,6 +181,7 @@ isa = PBXGroup; children = ( BA28F1872B6155910052855E /* HomeView.swift */, + BAE159DD2B663A9A002DCF94 /* HomeProductSorterView.swift */, BAE159D72B65FA6F002DCF94 /* HomeProductDetailSelectionView.swift */, BAE159D92B65FC35002DCF94 /* HomeProductListView.swift */, ); @@ -444,6 +447,7 @@ BA28F18B2B6155BD0052855E /* ProductInfoView.swift in Sources */, BA28F1912B61566E0052855E /* ProductSearchView.swift in Sources */, BA28F18E2B6156420052855E /* SettingsView.swift in Sources */, + BAE159DE2B663A9A002DCF94 /* HomeProductSorterView.swift in Sources */, BAE159D82B65FA6F002DCF94 /* HomeProductDetailSelectionView.swift in Sources */, BAA4D9AF2B5A1795005999F8 /* SplashView.swift in Sources */, BAA4D9AD2B5A1795005999F8 /* PyeonHaengApp.swift in Sources */, diff --git a/PyeonHaeng-iOS/Sources/Scenes/HomeScene/HomeProductSorterView.swift b/PyeonHaeng-iOS/Sources/Scenes/HomeScene/HomeProductSorterView.swift new file mode 100644 index 0000000..fe8a724 --- /dev/null +++ b/PyeonHaeng-iOS/Sources/Scenes/HomeScene/HomeProductSorterView.swift @@ -0,0 +1,42 @@ +// +// HomeProductSorterView.swift +// PyeonHaeng-iOS +// +// Created by 홍승현 on 1/28/24. +// + +import SwiftUI + +struct HomeProductSorterView: View { + private let count: Int + + init(count: Int) { + self.count = count + } + + var body: some View { + HStack { + Text(attributedString) + .font(.title2) + Spacer() + Button {} label: { + Image(systemName: "arrow.up.arrow.down") + } + } + .padding(.all, 8) + } + + var attributedString: AttributedString { + var string = AttributedString("총 \(count)개의 상품이 있어요!") + + if let range = string.range(of: "\(count)") { + string[range].foregroundColor = .green500 + } + + return string + } +} + +#Preview { + HomeProductSorterView(count: 50) +} diff --git a/PyeonHaeng-iOS/Sources/Scenes/HomeScene/HomeView.swift b/PyeonHaeng-iOS/Sources/Scenes/HomeScene/HomeView.swift index 2d5d031..d5040b4 100644 --- a/PyeonHaeng-iOS/Sources/Scenes/HomeScene/HomeView.swift +++ b/PyeonHaeng-iOS/Sources/Scenes/HomeScene/HomeView.swift @@ -15,8 +15,8 @@ struct HomeView: View { NavigationStack { VStack { HomeProductDetailSelectionView() + HomeProductSorterView(count: 12) HomeProductListView() - Spacer() } .padding(.horizontal, Metrics.horizontal) .navigationBarTitleDisplayMode(.inline)