From b091662e9a72c9d0da4676a766d5498ba581ebf1 Mon Sep 17 00:00:00 2001 From: abi-hong <68041042+abi-hong@users.noreply.github.com> Date: Tue, 8 Feb 2022 22:46:11 +0900 Subject: [PATCH] =?UTF-8?q?[feat]=20=EC=B9=B4=ED=85=8C=EA=B3=A0=EB=A6=AC?= =?UTF-8?q?=20=ED=83=AD=20=EC=99=84=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Hyangyu/Hyangyu.xcodeproj/project.pbxproj | 56 +++- Hyangyu/Hyangyu/Resources/Info.plist | 1 - .../Storyboards/CategoryDetailPage.storyboard | 256 ++++++++++++++++++ .../Storyboards/CategoryTab.storyboard | 10 +- .../Resources/Storyboards/HomeTab.storyboard | 35 --- .../Storyboards/MyPageTab.storyboard | 35 --- .../Storyboards/SearchTab.storyboard | 35 --- .../ReviewModel.swift} | 2 +- .../Cells/CategoryCollectionViewCell.xib | 38 +-- .../ViewControllers/Category/BestVC.swift | 113 ++++++++ .../ViewControllers/Category/CostVC.swift | 113 ++++++++ .../ViewControllers/Category/FreeVC.swift | 112 ++++++++ .../ViewControllers/Category/HomeVC.swift | 119 ++++++++ .../ViewControllers/Category/NewVC.swift | 114 ++++++++ .../CategoryViewController.swift | 60 ++-- .../MoreReviewViewController.swift | 10 +- .../Sources/ViewModels/ReviewDataModel.swift | 8 - 17 files changed, 932 insertions(+), 185 deletions(-) create mode 100644 Hyangyu/Hyangyu/Resources/Storyboards/CategoryDetailPage.storyboard delete mode 100644 Hyangyu/Hyangyu/Resources/Storyboards/HomeTab.storyboard delete mode 100644 Hyangyu/Hyangyu/Resources/Storyboards/MyPageTab.storyboard delete mode 100644 Hyangyu/Hyangyu/Resources/Storyboards/SearchTab.storyboard rename Hyangyu/Hyangyu/Sources/{ViewControllers/ReviewDataModel.swift => AppModels/ReviewModel.swift} (89%) create mode 100644 Hyangyu/Hyangyu/Sources/ViewControllers/Category/BestVC.swift create mode 100644 Hyangyu/Hyangyu/Sources/ViewControllers/Category/CostVC.swift create mode 100644 Hyangyu/Hyangyu/Sources/ViewControllers/Category/FreeVC.swift create mode 100644 Hyangyu/Hyangyu/Sources/ViewControllers/Category/HomeVC.swift create mode 100644 Hyangyu/Hyangyu/Sources/ViewControllers/Category/NewVC.swift delete mode 100644 Hyangyu/Hyangyu/Sources/ViewModels/ReviewDataModel.swift diff --git a/Hyangyu/Hyangyu.xcodeproj/project.pbxproj b/Hyangyu/Hyangyu.xcodeproj/project.pbxproj index 1993be4..e539e6c 100644 --- a/Hyangyu/Hyangyu.xcodeproj/project.pbxproj +++ b/Hyangyu/Hyangyu.xcodeproj/project.pbxproj @@ -11,18 +11,25 @@ 0003779227B0CCAF00724152 /* MoreReviewPage.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 00C96B0C27AFA466000DB941 /* MoreReviewPage.storyboard */; }; 0003779727B0F05800724152 /* ReviewCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0003779527B0F05800724152 /* ReviewCollectionViewCell.swift */; }; 0003779827B0F05800724152 /* ReviewCollectionViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0003779627B0F05800724152 /* ReviewCollectionViewCell.xib */; }; - 0003779A27B0F6E200724152 /* ReviewDataModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0003779927B0F6E200724152 /* ReviewDataModel.swift */; }; + 0003779A27B0F6E200724152 /* ReviewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0003779927B0F6E200724152 /* ReviewModel.swift */; }; 0008E3C127953D410089985B /* DetailCategoryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0008E3C027953D410089985B /* DetailCategoryViewController.swift */; }; 0008E3C327953D770089985B /* CategoryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0008E3C227953D770089985B /* CategoryViewController.swift */; }; 003AB8D227AFF22E00902D50 /* DetailViewPage.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0099690027A15AD200D7CDA2 /* DetailViewPage.storyboard */; }; + 00788D3E27B29BB900CA115A /* CategoryDetailPage.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 00788D3D27B29BB900CA115A /* CategoryDetailPage.storyboard */; }; + 00788D4127B29C1C00CA115A /* HomeVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00788D4027B29C1C00CA115A /* HomeVC.swift */; }; + 00788D4327B29C3000CA115A /* BestVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00788D4227B29C3000CA115A /* BestVC.swift */; }; + 00788D4527B29C3C00CA115A /* NewVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00788D4427B29C3C00CA115A /* NewVC.swift */; }; + 00788D4727B29C4A00CA115A /* FreeVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00788D4627B29C4A00CA115A /* FreeVC.swift */; }; + 00788D4927B29C5D00CA115A /* CostVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00788D4827B29C5D00CA115A /* CostVC.swift */; }; + 00788D4E27B2AA3800CA115A /* CategoryCollectionViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0079288C2797E44C006B8EDE /* CategoryCollectionViewCell.xib */; }; 0079288D2797E44C006B8EDE /* CategoryCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0079288B2797E44C006B8EDE /* CategoryCollectionViewCell.swift */; }; 0093448427AFAE7F00490D57 /* MoreReviewViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0093448327AFAE7E00490D57 /* MoreReviewViewController.swift */; }; 0093448627AFAEB000490D57 /* WriteReviewViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0093448527AFAEB000490D57 /* WriteReviewViewController.swift */; }; + 00967AFB27B153C8009ED7C5 /* ReviewDataModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00967AFA27B153C8009ED7C5 /* ReviewDataModel.swift */; }; 0099690327A16FFC00D7CDA2 /* DetailPageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0099690227A16FFC00D7CDA2 /* DetailPageViewController.swift */; }; 236279132796840B00C16340 /* Home.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 236279122796840B00C16340 /* Home.storyboard */; }; 236279152796841A00C16340 /* HomeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 236279142796841A00C16340 /* HomeViewController.swift */; }; 236279172796894800C16340 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 236279162796894800C16340 /* Main.storyboard */; }; - 2377838327A66BBE00FF2055 /* ReviewDataModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2377838227A66BBE00FF2055 /* ReviewDataModel.swift */; }; 23842A92279EBCD600621427 /* HomeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23842A8C279EBCD600621427 /* HomeViewController.swift */; }; 23842A94279EBCD600621427 /* ReviewEditViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23842A8E279EBCD600621427 /* ReviewEditViewController.swift */; }; 23842A95279EBCD600621427 /* ReviewViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23842A8F279EBCD600621427 /* ReviewViewController.swift */; }; @@ -132,26 +139,29 @@ /* Begin PBXFileReference section */ 0003779527B0F05800724152 /* ReviewCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReviewCollectionViewCell.swift; sourceTree = ""; }; 0003779627B0F05800724152 /* ReviewCollectionViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ReviewCollectionViewCell.xib; sourceTree = ""; }; - 0003779927B0F6E200724152 /* ReviewDataModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReviewDataModel.swift; sourceTree = ""; }; + 0003779927B0F6E200724152 /* ReviewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReviewModel.swift; sourceTree = ""; }; 0008E3C027953D410089985B /* DetailCategoryViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailCategoryViewController.swift; sourceTree = ""; }; 0008E3C227953D770089985B /* CategoryViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CategoryViewController.swift; sourceTree = ""; }; 003AB8D327AFFAF800902D50 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 00788D3D27B29BB900CA115A /* CategoryDetailPage.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = CategoryDetailPage.storyboard; sourceTree = ""; }; + 00788D4027B29C1C00CA115A /* HomeVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeVC.swift; sourceTree = ""; }; + 00788D4227B29C3000CA115A /* BestVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BestVC.swift; sourceTree = ""; }; + 00788D4427B29C3C00CA115A /* NewVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewVC.swift; sourceTree = ""; }; + 00788D4627B29C4A00CA115A /* FreeVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FreeVC.swift; sourceTree = ""; }; + 00788D4827B29C5D00CA115A /* CostVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CostVC.swift; sourceTree = ""; }; 0079288B2797E44C006B8EDE /* CategoryCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CategoryCollectionViewCell.swift; sourceTree = ""; }; 0079288C2797E44C006B8EDE /* CategoryCollectionViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = CategoryCollectionViewCell.xib; sourceTree = ""; }; 0093448327AFAE7E00490D57 /* MoreReviewViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoreReviewViewController.swift; sourceTree = ""; }; 0093448527AFAEB000490D57 /* WriteReviewViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WriteReviewViewController.swift; sourceTree = ""; }; + 00967AFA27B153C8009ED7C5 /* ReviewDataModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ReviewDataModel.swift; path = ../../../../../ReviewDataModel.swift; sourceTree = ""; }; 0099690027A15AD200D7CDA2 /* DetailViewPage.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = DetailViewPage.storyboard; sourceTree = ""; }; 0099690227A16FFC00D7CDA2 /* DetailPageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailPageViewController.swift; sourceTree = ""; }; 00C96B0C27AFA466000DB941 /* MoreReviewPage.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = MoreReviewPage.storyboard; sourceTree = ""; }; 00C96B1027AFA59A000DB941 /* WriteReviewPage.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = WriteReviewPage.storyboard; sourceTree = ""; }; - 00D0CCB3278BC3C50087EF87 /* SearchTab.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = SearchTab.storyboard; sourceTree = ""; }; 00D0CCB5278BC3DC0087EF87 /* CategoryTab.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = CategoryTab.storyboard; sourceTree = ""; }; - 00D0CCB7278BC3ED0087EF87 /* MyPageTab.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = MyPageTab.storyboard; sourceTree = ""; }; - 00D0CCB9278BC7140087EF87 /* HomeTab.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = HomeTab.storyboard; sourceTree = ""; }; 236279122796840B00C16340 /* Home.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Home.storyboard; sourceTree = ""; }; 236279142796841A00C16340 /* HomeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeViewController.swift; sourceTree = ""; }; 236279162796894800C16340 /* Main.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = ""; }; - 2377838227A66BBE00FF2055 /* ReviewDataModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReviewDataModel.swift; sourceTree = ""; }; 23842A8C279EBCD600621427 /* HomeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HomeViewController.swift; sourceTree = ""; }; 23842A8E279EBCD600621427 /* ReviewEditViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReviewEditViewController.swift; sourceTree = ""; }; 23842A8F279EBCD600621427 /* ReviewViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReviewViewController.swift; sourceTree = ""; }; @@ -272,6 +282,18 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 00788D3F27B29BFA00CA115A /* Category */ = { + isa = PBXGroup; + children = ( + 00788D4027B29C1C00CA115A /* HomeVC.swift */, + 00788D4227B29C3000CA115A /* BestVC.swift */, + 00788D4427B29C3C00CA115A /* NewVC.swift */, + 00788D4627B29C4A00CA115A /* FreeVC.swift */, + 00788D4827B29C5D00CA115A /* CostVC.swift */, + ); + path = Category; + sourceTree = ""; + }; 66E8DBB31F43C4F6A3ADC179 /* Pods */ = { isa = PBXGroup; children = ( @@ -420,6 +442,7 @@ 83177BD527AD6F4A00032BF3 /* Product.swift */, 836086F727A6A59B00E9B9F5 /* Search.swift */, 8375EADA27B00D4E007D5EFA /* ServiceDataModel.swift */, + 0003779927B0F6E200724152 /* ReviewModel.swift */, ); path = AppModels; sourceTree = ""; @@ -535,10 +558,8 @@ 83B34E182787367D009A8009 /* Storyboards */ = { isa = PBXGroup; children = ( - 00D0CCB9278BC7140087EF87 /* HomeTab.storyboard */, - 00D0CCB3278BC3C50087EF87 /* SearchTab.storyboard */, 00D0CCB5278BC3DC0087EF87 /* CategoryTab.storyboard */, - 00D0CCB7278BC3ED0087EF87 /* MyPageTab.storyboard */, + 00788D3D27B29BB900CA115A /* CategoryDetailPage.storyboard */, 0099690027A15AD200D7CDA2 /* DetailViewPage.storyboard */, 00C96B1027AFA59A000DB941 /* WriteReviewPage.storyboard */, 00C96B0C27AFA466000DB941 /* MoreReviewPage.storyboard */, @@ -564,12 +585,12 @@ 83B34E1A278736B3009A8009 /* ViewControllers */ = { isa = PBXGroup; children = ( + 00788D3F27B29BFA00CA115A /* Category */, 0008E3C027953D410089985B /* DetailCategoryViewController.swift */, 0008E3C227953D770089985B /* CategoryViewController.swift */, 0099690227A16FFC00D7CDA2 /* DetailPageViewController.swift */, 0093448327AFAE7E00490D57 /* MoreReviewViewController.swift */, 0093448527AFAEB000490D57 /* WriteReviewViewController.swift */, - 0003779927B0F6E200724152 /* ReviewDataModel.swift */, 83177BD827ADA45D00032BF3 /* ResetCode */, 8307901F27AB1D6500E0F7D4 /* NewPassword */, 8307901227AB112D00E0F7D4 /* FindPassword */, @@ -625,10 +646,10 @@ 23842AA2279EBCF800621427 /* HashtagDetailDataModel.swift */, 23842AA0279EBCF800621427 /* HomeHashtagDataModel.swift */, 23842AA1279EBCF800621427 /* HomePosterDataModel.swift */, - 2377838227A66BBE00FF2055 /* ReviewDataModel.swift */, 83495863279872210045B419 /* DragDirection.swift */, 834958662798723F0045B419 /* Page.swift */, 838434BD279B4B6B00F0484C /* MyListModel.swift */, + 00967AFA27B153C8009ED7C5 /* ReviewDataModel.swift */, 831B67FB279BC6F4009FB738 /* SettingsModel.swift */, 83C167CC279DF4DE00A4F289 /* SearchResult.swift */, 8307A330279EAA50006258E1 /* SearchResultsTableViewCellViewModel.swift */, @@ -724,9 +745,11 @@ files = ( 003AB8D227AFF22E00902D50 /* DetailViewPage.storyboard in Resources */, 0003779227B0CCAF00724152 /* MoreReviewPage.storyboard in Resources */, + 00788D3E27B29BB900CA115A /* CategoryDetailPage.storyboard in Resources */, 0003779827B0F05800724152 /* ReviewCollectionViewCell.xib in Resources */, 0003779127B0CCAB00724152 /* WriteReviewPage.storyboard in Resources */, 236279172796894800C16340 /* Main.storyboard in Resources */, + 00788D4E27B2AA3800CA115A /* CategoryCollectionViewCell.xib in Resources */, 83B34E0A27873600009A8009 /* Assets.xcassets in Resources */, 23842AA9279EBD3800621427 /* Review.storyboard in Resources */, 236279132796840B00C16340 /* Home.storyboard in Resources */, @@ -818,7 +841,7 @@ buildActionMask = 2147483647; files = ( 0093448627AFAEB000490D57 /* WriteReviewViewController.swift in Sources */, - 0003779A27B0F6E200724152 /* ReviewDataModel.swift in Sources */, + 0003779A27B0F6E200724152 /* ReviewModel.swift in Sources */, 0093448427AFAE7F00490D57 /* MoreReviewViewController.swift in Sources */, 0099690327A16FFC00D7CDA2 /* DetailPageViewController.swift in Sources */, 0008E3C327953D770089985B /* CategoryViewController.swift in Sources */, @@ -832,13 +855,14 @@ 23842AA6279EBCF800621427 /* HashtagDetailDataModel.swift in Sources */, 23842A94279EBCD600621427 /* ReviewEditViewController.swift in Sources */, 23842AA5279EBCF800621427 /* HomePosterDataModel.swift in Sources */, + 00788D4127B29C1C00CA115A /* HomeVC.swift in Sources */, 23842A9E279EBCE800621427 /* HomeImageCollectionViewCell.swift in Sources */, 23842A9C279EBCE800621427 /* HashtagCollectionViewCell.swift in Sources */, 23842A9D279EBCE800621427 /* ReviewTableViewCell.swift in Sources */, 83B34E03278735FF009A8009 /* SceneDelegate.swift in Sources */, 236279152796841A00C16340 /* HomeViewController.swift in Sources */, 23842A97279EBCD600621427 /* HashtagDetailViewController.swift in Sources */, - 2377838327A66BBE00FF2055 /* ReviewDataModel.swift in Sources */, + 00967AFB27B153C8009ED7C5 /* ReviewDataModel.swift in Sources */, 23842A9F279EBCE800621427 /* HashtagDetailTableViewCell.swift in Sources */, 23842A92279EBCD600621427 /* HomeViewController.swift in Sources */, 8399CF8227994D31002E5287 /* ProcessViewStyle.swift in Sources */, @@ -872,6 +896,8 @@ 837763C427A0894B00248B6F /* SignUpService.swift in Sources */, 8399CF6F27994775002E5287 /* UIScrollView+Extensions.swift in Sources */, 8307901D27AB185F00E0F7D4 /* PasswordService.swift in Sources */, + 00788D4327B29C3000CA115A /* BestVC.swift in Sources */, + 00788D4927B29C5D00CA115A /* CostVC.swift in Sources */, 8399CFBB2799E54E002E5287 /* UINavigationController+Extensions.swift in Sources */, 8399CF74279949C3002E5287 /* NSCache+Extensions.swift in Sources */, 8399CF7E27994D0F002E5287 /* UIScrollView.swift in Sources */, @@ -895,6 +921,7 @@ 8375EADB27B00D4E007D5EFA /* ServiceDataModel.swift in Sources */, 83B8A66027A103C100C22495 /* Auth.swift in Sources */, 83E42366279ACD890094DC2E /* UITextField+Extensions.swift in Sources */, + 00788D4527B29C3C00CA115A /* NewVC.swift in Sources */, 83B8A66327A1042B00C22495 /* SignUpAPI.swift in Sources */, 83C167C0279DD19800A4F289 /* SearchViewController.swift in Sources */, 83C167CA279DEAF400A4F289 /* LeftAlignedCollectionViewFlowLayout.swift in Sources */, @@ -904,6 +931,7 @@ 834958792798944C0045B419 /* BarAppearance.swift in Sources */, 831E91E1279C8271001F7F87 /* Font.swift in Sources */, 8307901A27AB184500E0F7D4 /* PasswordAPI.swift in Sources */, + 00788D4727B29C4A00CA115A /* FreeVC.swift in Sources */, 83E2A0E927AC1E2900EB0A55 /* SearchView.swift in Sources */, 8399CF8B27994DA0002E5287 /* UIColor+RGB.swift in Sources */, 83B8A66627A1048C00C22495 /* NetworkResult.swift in Sources */, diff --git a/Hyangyu/Hyangyu/Resources/Info.plist b/Hyangyu/Hyangyu/Resources/Info.plist index ae0dbbc..f98acf4 100644 --- a/Hyangyu/Hyangyu/Resources/Info.plist +++ b/Hyangyu/Hyangyu/Resources/Info.plist @@ -41,7 +41,6 @@ UISceneDelegateClassName $(PRODUCT_MODULE_NAME).SceneDelegate UISceneStoryboardFile - DetailViewPage Tabbar diff --git a/Hyangyu/Hyangyu/Resources/Storyboards/CategoryDetailPage.storyboard b/Hyangyu/Hyangyu/Resources/Storyboards/CategoryDetailPage.storyboard new file mode 100644 index 0000000..95ba250 --- /dev/null +++ b/Hyangyu/Hyangyu/Resources/Storyboards/CategoryDetailPage.storyboard @@ -0,0 +1,256 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Hyangyu/Hyangyu/Resources/Storyboards/CategoryTab.storyboard b/Hyangyu/Hyangyu/Resources/Storyboards/CategoryTab.storyboard index 49a4e6d..b6b4ccd 100644 --- a/Hyangyu/Hyangyu/Resources/Storyboards/CategoryTab.storyboard +++ b/Hyangyu/Hyangyu/Resources/Storyboards/CategoryTab.storyboard @@ -1,8 +1,8 @@ - + - + @@ -60,17 +60,23 @@ + + + + + + diff --git a/Hyangyu/Hyangyu/Resources/Storyboards/HomeTab.storyboard b/Hyangyu/Hyangyu/Resources/Storyboards/HomeTab.storyboard deleted file mode 100644 index 586493f..0000000 --- a/Hyangyu/Hyangyu/Resources/Storyboards/HomeTab.storyboard +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Hyangyu/Hyangyu/Resources/Storyboards/MyPageTab.storyboard b/Hyangyu/Hyangyu/Resources/Storyboards/MyPageTab.storyboard deleted file mode 100644 index 4e92a0a..0000000 --- a/Hyangyu/Hyangyu/Resources/Storyboards/MyPageTab.storyboard +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Hyangyu/Hyangyu/Resources/Storyboards/SearchTab.storyboard b/Hyangyu/Hyangyu/Resources/Storyboards/SearchTab.storyboard deleted file mode 100644 index cb6906b..0000000 --- a/Hyangyu/Hyangyu/Resources/Storyboards/SearchTab.storyboard +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Hyangyu/Hyangyu/Sources/ViewControllers/ReviewDataModel.swift b/Hyangyu/Hyangyu/Sources/AppModels/ReviewModel.swift similarity index 89% rename from Hyangyu/Hyangyu/Sources/ViewControllers/ReviewDataModel.swift rename to Hyangyu/Hyangyu/Sources/AppModels/ReviewModel.swift index 70c01ac..3f84eb5 100644 --- a/Hyangyu/Hyangyu/Sources/ViewControllers/ReviewDataModel.swift +++ b/Hyangyu/Hyangyu/Sources/AppModels/ReviewModel.swift @@ -7,7 +7,7 @@ import Foundation -struct ReviewDataModel +struct ReviewModel { var nickName : String var createTime : String diff --git a/Hyangyu/Hyangyu/Sources/Cells/CategoryCollectionViewCell.xib b/Hyangyu/Hyangyu/Sources/Cells/CategoryCollectionViewCell.xib index 70df29c..1364618 100644 --- a/Hyangyu/Hyangyu/Sources/Cells/CategoryCollectionViewCell.xib +++ b/Hyangyu/Hyangyu/Sources/Cells/CategoryCollectionViewCell.xib @@ -17,23 +17,8 @@ - @@ -76,9 +76,9 @@ + - - + diff --git a/Hyangyu/Hyangyu/Sources/ViewControllers/Category/BestVC.swift b/Hyangyu/Hyangyu/Sources/ViewControllers/Category/BestVC.swift new file mode 100644 index 0000000..0819297 --- /dev/null +++ b/Hyangyu/Hyangyu/Sources/ViewControllers/Category/BestVC.swift @@ -0,0 +1,113 @@ +// +// BestVC.swift +// Hyangyu +// +// Created by 홍희수 on 2022/02/08. +// + +import UIKit + +class BestVC: UIViewController { + + @IBOutlet weak var bestCollectionView: UICollectionView! + + var cardList: [ServiceDataModel] = [] + + let categoryTabStoryboard: UIStoryboard = UIStoryboard(name: "CategoryTab", bundle: nil) + + override func viewDidLoad() { + super.viewDidLoad() + + setCardList() + + bestCollectionView.delegate = self + bestCollectionView.dataSource = self + + registerXib() + } + + func registerXib() { + let nibName = UINib(nibName: "CategoryCollectionViewCell", bundle: nil) + bestCollectionView.register(nibName, forCellWithReuseIdentifier: "CategoryCollectionViewCell") + } + + //아까 선언해둔 cardList형 Array에 정보를 넣는 함수 + func setCardList(){ + cardList.append(contentsOf: [ + ServiceDataModel(iconImageName: "poster", title: "라이프 사진전: 더 라스트 프린트", placeTitle: "세종문화회관 미술관", dateTitle: "2021.05.11~08.21"), + ServiceDataModel(iconImageName: "poster", title: "라이프 사진전: 더 라스트 프린트", placeTitle: "세종문화회관 미술관", dateTitle: "2021.05.11~08.21"), + ServiceDataModel(iconImageName: "poster", title: "라이프 사진전: 더 라스트 프린트", placeTitle: "세종문화회관 미술관", dateTitle: "2021.05.11~08.21"), + ServiceDataModel(iconImageName: "poster", title: "라이프 사진전: 더 라스트 프린트", placeTitle: "세종문화회관 미술관", dateTitle: "2021.05.11~08.21"), + ServiceDataModel(iconImageName: "poster", title: "라이프 사진전: 더 라스트 프린트", placeTitle: "세종문화회관 미술관", dateTitle: "2021.05.11~08.21") + ]) + } + +} + +extension BestVC : UICollectionViewDataSource +{ + // cell을 몇개를 만들건지 -> cardList의 원소 개수만큼 만듬! + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + cardList.count + } + + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + + /* + 재사용큐를 활용해서 Cell을 가져오거나/생성 + -> identifier를 통해 Cell을 구분하고 indexPath를 통해 순서를 관리 + -> guard - let 구문을 통해 안전하게 값을 가져와서 cell에 넣어준다 + */ + guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "CategoryCollectionViewCell", for: indexPath) as? CategoryCollectionViewCell else { + return UICollectionViewCell() + } + + // 위에서 생성한 cell에 대해서 값을 cardList의 값으로 채움 + cell.setData(iconName: cardList[indexPath.row].iconImageName, title: cardList[indexPath.row].title, placeTitle: cardList[indexPath.row].placeTitle, dateTitle: cardList[indexPath.row].dateTitle) + + // 위 코드를 작성하면 cell에는 데이터가 담겨있는데 해당 cell을 return! + return cell + } +} + +extension BestVC : UICollectionViewDelegate +{ + +} + +extension BestVC : UICollectionViewDelegateFlowLayout +{ + /* + sizeForItemAt : 각 Cell들의 크기를 CGSize 형태로 return + indexPath를 가져와서 row나 section별로 다르게 크기 지정도 가능 + */ + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { + + // 현재 실행하고 있는 기기의 width + let width = UIScreen.main.bounds.width + + // 304, 184 + let cellWidth = width * (304/375) + let cellHeight = cellWidth * (184/304) + + return CGSize(width: cellWidth, height: cellHeight) + + } + + /* + ContentInset : Cell에서 Content 외부에 존재하는 Inset의 크기를 결정 + */ + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets { + return UIEdgeInsets(top: 10, left: 0, bottom: 10, right: 0) + } + + // minimumLineSpacing : Cell들의 위, 아래 간격 지정 + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat { + return 10 + } + + // minimumInteritemSpacing : Cell들의 좌, 우 간격 지정 + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat { + return 0 + } +} diff --git a/Hyangyu/Hyangyu/Sources/ViewControllers/Category/CostVC.swift b/Hyangyu/Hyangyu/Sources/ViewControllers/Category/CostVC.swift new file mode 100644 index 0000000..f36f772 --- /dev/null +++ b/Hyangyu/Hyangyu/Sources/ViewControllers/Category/CostVC.swift @@ -0,0 +1,113 @@ +// +// CostVC.swift +// Hyangyu +// +// Created by 홍희수 on 2022/02/08. +// + +import UIKit + +class CostVC: UIViewController { + + @IBOutlet weak var costCollectionView: UICollectionView! + + var cardList: [ServiceDataModel] = [] + + let categoryTabStoryboard: UIStoryboard = UIStoryboard(name: "CategoryTab", bundle: nil) + + override func viewDidLoad() { + super.viewDidLoad() + + setCardList() + + costCollectionView.delegate = self + costCollectionView.dataSource = self + + registerXib() + } + + func registerXib() { + let nibName = UINib(nibName: "CategoryCollectionViewCell", bundle: nil) + costCollectionView.register(nibName, forCellWithReuseIdentifier: "CategoryCollectionViewCell") + } + + //아까 선언해둔 cardList형 Array에 정보를 넣는 함수 + func setCardList(){ + cardList.append(contentsOf: [ + ServiceDataModel(iconImageName: "poster", title: "라이프 사진전: 더 라스트 프린트", placeTitle: "세종문화회관 미술관", dateTitle: "2021.05.11~08.21"), + ServiceDataModel(iconImageName: "poster", title: "라이프 사진전: 더 라스트 프린트", placeTitle: "세종문화회관 미술관", dateTitle: "2021.05.11~08.21"), + ServiceDataModel(iconImageName: "poster", title: "라이프 사진전: 더 라스트 프린트", placeTitle: "세종문화회관 미술관", dateTitle: "2021.05.11~08.21"), + ServiceDataModel(iconImageName: "poster", title: "라이프 사진전: 더 라스트 프린트", placeTitle: "세종문화회관 미술관", dateTitle: "2021.05.11~08.21"), + ServiceDataModel(iconImageName: "poster", title: "라이프 사진전: 더 라스트 프린트", placeTitle: "세종문화회관 미술관", dateTitle: "2021.05.11~08.21") + ]) + } +} + +extension CostVC : UICollectionViewDataSource +{ + // cell을 몇개를 만들건지 -> cardList의 원소 개수만큼 만듬! + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + cardList.count + } + + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + + /* + 재사용큐를 활용해서 Cell을 가져오거나/생성 + -> identifier를 통해 Cell을 구분하고 indexPath를 통해 순서를 관리 + -> guard - let 구문을 통해 안전하게 값을 가져와서 cell에 넣어준다 + */ + guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "CategoryCollectionViewCell", for: indexPath) as? CategoryCollectionViewCell else { + return UICollectionViewCell() + } + + // 위에서 생성한 cell에 대해서 값을 cardList의 값으로 채움 + cell.setData(iconName: cardList[indexPath.row].iconImageName, title: cardList[indexPath.row].title, placeTitle: cardList[indexPath.row].placeTitle, dateTitle: cardList[indexPath.row].dateTitle) + + // 위 코드를 작성하면 cell에는 데이터가 담겨있는데 해당 cell을 return! + return cell + } +} + +extension CostVC : UICollectionViewDelegate +{ + +} + +extension CostVC : UICollectionViewDelegateFlowLayout +{ + /* + sizeForItemAt : 각 Cell들의 크기를 CGSize 형태로 return + indexPath를 가져와서 row나 section별로 다르게 크기 지정도 가능 + */ + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { + + // 현재 실행하고 있는 기기의 width + let width = UIScreen.main.bounds.width + + // 304, 184 + let cellWidth = width * (304/375) + let cellHeight = cellWidth * (184/304) + + return CGSize(width: cellWidth, height: cellHeight) + + } + + /* + ContentInset : Cell에서 Content 외부에 존재하는 Inset의 크기를 결정 + */ + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets { + return UIEdgeInsets(top: 10, left: 0, bottom: 10, right: 0) + } + + // minimumLineSpacing : Cell들의 위, 아래 간격 지정 + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat { + return 10 + } + + // minimumInteritemSpacing : Cell들의 좌, 우 간격 지정 + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat { + return 0 + } +} + diff --git a/Hyangyu/Hyangyu/Sources/ViewControllers/Category/FreeVC.swift b/Hyangyu/Hyangyu/Sources/ViewControllers/Category/FreeVC.swift new file mode 100644 index 0000000..a73a0c9 --- /dev/null +++ b/Hyangyu/Hyangyu/Sources/ViewControllers/Category/FreeVC.swift @@ -0,0 +1,112 @@ +// +// FreeVC.swift +// Hyangyu +// +// Created by 홍희수 on 2022/02/08. +// + +import UIKit + +class FreeVC: UIViewController { + + @IBOutlet weak var freeCollectionView: UICollectionView! + + var cardList: [ServiceDataModel] = [] + + let categoryTabStoryboard: UIStoryboard = UIStoryboard(name: "CategoryTab", bundle: nil) + + override func viewDidLoad() { + super.viewDidLoad() + + setCardList() + + freeCollectionView.delegate = self + freeCollectionView.dataSource = self + + registerXib() + } + + func registerXib() { + let nibName = UINib(nibName: "CategoryCollectionViewCell", bundle: nil) + freeCollectionView.register(nibName, forCellWithReuseIdentifier: "CategoryCollectionViewCell") + } + + //아까 선언해둔 cardList형 Array에 정보를 넣는 함수 + func setCardList(){ + cardList.append(contentsOf: [ + ServiceDataModel(iconImageName: "poster", title: "라이프 사진전: 더 라스트 프린트", placeTitle: "세종문화회관 미술관", dateTitle: "2021.05.11~08.21"), + ServiceDataModel(iconImageName: "poster", title: "라이프 사진전: 더 라스트 프린트", placeTitle: "세종문화회관 미술관", dateTitle: "2021.05.11~08.21"), + ServiceDataModel(iconImageName: "poster", title: "라이프 사진전: 더 라스트 프린트", placeTitle: "세종문화회관 미술관", dateTitle: "2021.05.11~08.21"), + ServiceDataModel(iconImageName: "poster", title: "라이프 사진전: 더 라스트 프린트", placeTitle: "세종문화회관 미술관", dateTitle: "2021.05.11~08.21"), + ServiceDataModel(iconImageName: "poster", title: "라이프 사진전: 더 라스트 프린트", placeTitle: "세종문화회관 미술관", dateTitle: "2021.05.11~08.21") + ]) + } +} + +extension FreeVC : UICollectionViewDataSource +{ + // cell을 몇개를 만들건지 -> cardList의 원소 개수만큼 만듬! + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + cardList.count + } + + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + + /* + 재사용큐를 활용해서 Cell을 가져오거나/생성 + -> identifier를 통해 Cell을 구분하고 indexPath를 통해 순서를 관리 + -> guard - let 구문을 통해 안전하게 값을 가져와서 cell에 넣어준다 + */ + guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "CategoryCollectionViewCell", for: indexPath) as? CategoryCollectionViewCell else { + return UICollectionViewCell() + } + + // 위에서 생성한 cell에 대해서 값을 cardList의 값으로 채움 + cell.setData(iconName: cardList[indexPath.row].iconImageName, title: cardList[indexPath.row].title, placeTitle: cardList[indexPath.row].placeTitle, dateTitle: cardList[indexPath.row].dateTitle) + + // 위 코드를 작성하면 cell에는 데이터가 담겨있는데 해당 cell을 return! + return cell + } +} + +extension FreeVC : UICollectionViewDelegate +{ + +} + +extension FreeVC : UICollectionViewDelegateFlowLayout +{ + /* + sizeForItemAt : 각 Cell들의 크기를 CGSize 형태로 return + indexPath를 가져와서 row나 section별로 다르게 크기 지정도 가능 + */ + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { + + // 현재 실행하고 있는 기기의 width + let width = UIScreen.main.bounds.width + + // 304, 184 + let cellWidth = width * (304/375) + let cellHeight = cellWidth * (184/304) + + return CGSize(width: cellWidth, height: cellHeight) + + } + + /* + ContentInset : Cell에서 Content 외부에 존재하는 Inset의 크기를 결정 + */ + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets { + return UIEdgeInsets(top: 10, left: 0, bottom: 10, right: 0) + } + + // minimumLineSpacing : Cell들의 위, 아래 간격 지정 + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat { + return 10 + } + + // minimumInteritemSpacing : Cell들의 좌, 우 간격 지정 + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat { + return 0 + } +} diff --git a/Hyangyu/Hyangyu/Sources/ViewControllers/Category/HomeVC.swift b/Hyangyu/Hyangyu/Sources/ViewControllers/Category/HomeVC.swift new file mode 100644 index 0000000..aef8fbc --- /dev/null +++ b/Hyangyu/Hyangyu/Sources/ViewControllers/Category/HomeVC.swift @@ -0,0 +1,119 @@ +// +// HomeVC.swift +// Hyangyu +// +// Created by 홍희수 on 2022/02/08. +// + +import UIKit +import Tabman +import Pageboy +//CategoryDetailPage + +class HomeVC: TabmanViewController { + + @IBOutlet weak var categoryTitle: UILabel! + var categoryTabTitle: String? + @IBOutlet weak var tempView: UIView! + + private var viewControllers: Array = [] + + let tabColor = UIColor(rgb: 0x005550) + + + override func viewDidLoad() { + super.viewDidLoad() + + // 상단 탭바 + // swiftlint:disable force_cast + let newVC = UIStoryboard.init(name: "CategoryDetailPage", bundle: nil).instantiateViewController(withIdentifier: "NewVC") as! NewVC + // swiftlint:enable force_cast + + // swiftlint:disable force_cast + let bestVC = UIStoryboard.init(name: "CategoryDetailPage", bundle: nil).instantiateViewController(withIdentifier: "BestVC") as! BestVC + // swiftlint:enable force_cast + + // swiftlint:disable force_cast + let freeVC = UIStoryboard.init(name: "CategoryDetailPage", bundle: nil).instantiateViewController(withIdentifier: "FreeVC") as! FreeVC + // swiftlint:enable force_cast + + // swiftlint:disable force_cast + let costVC = UIStoryboard.init(name: "CategoryDetailPage", bundle: nil).instantiateViewController(withIdentifier: "CostVC") as! CostVC + // swiftlint:enable force_cast + + viewControllers.append(newVC) + viewControllers.append(bestVC) + viewControllers.append(freeVC) + viewControllers.append(costVC) + + self.dataSource = self + + let bar = TMBar.ButtonBar() + + bar.backgroundView.style = .blur(style: .regular) + bar.layout.contentInset = UIEdgeInsets(top: 0.0, left: 0.0, bottom: 0.0, right: 0.0) + bar.buttons.customize { (button) in + button.tintColor = .black // 선택 안되어 있을 때 + button.selectedTintColor = self.tabColor // 선택 되어 있을 때 + } + // 인디케이터 조정 + bar.indicator.weight = .light + bar.indicator.tintColor = self.tabColor + bar.indicator.overscrollBehavior = .compress + bar.layout.alignment = .centerDistributed + bar.layout.contentMode = .fit + bar.layout.interButtonSpacing = 35 // 버튼 사이 간격 + + bar.layout.transitionStyle = .snap // Customize + addBar(bar, dataSource: self, at: .custom(view: tempView, layout: nil)) + + setCategoryTitle() + } + + // categoryTitle 바꾸기 + func setCategoryTitle() { + if let title = self.categoryTabTitle { + categoryTitle.text = title + } + } + + + //뒤로가기 버튼 클릭 + @IBAction func backButtonClicked(_ sender: Any) { + self.navigationController?.popViewController(animated: true) + } +} + +extension HomeVC: PageboyViewControllerDataSource, TMBarDataSource { + + func barItem(for bar: TMBar, at index: Int) -> TMBarItemable { + // MARK: - Tab 안 글씨들 + switch index { + case 0: + return TMBarItem(title: "최신순") + case 1: + return TMBarItem(title: "인기순") + case 2: + return TMBarItem(title: "무료") + case 3: + return TMBarItem(title: "유료") + default: + let title = "Page \(index)" + return TMBarItem(title: title) + } + + } + + func numberOfViewControllers(in pageboyViewController: PageboyViewController) -> Int { + return viewControllers.count + } + + func viewController(for pageboyViewController: PageboyViewController, at index: PageboyViewController.PageIndex) -> UIViewController? { + return viewControllers[index] + } + + func defaultPage(for pageboyViewController: PageboyViewController) -> PageboyViewController.Page? { + return nil + } +} + diff --git a/Hyangyu/Hyangyu/Sources/ViewControllers/Category/NewVC.swift b/Hyangyu/Hyangyu/Sources/ViewControllers/Category/NewVC.swift new file mode 100644 index 0000000..cdb2112 --- /dev/null +++ b/Hyangyu/Hyangyu/Sources/ViewControllers/Category/NewVC.swift @@ -0,0 +1,114 @@ +// +// NewVC.swift +// Hyangyu +// +// Created by 홍희수 on 2022/02/08. +// + +import UIKit + +class NewVC: UIViewController { + + @IBOutlet weak var newCollectionView: UICollectionView! + + var cardList: [ServiceDataModel] = [] + + let categoryTabStoryboard: UIStoryboard = UIStoryboard(name: "CategoryTab", bundle: nil) + + override func viewDidLoad() { + super.viewDidLoad() + + setCardList() + + newCollectionView.delegate = self + newCollectionView.dataSource = self + + registerXib() + } + + func registerXib() { + let nibName = UINib(nibName: "CategoryCollectionViewCell", bundle: nil) + newCollectionView.register(nibName, forCellWithReuseIdentifier: "CategoryCollectionViewCell") + } + + //아까 선언해둔 cardList형 Array에 정보를 넣는 함수 + func setCardList(){ + cardList.append(contentsOf: [ + ServiceDataModel(iconImageName: "poster", title: "라이프 사진전: 더 라스트 프린트", placeTitle: "세종문화회관 미술관", dateTitle: "2021.05.11~08.21"), + ServiceDataModel(iconImageName: "poster", title: "라이프 사진전: 더 라스트 프린트", placeTitle: "세종문화회관 미술관", dateTitle: "2021.05.11~08.21"), + ServiceDataModel(iconImageName: "poster", title: "라이프 사진전: 더 라스트 프린트", placeTitle: "세종문화회관 미술관", dateTitle: "2021.05.11~08.21"), + ServiceDataModel(iconImageName: "poster", title: "라이프 사진전: 더 라스트 프린트", placeTitle: "세종문화회관 미술관", dateTitle: "2021.05.11~08.21"), + ServiceDataModel(iconImageName: "poster", title: "라이프 사진전: 더 라스트 프린트", placeTitle: "세종문화회관 미술관", dateTitle: "2021.05.11~08.21") + ]) + } + +} + +extension NewVC : UICollectionViewDataSource +{ + // cell을 몇개를 만들건지 -> cardList의 원소 개수만큼 만듬! + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + cardList.count + } + + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + + /* + 재사용큐를 활용해서 Cell을 가져오거나/생성 + -> identifier를 통해 Cell을 구분하고 indexPath를 통해 순서를 관리 + -> guard - let 구문을 통해 안전하게 값을 가져와서 cell에 넣어준다 + */ + guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "CategoryCollectionViewCell", for: indexPath) as? CategoryCollectionViewCell else { + return UICollectionViewCell() + } + + // 위에서 생성한 cell에 대해서 값을 cardList의 값으로 채움 + cell.setData(iconName: cardList[indexPath.row].iconImageName, title: cardList[indexPath.row].title, placeTitle: cardList[indexPath.row].placeTitle, dateTitle: cardList[indexPath.row].dateTitle) + + // 위 코드를 작성하면 cell에는 데이터가 담겨있는데 해당 cell을 return! + return cell + } +} + +extension NewVC : UICollectionViewDelegate +{ + +} + +extension NewVC : UICollectionViewDelegateFlowLayout +{ + /* + sizeForItemAt : 각 Cell들의 크기를 CGSize 형태로 return + indexPath를 가져와서 row나 section별로 다르게 크기 지정도 가능 + */ + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { + + // 현재 실행하고 있는 기기의 width + let width = UIScreen.main.bounds.width + + // 304, 184 + let cellWidth = width * (304/375) + let cellHeight = cellWidth * (184/304) + + return CGSize(width: cellWidth, height: cellHeight) + + } + + /* + ContentInset : Cell에서 Content 외부에 존재하는 Inset의 크기를 결정 + */ + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets { + return UIEdgeInsets(top: 10, left: 0, bottom: 10, right: 0) + } + + // minimumLineSpacing : Cell들의 위, 아래 간격 지정 + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat { + return 10 + } + + // minimumInteritemSpacing : Cell들의 좌, 우 간격 지정 + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat { + return 0 + } +} + diff --git a/Hyangyu/Hyangyu/Sources/ViewControllers/CategoryViewController.swift b/Hyangyu/Hyangyu/Sources/ViewControllers/CategoryViewController.swift index 91f7766..ee6abe2 100644 --- a/Hyangyu/Hyangyu/Sources/ViewControllers/CategoryViewController.swift +++ b/Hyangyu/Hyangyu/Sources/ViewControllers/CategoryViewController.swift @@ -13,34 +13,34 @@ class CategoryViewController: UIViewController { var fair = "박람회" var festival = "페스티벌" -// // 화면 전환 스토리보드 -// let detailCategoryStoryboard : UIStoryboard = UIStoryboard(name: "DetailCategoryTab", bundle: nil) -// override func viewDidLoad() { -// super.viewDidLoad() -// -// // Do any additional setup after loading the view. -// } -// -// // 화면 전환 -// -// @IBAction func exhibitionButtonClicked(_ sender: Any) { -// guard let nextVC = detailCategoryStoryboard.instantiateViewController(identifier: "DetailCategoryViewController") as? DetailCategoryViewController else {return} -// -// nextVC.categoryTabTitle = exhibition // 카테고리 title 이름 -// self.navigationController?.pushViewController(nextVC, animated: true) -// } -// -// @IBAction func fairButtonClicked(_ sender: Any) { -// guard let nextVC = detailCategoryStoryboard.instantiateViewController(identifier: "DetailCategoryViewController") as? DetailCategoryViewController else {return} -// -// nextVC.categoryTabTitle = fair // 카테고리 title 이름 -// self.navigationController?.pushViewController(nextVC, animated: true) -// } -// -// @IBAction func festivalButtonClicked(_ sender: Any) { -// guard let nextVC = detailCategoryStoryboard.instantiateViewController(identifier: "DetailCategoryViewController") as? DetailCategoryViewController else {return} -// -// nextVC.categoryTabTitle = festival // 카테고리 title 이름 -// self.navigationController?.pushViewController(nextVC, animated: true) -// } + // 화면 전환 스토리보드 + let detailCategoryStoryboard : UIStoryboard = UIStoryboard(name: "CategoryDetailPage", bundle: nil) + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + } + + // 화면 전환 + + @IBAction func exhibitionButtonClicked(_ sender: Any) { + guard let nextVC = detailCategoryStoryboard.instantiateViewController(identifier: "HomeVC") as? HomeVC else {return} + + nextVC.categoryTabTitle = exhibition // 카테고리 title 이름 + self.navigationController?.pushViewController(nextVC, animated: true) + } + + @IBAction func fairButtonClicked(_ sender: Any) { + guard let nextVC = detailCategoryStoryboard.instantiateViewController(identifier: "HomeVC") as? HomeVC else {return} + + nextVC.categoryTabTitle = fair // 카테고리 title 이름 + self.navigationController?.pushViewController(nextVC, animated: true) + } + + @IBAction func festivalButtonClicked(_ sender: Any) { + guard let nextVC = detailCategoryStoryboard.instantiateViewController(identifier: "HomeVC") as? HomeVC else {return} + + nextVC.categoryTabTitle = festival // 카테고리 title 이름 + self.navigationController?.pushViewController(nextVC, animated: true) + } } diff --git a/Hyangyu/Hyangyu/Sources/ViewControllers/MoreReviewViewController.swift b/Hyangyu/Hyangyu/Sources/ViewControllers/MoreReviewViewController.swift index 6eae986..029bdc0 100644 --- a/Hyangyu/Hyangyu/Sources/ViewControllers/MoreReviewViewController.swift +++ b/Hyangyu/Hyangyu/Sources/ViewControllers/MoreReviewViewController.swift @@ -11,7 +11,7 @@ class MoreReviewViewController: UIViewController { @IBOutlet weak var reviewCollectionView: UICollectionView! - private var reviewList : [ReviewDataModel] = [] + private var reviewList : [ReviewModel] = [] override func viewDidLoad() { super.viewDidLoad() @@ -31,13 +31,13 @@ class MoreReviewViewController: UIViewController { func setReviewList() { reviewList.append(contentsOf: [ - ReviewDataModel(nickName: "수야", createTime: "2022-02-07", reviewContent: "이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. "), + ReviewModel(nickName: "수야", createTime: "2022-02-07", reviewContent: "이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. "), - ReviewDataModel(nickName: "수야", createTime: "2022-02-07", reviewContent: "전시회 짱이에요"), + ReviewModel(nickName: "수야", createTime: "2022-02-07", reviewContent: "전시회 짱이에요"), - ReviewDataModel(nickName: "수야", createTime: "2022-02-07", reviewContent: "이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. "), + ReviewModel(nickName: "수야", createTime: "2022-02-07", reviewContent: "이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. "), - ReviewDataModel(nickName: "수야", createTime: "2022-02-07", reviewContent: "이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입//. ") + ReviewModel(nickName: "수야", createTime: "2022-02-07", reviewContent: "이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입니다. 이 글은 300자 입//. ") ]) } diff --git a/Hyangyu/Hyangyu/Sources/ViewModels/ReviewDataModel.swift b/Hyangyu/Hyangyu/Sources/ViewModels/ReviewDataModel.swift deleted file mode 100644 index 3bae739..0000000 --- a/Hyangyu/Hyangyu/Sources/ViewModels/ReviewDataModel.swift +++ /dev/null @@ -1,8 +0,0 @@ -import Foundation - -struct ReviewDataModel { - var title: String - var review: String - var data: String - var scope: Double -}