From ed7e2b47448a85560ca5996393a9a7911fd95f36 Mon Sep 17 00:00:00 2001 From: Noah Date: Fri, 24 Dec 2021 23:17:00 +0900 Subject: [PATCH 1/5] =?UTF-8?q?=F0=9F=8D=B1[ADD]=20:=207=EC=A3=BC=EC=B0=A8?= =?UTF-8?q?=20=EA=B3=BC=EC=A0=9C=20=EC=97=90=EC=85=8B=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../icn_dismissBtn.imageset/Contents.json | 23 ++++++++++++++++++ .../icn_dismissBtn.png | Bin 0 -> 188 bytes .../icn_dismissBtn@2x.png | Bin 0 -> 230 bytes .../icn_dismissBtn@3x.png | Bin 0 -> 268 bytes .../icn_expandBtn.imageset/Contents.json | 23 ++++++++++++++++++ .../icn_expandBtn.imageset/icn_expandBtn.png | Bin 0 -> 210 bytes .../icn_expandBtn@2x.png | Bin 0 -> 280 bytes .../icn_expandBtn@3x.png | Bin 0 -> 364 bytes 8 files changed, 46 insertions(+) create mode 100644 Assignment/29th-assignment/29th-assignment/Assets.xcassets/icn_dismissBtn.imageset/Contents.json create mode 100644 Assignment/29th-assignment/29th-assignment/Assets.xcassets/icn_dismissBtn.imageset/icn_dismissBtn.png create mode 100644 Assignment/29th-assignment/29th-assignment/Assets.xcassets/icn_dismissBtn.imageset/icn_dismissBtn@2x.png create mode 100644 Assignment/29th-assignment/29th-assignment/Assets.xcassets/icn_dismissBtn.imageset/icn_dismissBtn@3x.png create mode 100644 Assignment/29th-assignment/29th-assignment/Assets.xcassets/icn_expandBtn.imageset/Contents.json create mode 100644 Assignment/29th-assignment/29th-assignment/Assets.xcassets/icn_expandBtn.imageset/icn_expandBtn.png create mode 100644 Assignment/29th-assignment/29th-assignment/Assets.xcassets/icn_expandBtn.imageset/icn_expandBtn@2x.png create mode 100644 Assignment/29th-assignment/29th-assignment/Assets.xcassets/icn_expandBtn.imageset/icn_expandBtn@3x.png diff --git a/Assignment/29th-assignment/29th-assignment/Assets.xcassets/icn_dismissBtn.imageset/Contents.json b/Assignment/29th-assignment/29th-assignment/Assets.xcassets/icn_dismissBtn.imageset/Contents.json new file mode 100644 index 0000000..51a2ece --- /dev/null +++ b/Assignment/29th-assignment/29th-assignment/Assets.xcassets/icn_dismissBtn.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "icn_dismissBtn.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "icn_dismissBtn@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "icn_dismissBtn@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Assignment/29th-assignment/29th-assignment/Assets.xcassets/icn_dismissBtn.imageset/icn_dismissBtn.png b/Assignment/29th-assignment/29th-assignment/Assets.xcassets/icn_dismissBtn.imageset/icn_dismissBtn.png new file mode 100644 index 0000000000000000000000000000000000000000..c044b8b1591774112c155af4db1eafbe9609207f GIT binary patch literal 188 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9GG!XV7ZFl&wkP>``W z$lZxy-8q?;Kn_c~qpu?a!^VE@KZ&eBexRp|V@L(#+y0B33dqc@1$7&2fQX`ne}lUdutkgoZ>nX fe@|iKC+Dnx`ZJdwGgH|OG@QZH)z4*}Q$iB}i)%l( literal 0 HcmV?d00001 diff --git a/Assignment/29th-assignment/29th-assignment/Assets.xcassets/icn_dismissBtn.imageset/icn_dismissBtn@2x.png b/Assignment/29th-assignment/29th-assignment/Assets.xcassets/icn_dismissBtn.imageset/icn_dismissBtn@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..6d8fb4603530ec6535eef276ae40867e46243afd GIT binary patch literal 230 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz&H|6fVg?2=RS;(M3{v?36l5$8 za(7}_cTVOdki(Mh=gqxBdssfB!G3|7=+y z;JD<5if- literal 0 HcmV?d00001 diff --git a/Assignment/29th-assignment/29th-assignment/Assets.xcassets/icn_dismissBtn.imageset/icn_dismissBtn@3x.png b/Assignment/29th-assignment/29th-assignment/Assets.xcassets/icn_dismissBtn.imageset/icn_dismissBtn@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..c06c148ad3482c6ed764adc4bbf018944373e362 GIT binary patch literal 268 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezpTC&H|6fVg?393lL^>oo1K-6l5$8 za(7}_cTVOdki(Mh=wd=l|`+wiY$EBan z*$Tei9(McPDp$SdtCaQr{W;VnBKh(2V`XJIYdfV!A0JmMU6Q#kH1XY!SsjzU{^;u1 zb39*4d5w>j@|vDJw}_dsE)m8S9UIa%b#F-9;uZn4^g#SCrgouu6Ta}XegbkCJYD@< J);T3K0RU^LWtsp0 literal 0 HcmV?d00001 diff --git a/Assignment/29th-assignment/29th-assignment/Assets.xcassets/icn_expandBtn.imageset/Contents.json b/Assignment/29th-assignment/29th-assignment/Assets.xcassets/icn_expandBtn.imageset/Contents.json new file mode 100644 index 0000000..f63c269 --- /dev/null +++ b/Assignment/29th-assignment/29th-assignment/Assets.xcassets/icn_expandBtn.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "icn_expandBtn.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "icn_expandBtn@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "icn_expandBtn@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Assignment/29th-assignment/29th-assignment/Assets.xcassets/icn_expandBtn.imageset/icn_expandBtn.png b/Assignment/29th-assignment/29th-assignment/Assets.xcassets/icn_expandBtn.imageset/icn_expandBtn.png new file mode 100644 index 0000000000000000000000000000000000000000..8f83e32f0e115eced225b2996dbd359d19c34b32 GIT binary patch literal 210 zcmeAS@N?(olHy`uVBq!ia0vp^QXtI11|(N{`J4k%oCO|{#S9GG!XV7ZFl&wkP>``W z$lZxy-8q?;Kn_c~qpu?a!^VE@KZ&eBe!8cNV@L(#+ersG4=C`s=ALDcT)4XAQs1Re zDs$LmdKI;Vst0L}er@Bjb+ literal 0 HcmV?d00001 diff --git a/Assignment/29th-assignment/29th-assignment/Assets.xcassets/icn_expandBtn.imageset/icn_expandBtn@3x.png b/Assignment/29th-assignment/29th-assignment/Assets.xcassets/icn_expandBtn.imageset/icn_expandBtn@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..cc992eed970f00ee022d40a7ead70b21666bd0f3 GIT binary patch literal 364 zcmeAS@N?(olHy`uVBq!ia0vp^ejv=j1|<7dDaZmT&H|6fVg?393lL^>oo1K-6l5$8 za(7}_cTVOdki(Mh=ht@BdVw$2eHP^0L zx{iYLV@?X34{2XWIm_YUSD%cHaCFS=_fH(kV64?)cfRYg`+i7tD5(ex9*S zb&5&M^-})7)^_`E3+L<2%2<{b?R4{8Ve#yEt2;^c-}O%(K6#Jh-XhOw1)EIUj%Q5L zowLUE;;m$plTv=u9=*H^WXSo|9i9D2$Ty~C^45xZi#lf)Jo@Tna6HuFV}bS7*4+h@ nezX0%RAgtwgm5{K6?0G8Z_T5-qI-5TgTy^u{an^LB{Ts5`1Fh5 literal 0 HcmV?d00001 From 1ad0d6dd97aaa5ae12ed469e473ce2277ccd005e Mon Sep 17 00:00:00 2001 From: Noah Date: Fri, 24 Dec 2021 23:27:49 +0900 Subject: [PATCH 2/5] =?UTF-8?q?=E2=9C=A8[FEAT]=20:=20imageView=20tap=20ges?= =?UTF-8?q?ture=20recognizer=20=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/Home/Cells/ThumbnailTVC.swift | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/Assignment/29th-assignment/29th-assignment/Screens/Home/Cells/ThumbnailTVC.swift b/Assignment/29th-assignment/29th-assignment/Screens/Home/Cells/ThumbnailTVC.swift index f4ffef6..cf4e9af 100644 --- a/Assignment/29th-assignment/29th-assignment/Screens/Home/Cells/ThumbnailTVC.swift +++ b/Assignment/29th-assignment/29th-assignment/Screens/Home/Cells/ThumbnailTVC.swift @@ -11,13 +11,14 @@ class ThumbnailTVC: UITableViewCell { var manager = HomeManager.shared - @IBOutlet weak var thumbnailImage: UIImageView! - @IBOutlet weak var profileImage: UIImageView! - @IBOutlet weak var thumbnailTitle: UILabel! - @IBOutlet weak var infoLabel: UILabel! + @IBOutlet weak var thumbnailImage: UIImageView? + @IBOutlet weak var profileImage: UIImageView? + @IBOutlet weak var thumbnailTitle: UILabel? + @IBOutlet weak var infoLabel: UILabel? override func awakeFromNib() { super.awakeFromNib() + initTapGestureForImageView() } override func setSelected(_ selected: Bool, animated: Bool) { @@ -30,11 +31,24 @@ extension ThumbnailTVC: CellProtocol { static let identifier = "ThumbnailTVC" func getCellConfigureAt(_ index: Int) { - thumbnailImage.image = manager.getThumbnailImage(index) - thumbnailTitle.text = manager.getThumbnailTitle(index) + thumbnailImage?.image = manager.getThumbnailImage(index) + thumbnailTitle?.text = manager.getThumbnailTitle(index) let author = manager.getThumbnailAuthor(index) let views = manager.getThumbnailViews(index) let created = manager.getThumbnailCreatedDate(index) - infoLabel.text = "\(author) ・ 조회수 \(views) ・ \(created)" + infoLabel?.text = "\(author) ・ 조회수 \(views) ・ \(created)" + } +} + +extension ThumbnailTVC { + private func initTapGestureForImageView() { + let tapRecognizer = UITapGestureRecognizer(target: self, + action: #selector(self.didTapProfileImage)) + thumbnailImage?.addGestureRecognizer(tapRecognizer) + thumbnailImage?.isUserInteractionEnabled = true + } + + @objc func didTapProfileImage() { + // doSomething() } } From 846f3507aa7bc81f3ceb909f1b3e10b07d85101d Mon Sep 17 00:00:00 2001 From: Noah Date: Fri, 24 Dec 2021 23:41:14 +0900 Subject: [PATCH 3/5] =?UTF-8?q?=F0=9F=92=84[MOD]=20:=20Home=20->=20DetailC?= =?UTF-8?q?otent=20=ED=99=94=EB=A9=B4=EC=A0=84=ED=99=98=20UI=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 --- .../29th-assignment.xcodeproj/project.pbxproj | 16 ++++ .../Screens/Home/Cells/ThumbnailTVC.xib | 3 +- .../Home/Storyboard/DetailContent.storyboard | 95 +++++++++++++++++++ .../Screens/Home/Storyboard/Home.storyboard | 2 +- 4 files changed, 114 insertions(+), 2 deletions(-) create mode 100644 Assignment/29th-assignment/29th-assignment/Screens/Home/Storyboard/DetailContent.storyboard diff --git a/Assignment/29th-assignment/29th-assignment.xcodeproj/project.pbxproj b/Assignment/29th-assignment/29th-assignment.xcodeproj/project.pbxproj index d7eb50b..20c82a8 100644 --- a/Assignment/29th-assignment/29th-assignment.xcodeproj/project.pbxproj +++ b/Assignment/29th-assignment/29th-assignment.xcodeproj/project.pbxproj @@ -50,6 +50,10 @@ 4FD1828A270DD75900BC7DE2 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4FD18288270DD75900BC7DE2 /* LaunchScreen.storyboard */; }; 4FD182B627104CFB00BC7DE2 /* SignUpVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FD182B527104CFB00BC7DE2 /* SignUpVC.swift */; }; 4FD182B82710658E00BC7DE2 /* CompleteVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FD182B72710658E00BC7DE2 /* CompleteVC.swift */; }; + 4FDDACC22775F50E004DBF03 /* DetailContent.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4FDDACC12775F50E004DBF03 /* DetailContent.storyboard */; }; + 4FDDACC42775F5D0004DBF03 /* DetailContentVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FDDACC32775F5D0004DBF03 /* DetailContentVC.swift */; }; + 4FDDACC62775F941004DBF03 /* DetailContent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FDDACC52775F941004DBF03 /* DetailContent.swift */; }; + 4FDDACC827760078004DBF03 /* PresentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FDDACC727760078004DBF03 /* PresentView.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -99,6 +103,10 @@ 4FD1828B270DD75900BC7DE2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 4FD182B527104CFB00BC7DE2 /* SignUpVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignUpVC.swift; sourceTree = ""; }; 4FD182B72710658E00BC7DE2 /* CompleteVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CompleteVC.swift; sourceTree = ""; }; + 4FDDACC12775F50E004DBF03 /* DetailContent.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = DetailContent.storyboard; sourceTree = ""; }; + 4FDDACC32775F5D0004DBF03 /* DetailContentVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailContentVC.swift; sourceTree = ""; }; + 4FDDACC52775F941004DBF03 /* DetailContent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailContent.swift; sourceTree = ""; }; + 4FDDACC727760078004DBF03 /* PresentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PresentView.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -188,6 +196,7 @@ 4F4256EF2722202D0001F62E /* HomeVC.swift */, 4F819C55272BF4EA008B41DD /* HomeVC+CollectionView.swift */, 4F819C4D272BE38C008B41DD /* HomeVC+TableView.swift */, + 4FDDACC32775F5D0004DBF03 /* DetailContentVC.swift */, ); path = Controller; sourceTree = ""; @@ -196,6 +205,7 @@ isa = PBXGroup; children = ( 4F4256ED27221A7F0001F62E /* Home.storyboard */, + 4FDDACC12775F50E004DBF03 /* DetailContent.storyboard */, ); path = Storyboard; sourceTree = ""; @@ -320,6 +330,7 @@ 4F819C49272BD8CF008B41DD /* HomeManager.swift */, 4F819C53272BF20D008B41DD /* Channel.swift */, 4F838C91272DA871008D4DFB /* Tag.swift */, + 4FDDACC52775F941004DBF03 /* DetailContent.swift */, ); path = Model; sourceTree = ""; @@ -331,6 +342,7 @@ 4F838C9C272DB2C3008D4DFB /* ChannelManger.swift */, 4F838C9E272DB2EA008D4DFB /* ThumbnailManager.swift */, 4F838CA0272DB481008D4DFB /* TagManager.swift */, + 4FDDACC727760078004DBF03 /* PresentView.swift */, ); path = Protocols; sourceTree = ""; @@ -456,6 +468,7 @@ files = ( 4F4256E1272217870001F62E /* TabBar.storyboard in Resources */, 4F4256EE27221A7F0001F62E /* Home.storyboard in Resources */, + 4FDDACC22775F50E004DBF03 /* DetailContent.storyboard in Resources */, 4F819C45272BCA6B008B41DD /* ThumbnailTVC.xib in Resources */, 4F4256FE2722246B0001F62E /* Add.storyboard in Resources */, 4FD1828A270DD75900BC7DE2 /* LaunchScreen.storyboard in Resources */, @@ -485,6 +498,7 @@ 4F819C54272BF20D008B41DD /* Channel.swift in Sources */, 4FD182B627104CFB00BC7DE2 /* SignUpVC.swift in Sources */, 4F4256F02722202D0001F62E /* HomeVC.swift in Sources */, + 4FDDACC62775F941004DBF03 /* DetailContent.swift in Sources */, 4F4256E52722184B0001F62E /* TBC.swift in Sources */, 4F819C48272BD1B2008B41DD /* Thumbnail.swift in Sources */, 4F838C95272DA98E008D4DFB /* CellProtocol.swift in Sources */, @@ -499,6 +513,7 @@ 4F819C56272BF4EA008B41DD /* HomeVC+CollectionView.swift in Sources */, 4F838C9F272DB2EA008D4DFB /* ThumbnailManager.swift in Sources */, 4FD18280270DD75700BC7DE2 /* SceneDelegate.swift in Sources */, + 4FDDACC42775F5D0004DBF03 /* DetailContentVC.swift in Sources */, 4F838C9A272DAEF0008D4DFB /* TagCVC.swift in Sources */, 4F838C9D272DB2C4008D4DFB /* ChannelManger.swift in Sources */, 4F819C44272BCA6B008B41DD /* ThumbnailTVC.swift in Sources */, @@ -506,6 +521,7 @@ 4FB8EFCD2741055200A5BB7E /* UserSignService.swift in Sources */, 4F2AE03227426577006785E4 /* UIViewController+makeAlert.swift in Sources */, 4FB8EFD32741263A00A5BB7E /* AuthResponse.swift in Sources */, + 4FDDACC827760078004DBF03 /* PresentView.swift in Sources */, 4F01E4DB272FD9A200785744 /* UIView+IBInspectable.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/Assignment/29th-assignment/29th-assignment/Screens/Home/Cells/ThumbnailTVC.xib b/Assignment/29th-assignment/29th-assignment/Screens/Home/Cells/ThumbnailTVC.xib index f88e447..63be2d3 100644 --- a/Assignment/29th-assignment/29th-assignment/Screens/Home/Cells/ThumbnailTVC.xib +++ b/Assignment/29th-assignment/29th-assignment/Screens/Home/Cells/ThumbnailTVC.xib @@ -9,7 +9,7 @@ - + @@ -18,6 +18,7 @@ + diff --git a/Assignment/29th-assignment/29th-assignment/Screens/Home/Storyboard/DetailContent.storyboard b/Assignment/29th-assignment/29th-assignment/Screens/Home/Storyboard/DetailContent.storyboard new file mode 100644 index 0000000..9f25c86 --- /dev/null +++ b/Assignment/29th-assignment/29th-assignment/Screens/Home/Storyboard/DetailContent.storyboard @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Assignment/29th-assignment/29th-assignment/Screens/Home/Storyboard/Home.storyboard b/Assignment/29th-assignment/29th-assignment/Screens/Home/Storyboard/Home.storyboard index 710969d..f7562be 100644 --- a/Assignment/29th-assignment/29th-assignment/Screens/Home/Storyboard/Home.storyboard +++ b/Assignment/29th-assignment/29th-assignment/Screens/Home/Storyboard/Home.storyboard @@ -17,7 +17,7 @@ - + From 7cb3aa2757055d51cbedc71877b1ff597781d340 Mon Sep 17 00:00:00 2001 From: Noah Date: Fri, 24 Dec 2021 23:44:30 +0900 Subject: [PATCH 4/5] =?UTF-8?q?=E2=9C=A8[FEAT]=20:=20Detail=20Content=20Vi?= =?UTF-8?q?ew=20model,=20controller=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Home/Controller/DetailContentVC.swift | 36 +++++++++++++++++++ .../Screens/Home/Model/DetailContent.swift | 14 ++++++++ 2 files changed, 50 insertions(+) create mode 100644 Assignment/29th-assignment/29th-assignment/Screens/Home/Controller/DetailContentVC.swift create mode 100644 Assignment/29th-assignment/29th-assignment/Screens/Home/Model/DetailContent.swift diff --git a/Assignment/29th-assignment/29th-assignment/Screens/Home/Controller/DetailContentVC.swift b/Assignment/29th-assignment/29th-assignment/Screens/Home/Controller/DetailContentVC.swift new file mode 100644 index 0000000..6a93e44 --- /dev/null +++ b/Assignment/29th-assignment/29th-assignment/Screens/Home/Controller/DetailContentVC.swift @@ -0,0 +1,36 @@ +// +// DetailContentVC.swift +// 29th-assignment +// +// Created by Noah on 2021/12/24. +// + +import UIKit + +class DetailContentVC: UIViewController { + + @IBOutlet private weak var contentImage: UIImageView? + @IBOutlet private weak var contentTitle: UILabel? + @IBOutlet private weak var contentInfo: UILabel? + + lazy var contentData = DetailContent() + + override func viewDidLoad() { + super.viewDidLoad() + setUI() + } + + @IBAction func dismissBtnDidTap(_ sender: Any) { + dismiss(animated: true) + } +} + +extension DetailContentVC { + static let identifier = "DetailContentVC" + + private func setUI() { + contentImage?.image = contentData.contentImage + contentTitle?.text = contentData.contentTitle + contentInfo?.text = contentData.contentInfo + } +} diff --git a/Assignment/29th-assignment/29th-assignment/Screens/Home/Model/DetailContent.swift b/Assignment/29th-assignment/29th-assignment/Screens/Home/Model/DetailContent.swift new file mode 100644 index 0000000..e2042f0 --- /dev/null +++ b/Assignment/29th-assignment/29th-assignment/Screens/Home/Model/DetailContent.swift @@ -0,0 +1,14 @@ +// +// DetailContent.swift +// 29th-assignment +// +// Created by Noah on 2021/12/24. +// + +import UIKit + +struct DetailContent { + var contentImage: UIImage? + var contentTitle: String? + var contentInfo: String? +} From b18a5241582a2239d76db60e90cf71926f647276 Mon Sep 17 00:00:00 2001 From: Noah Date: Fri, 24 Dec 2021 23:45:22 +0900 Subject: [PATCH 5/5] =?UTF-8?q?=E2=9C=A8[FEAT]=20:=20imageView=20tap?= =?UTF-8?q?=EB=90=98=EC=97=88=EC=9D=84=20=EB=95=8C=20=ED=99=94=EB=A9=B4?= =?UTF-8?q?=EC=A0=84=ED=99=98=20=EA=B5=AC=ED=98=84=20-=20PresentView.swift?= =?UTF-8?q?=20:=20=ED=99=94=EB=A9=B4=EC=A0=84=ED=99=98=20Protocol=EA=B5=AC?= =?UTF-8?q?=ED=98=84=20-=20HomeVC+TableView.swift=20:=20=ED=99=94=EB=A9=B4?= =?UTF-8?q?=EC=A0=84=ED=99=98=20delegate=EA=B5=AC=ED=98=84=20=EB=B0=8F=20P?= =?UTF-8?q?rotocol=20=EC=B1=84=ED=83=9D=20-=20ThumbnailTVC.swift=20:=20?= =?UTF-8?q?=ED=99=94=EB=A9=B4=EC=A0=84=ED=99=98=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../29th-assignment/Protocols/PresentView.swift | 12 ++++++++++++ .../Screens/Home/Cells/ThumbnailTVC.swift | 16 +++++++++++++--- .../Home/Controller/HomeVC+TableView.swift | 9 +++++++++ 3 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 Assignment/29th-assignment/29th-assignment/Protocols/PresentView.swift diff --git a/Assignment/29th-assignment/29th-assignment/Protocols/PresentView.swift b/Assignment/29th-assignment/29th-assignment/Protocols/PresentView.swift new file mode 100644 index 0000000..66bf82f --- /dev/null +++ b/Assignment/29th-assignment/29th-assignment/Protocols/PresentView.swift @@ -0,0 +1,12 @@ +// +// PresentView.swift +// 29th-assignment +// +// Created by Noah on 2021/12/24. +// + +import UIKit + +protocol PresentView: AnyObject { + func present(viewController: UIViewController) +} diff --git a/Assignment/29th-assignment/29th-assignment/Screens/Home/Cells/ThumbnailTVC.swift b/Assignment/29th-assignment/29th-assignment/Screens/Home/Cells/ThumbnailTVC.swift index cf4e9af..db9882a 100644 --- a/Assignment/29th-assignment/29th-assignment/Screens/Home/Cells/ThumbnailTVC.swift +++ b/Assignment/29th-assignment/29th-assignment/Screens/Home/Cells/ThumbnailTVC.swift @@ -10,6 +10,7 @@ import UIKit class ThumbnailTVC: UITableViewCell { var manager = HomeManager.shared + weak var delegate: PresentView? @IBOutlet weak var thumbnailImage: UIImageView? @IBOutlet weak var profileImage: UIImageView? @@ -43,12 +44,21 @@ extension ThumbnailTVC: CellProtocol { extension ThumbnailTVC { private func initTapGestureForImageView() { let tapRecognizer = UITapGestureRecognizer(target: self, - action: #selector(self.didTapProfileImage)) + action: #selector(self.profileImageDidTap)) thumbnailImage?.addGestureRecognizer(tapRecognizer) thumbnailImage?.isUserInteractionEnabled = true } - @objc func didTapProfileImage() { - // doSomething() + @objc func profileImageDidTap() { + let detailContentSB = UIStoryboard(name: "DetailContent", bundle: nil) + guard let detailContentVC = detailContentSB.instantiateViewController(withIdentifier: DetailContentVC.identifier) as? DetailContentVC + else { return } + detailContentVC.modalPresentationStyle = .fullScreen + + let detailContentData = DetailContent(contentImage: thumbnailImage?.image, + contentTitle: thumbnailTitle?.text, + contentInfo: infoLabel?.text) + detailContentVC.contentData = detailContentData + delegate?.present(viewController: detailContentVC) } } diff --git a/Assignment/29th-assignment/29th-assignment/Screens/Home/Controller/HomeVC+TableView.swift b/Assignment/29th-assignment/29th-assignment/Screens/Home/Controller/HomeVC+TableView.swift index 723f8b5..22d9106 100644 --- a/Assignment/29th-assignment/29th-assignment/Screens/Home/Controller/HomeVC+TableView.swift +++ b/Assignment/29th-assignment/29th-assignment/Screens/Home/Controller/HomeVC+TableView.swift @@ -20,7 +20,16 @@ extension HomeVC: UITableViewDataSource { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { guard let cell = tableView.dequeueReusableCell(withIdentifier: ThumbnailTVC.identifier) as? ThumbnailTVC else { return UITableViewCell() } + cell.getCellConfigureAt(indexPath.row) + cell.delegate = self + return cell } } + +extension HomeVC: PresentView { + func present(viewController: UIViewController) { + self.present(viewController, animated: true) + } +}