diff --git a/29th_Youtube/29th_Youtube.xcodeproj/project.pbxproj b/29th_Youtube/29th_Youtube.xcodeproj/project.pbxproj index 4be4e26..ad2d016 100644 --- a/29th_Youtube/29th_Youtube.xcodeproj/project.pbxproj +++ b/29th_Youtube/29th_Youtube.xcodeproj/project.pbxproj @@ -7,6 +7,8 @@ objects = { /* Begin PBXBuildFile section */ + 7734D5AE277603DA004360E4 /* DetailVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7734D5AC277603DA004360E4 /* DetailVC.swift */; }; + 7734D5AF277603DA004360E4 /* DetailVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7734D5AD277603DA004360E4 /* DetailVC.xib */; }; 7766D29C272C3C6000FE6E2E /* ChannelCVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7766D29A272C3C6000FE6E2E /* ChannelCVC.swift */; }; 7766D29D272C3C6000FE6E2E /* ChannelCVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7766D29B272C3C6000FE6E2E /* ChannelCVC.xib */; }; 7766D2A0272C3EEB00FE6E2E /* HomeXibVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7766D29E272C3EEB00FE6E2E /* HomeXibVC.swift */; }; @@ -39,6 +41,8 @@ /* Begin PBXFileReference section */ 1515ED822D173FDD791B030B /* Pods-29th_Youtube.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-29th_Youtube.debug.xcconfig"; path = "Target Support Files/Pods-29th_Youtube/Pods-29th_Youtube.debug.xcconfig"; sourceTree = ""; }; 2EE899D37341854FCE6A52A4 /* Pods-29th_Youtube.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-29th_Youtube.release.xcconfig"; path = "Target Support Files/Pods-29th_Youtube/Pods-29th_Youtube.release.xcconfig"; sourceTree = ""; }; + 7734D5AC277603DA004360E4 /* DetailVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailVC.swift; sourceTree = ""; }; + 7734D5AD277603DA004360E4 /* DetailVC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = DetailVC.xib; sourceTree = ""; }; 7766D29A272C3C6000FE6E2E /* ChannelCVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChannelCVC.swift; sourceTree = ""; }; 7766D29B272C3C6000FE6E2E /* ChannelCVC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ChannelCVC.xib; sourceTree = ""; }; 7766D29E272C3EEB00FE6E2E /* HomeXibVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeXibVC.swift; sourceTree = ""; }; @@ -91,6 +95,15 @@ path = Pods; sourceTree = ""; }; + 7734D5AB277603C3004360E4 /* DetailVC */ = { + isa = PBXGroup; + children = ( + 7734D5AC277603DA004360E4 /* DetailVC.swift */, + 7734D5AD277603DA004360E4 /* DetailVC.xib */, + ); + path = DetailVC; + sourceTree = ""; + }; 7766D299272C3C0200FE6E2E /* Cell */ = { isa = PBXGroup; children = ( @@ -227,6 +240,7 @@ 77FFCCE527105B40000E49F7 /* Sources */ = { isa = PBXGroup; children = ( + 7734D5AB277603C3004360E4 /* DetailVC */, 77DAC88B2721FDEE00B576D9 /* HomeVC */, 77DAC88C2721FDF400B576D9 /* ShortsVC */, 77DAC88D2721FDFB00B576D9 /* PlusVC */, @@ -331,6 +345,7 @@ buildActionMask = 2147483647; files = ( 7766D29D272C3C6000FE6E2E /* ChannelCVC.xib in Resources */, + 7734D5AF277603DA004360E4 /* DetailVC.xib in Resources */, 7766D2AC272C48C800FE6E2E /* ContentTVC.xib in Resources */, 77FFCCDD2710548D000E49F7 /* LaunchScreen.storyboard in Resources */, 77FFCCDA2710548D000E49F7 /* Assets.xcassets in Resources */, @@ -400,6 +415,7 @@ 77DAC89F2722071500B576D9 /* Constants.swift in Sources */, 77FFCCD127105488000E49F7 /* AppDelegate.swift in Sources */, 77DAC8972721FE7400B576D9 /* SubscribeVC.swift in Sources */, + 7734D5AE277603DA004360E4 /* DetailVC.swift in Sources */, 77FFCCD327105488000E49F7 /* SceneDelegate.swift in Sources */, 7766D2AB272C48C800FE6E2E /* ContentTVC.swift in Sources */, 77DAC8952721FE6000B576D9 /* PlusVC.swift in Sources */, diff --git a/29th_Youtube/29th_Youtube.xcodeproj/xcuserdata/yijoonchoi.xcuserdatad/xcschemes/xcschememanagement.plist b/29th_Youtube/29th_Youtube.xcodeproj/xcuserdata/yijoonchoi.xcuserdatad/xcschemes/xcschememanagement.plist index 51fb068..420859e 100644 --- a/29th_Youtube/29th_Youtube.xcodeproj/xcuserdata/yijoonchoi.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/29th_Youtube/29th_Youtube.xcodeproj/xcuserdata/yijoonchoi.xcuserdatad/xcschemes/xcschememanagement.plist @@ -7,7 +7,7 @@ 29th_Youtube.xcscheme_^#shared#^_ orderHint - 3 + 1 diff --git a/29th_Youtube/29th_Youtube/SceneDelegate.swift b/29th_Youtube/29th_Youtube/SceneDelegate.swift index df4b7b9..5ed1939 100644 --- a/29th_Youtube/29th_Youtube/SceneDelegate.swift +++ b/29th_Youtube/29th_Youtube/SceneDelegate.swift @@ -19,7 +19,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { guard let windowScene = (scene as? UIWindowScene) else { return } window = UIWindow(frame: windowScene.coordinateSpace.bounds) window?.windowScene = windowScene - let navigationController = UINavigationController(rootViewController: LoginVC()) + let navigationController = UINavigationController(rootViewController: HomeXibVC()) window?.rootViewController = navigationController window?.makeKeyAndVisible() } diff --git a/29th_Youtube/29th_Youtube/Sources/DetailVC/DetailVC.swift b/29th_Youtube/29th_Youtube/Sources/DetailVC/DetailVC.swift new file mode 100644 index 0000000..483fb94 --- /dev/null +++ b/29th_Youtube/29th_Youtube/Sources/DetailVC/DetailVC.swift @@ -0,0 +1,32 @@ +// +// DetailVC.swift +// 29th_Youtube +// +// Created by Yi Joon Choi on 2021/12/24. +// + +import UIKit + +class DetailVC: UIViewController { + + @IBOutlet weak var thumbnail: UIImageView! + @IBOutlet weak var videoTitle: UILabel! + @IBOutlet weak var videoDescription: UILabel! + + var contentList : ContentData? + + @IBAction func dismissVC(_ sender: Any) { + self.dismiss(animated: true, completion: nil) + } + override func viewDidLoad() { + super.viewDidLoad() + setUI() + } + + private func setUI() { + thumbnail.image = UIImage(named: contentList?.thumnbnail ?? "") + videoTitle.text = contentList?.contentTitle + videoDescription.text = contentList?.description + } + +} diff --git a/29th_Youtube/29th_Youtube/Sources/DetailVC/DetailVC.xib b/29th_Youtube/29th_Youtube/Sources/DetailVC/DetailVC.xib new file mode 100644 index 0000000..ca0c365 --- /dev/null +++ b/29th_Youtube/29th_Youtube/Sources/DetailVC/DetailVC.xib @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/29th_Youtube/29th_Youtube/Sources/HomeVC/Cell/ContentTVC.swift b/29th_Youtube/29th_Youtube/Sources/HomeVC/Cell/ContentTVC.swift index 74d9ba6..140a0d1 100644 --- a/29th_Youtube/29th_Youtube/Sources/HomeVC/Cell/ContentTVC.swift +++ b/29th_Youtube/29th_Youtube/Sources/HomeVC/Cell/ContentTVC.swift @@ -15,6 +15,8 @@ class ContentTVC: UITableViewCell { static let identifier = "ContentTVC" + var presentToDetailViewController: (() -> Void)? + override func awakeFromNib() { super.awakeFromNib() setUI() @@ -28,10 +30,21 @@ class ContentTVC: UITableViewCell { func setUI(){ descriptions.text = "WE SOPT : 조회수 100만회 : 3주 전" descriptions.textColor = .darkGray + let tapGesture: UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(self.handleTap(_:))) + tapGesture.delegate = self + + thumbnail.isUserInteractionEnabled = true + thumbnail.addGestureRecognizer(tapGesture) } func setData(contentData: ContentData) { thumbnail.image = contentData.makeImage() title.text = contentData.contentTitle } + + @objc func handleTap(_ sender: UITapGestureRecognizer? = nil) { + presentToDetailViewController?() + } + } + diff --git a/29th_Youtube/29th_Youtube/Sources/HomeVC/Cell/ContentTVC.xib b/29th_Youtube/29th_Youtube/Sources/HomeVC/Cell/ContentTVC.xib index c6b49a5..6b18eba 100644 --- a/29th_Youtube/29th_Youtube/Sources/HomeVC/Cell/ContentTVC.xib +++ b/29th_Youtube/29th_Youtube/Sources/HomeVC/Cell/ContentTVC.xib @@ -1,9 +1,9 @@ - + - + diff --git a/29th_Youtube/29th_Youtube/Sources/HomeVC/DataModel/ContentData.swift b/29th_Youtube/29th_Youtube/Sources/HomeVC/DataModel/ContentData.swift index a3a58d5..8d304c6 100644 --- a/29th_Youtube/29th_Youtube/Sources/HomeVC/DataModel/ContentData.swift +++ b/29th_Youtube/29th_Youtube/Sources/HomeVC/DataModel/ContentData.swift @@ -11,6 +11,7 @@ import UIKit struct ContentData{ let contentTitle: String let thumnbnail: String + let description: String func makeImage() -> UIImage? { return UIImage(named: thumnbnail) diff --git a/29th_Youtube/29th_Youtube/Sources/HomeVC/HomeXib/HomeXibVC.swift b/29th_Youtube/29th_Youtube/Sources/HomeVC/HomeXib/HomeXibVC.swift index 4b31b5f..ffd870f 100644 --- a/29th_Youtube/29th_Youtube/Sources/HomeVC/HomeXib/HomeXibVC.swift +++ b/29th_Youtube/29th_Youtube/Sources/HomeVC/HomeXib/HomeXibVC.swift @@ -12,6 +12,8 @@ class HomeXibVC: UIViewController { @IBOutlet weak var channelCV: UICollectionView! @IBOutlet weak var contentTV: UITableView! + @IBOutlet weak var profileImg: UIImageView! + var channelList: [ChannelData] = [] var contentList: [ContentData] = [] @@ -21,6 +23,7 @@ class HomeXibVC: UIViewController { initContentList() registerXib() setUI() + self.navigationController?.isNavigationBarHidden = true } func registerXib(){ @@ -44,11 +47,12 @@ class HomeXibVC: UIViewController { func initContentList(){ contentList.append(contentsOf: [ - ContentData(contentTitle: "weSoptPlanPart", thumnbnail: "wesoptPlanPart"), - ContentData(contentTitle: "weSoptPlanPart", thumnbnail: "wesoptPlanPart"), - ContentData(contentTitle: "weSoptPlanPart", thumnbnail: "wesoptPlanPart"), - ContentData(contentTitle: "weSoptPlanPart", thumnbnail: "wesoptPlanPart"), - ContentData(contentTitle: "weSoptPlanPart", thumnbnail: "wesoptPlanPart") + ContentData(contentTitle: "weSoptPlanPart", thumnbnail: "wesoptPlanPart", description: "WE SOPT : 조회수 100만회 : 3주 전"), + ContentData(contentTitle: "weSoptDesignPart", thumnbnail: "wesoptDesignPart", description: "WE SOPT : 조회수 100만회 : 3주 전"), + ContentData(contentTitle: "weSoptAndroidPart", thumnbnail: "wesoptAndroidPart", description: "WE SOPT : 조회수 100만회 : 3주 전"), + ContentData(contentTitle: "weSoptiOSPart", thumnbnail: "wesoptiOSPart", description: "WE SOPT : 조회수 100만회 : 3주 전"), + ContentData(contentTitle: "weSoptServerPart", thumnbnail: "wesoptServerPart", description: "WE SOPT : 조회수 100만회 : 3주 전"), + ContentData(contentTitle: "weSoptWebPart", thumnbnail: "wesoptWebPart", description: "WE SOPT : 조회수 100만회 : 3주 전") ]) } @@ -57,8 +61,15 @@ class HomeXibVC: UIViewController { channelCV.delegate = self contentTV.dataSource = self contentTV.delegate = self + let tapGesture = UITapGestureRecognizer(target: self, action: #selector(touchToLogin)) + profileImg.addGestureRecognizer(tapGesture) + profileImg.isUserInteractionEnabled = true } + @objc func touchToLogin() { + let nextVC = LoginVC() + self.navigationController?.pushViewController(nextVC, animated: true) + } } extension HomeXibVC: UICollectionViewDelegate{ @@ -111,6 +122,13 @@ extension HomeXibVC: UITableViewDataSource{ guard let cell = tableView.dequeueReusableCell(withIdentifier: ContentTVC.identifier) as? ContentTVC else {return UITableViewCell()} cell.setData(contentData: contentList[indexPath.row]) + cell.presentToDetailViewController = { + // 디테일로 이동 + let nextVC = DetailVC() + nextVC.contentList = self.contentList[indexPath.row] + nextVC.modalPresentationStyle = .overFullScreen + self.present(nextVC, animated: true, completion: nil) + } return cell } } diff --git a/29th_Youtube/29th_Youtube/Sources/HomeVC/HomeXib/HomeXibVC.xib b/29th_Youtube/29th_Youtube/Sources/HomeVC/HomeXib/HomeXibVC.xib index 0cad3f4..d22035f 100644 --- a/29th_Youtube/29th_Youtube/Sources/HomeVC/HomeXib/HomeXibVC.xib +++ b/29th_Youtube/29th_Youtube/Sources/HomeVC/HomeXib/HomeXibVC.xib @@ -13,6 +13,7 @@ +