Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT] iOS 7차 과제 #11

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions 29th_Youtube/29th_Youtube.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -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 = "<group>"; };
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 = "<group>"; };
7734D5AC277603DA004360E4 /* DetailVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailVC.swift; sourceTree = "<group>"; };
7734D5AD277603DA004360E4 /* DetailVC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = DetailVC.xib; sourceTree = "<group>"; };
7766D29A272C3C6000FE6E2E /* ChannelCVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChannelCVC.swift; sourceTree = "<group>"; };
7766D29B272C3C6000FE6E2E /* ChannelCVC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ChannelCVC.xib; sourceTree = "<group>"; };
7766D29E272C3EEB00FE6E2E /* HomeXibVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeXibVC.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -91,6 +95,15 @@
path = Pods;
sourceTree = "<group>";
};
7734D5AB277603C3004360E4 /* DetailVC */ = {
isa = PBXGroup;
children = (
7734D5AC277603DA004360E4 /* DetailVC.swift */,
7734D5AD277603DA004360E4 /* DetailVC.xib */,
);
path = DetailVC;
sourceTree = "<group>";
};
7766D299272C3C0200FE6E2E /* Cell */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -227,6 +240,7 @@
77FFCCE527105B40000E49F7 /* Sources */ = {
isa = PBXGroup;
children = (
7734D5AB277603C3004360E4 /* DetailVC */,
77DAC88B2721FDEE00B576D9 /* HomeVC */,
77DAC88C2721FDF400B576D9 /* ShortsVC */,
77DAC88D2721FDFB00B576D9 /* PlusVC */,
Expand Down Expand Up @@ -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 */,
Expand Down Expand Up @@ -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 */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>29th_Youtube.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>3</integer>
<integer>1</integer>
</dict>
</dict>
</dict>
Expand Down
2 changes: 1 addition & 1 deletion 29th_Youtube/29th_Youtube/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down
32 changes: 32 additions & 0 deletions 29th_Youtube/29th_Youtube/Sources/DetailVC/DetailVC.swift
Original file line number Diff line number Diff line change
@@ -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
}

}
84 changes: 84 additions & 0 deletions 29th_Youtube/29th_Youtube/Sources/DetailVC/DetailVC.xib
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="19455" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina5_9" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19454"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="DetailVC" customModule="_9th_Youtube" customModuleProvider="target">
<connections>
<outlet property="thumbnail" destination="gwK-Wh-heG" id="pLn-Dl-xzP"/>
<outlet property="videoDescription" destination="cZx-Fu-SQH" id="Aef-W8-jzy"/>
<outlet property="videoTitle" destination="thl-Yr-ZUR" id="9lP-Nb-V8b"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT">
<rect key="frame" x="0.0" y="0.0" width="375" height="812"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="wesoptAndroidpart" translatesAutoresizingMaskIntoConstraints="NO" id="gwK-Wh-heG">
<rect key="frame" x="0.0" y="43.999999999999986" width="375" height="212.66666666666663"/>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="thl-Yr-ZUR">
<rect key="frame" x="12" y="268.66666666666669" width="42" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cZx-Fu-SQH">
<rect key="frame" x="12" y="293.66666666666669" width="42" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" systemColor="systemGrayColor"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="w5b-PK-XBM">
<rect key="frame" x="346.33333333333331" y="268.66666666666669" width="16.666666666666686" height="22"/>
<color key="tintColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" image="arrowtriangle.down.fill" catalog="system"/>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="FZg-hB-xqR">
<rect key="frame" x="12.000000000000002" y="56" width="16.666666666666671" height="22"/>
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" image="arrowtriangle.down.fill" catalog="system"/>
<connections>
<action selector="dismissVC:" destination="-1" eventType="touchUpInside" id="ia8-hv-bQR"/>
</connections>
</button>
</subviews>
<viewLayoutGuide key="safeArea" id="fnl-2z-Ty3"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="thl-Yr-ZUR" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="12" id="CAe-4K-CJA"/>
<constraint firstItem="gwK-Wh-heG" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="DHx-ow-9S5"/>
<constraint firstItem="cZx-Fu-SQH" firstAttribute="top" secondItem="thl-Yr-ZUR" secondAttribute="bottom" constant="4" id="FXP-Ky-Q4y"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="w5b-PK-XBM" secondAttribute="trailing" constant="12" id="HyS-uI-0IN"/>
<constraint firstItem="gwK-Wh-heG" firstAttribute="trailing" secondItem="fnl-2z-Ty3" secondAttribute="trailing" id="Jt2-Ub-xg5"/>
<constraint firstItem="FZg-hB-xqR" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="12" id="RqN-94-paD"/>
<constraint firstItem="FZg-hB-xqR" firstAttribute="top" secondItem="fnl-2z-Ty3" secondAttribute="top" constant="12" id="dx2-IN-cEe"/>
<constraint firstItem="thl-Yr-ZUR" firstAttribute="top" secondItem="gwK-Wh-heG" secondAttribute="bottom" constant="12" id="ghd-OY-3eN"/>
<constraint firstItem="gwK-Wh-heG" firstAttribute="top" secondItem="fnl-2z-Ty3" secondAttribute="top" id="sow-ma-RaN"/>
<constraint firstItem="cZx-Fu-SQH" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="12" id="upE-bL-HaA"/>
<constraint firstItem="w5b-PK-XBM" firstAttribute="top" secondItem="gwK-Wh-heG" secondAttribute="bottom" constant="12" id="z5P-3M-8Np"/>
</constraints>
<point key="canvasLocation" x="136.80000000000001" y="93.103448275862078"/>
</view>
</objects>
<resources>
<image name="arrowtriangle.down.fill" catalog="system" width="128" height="124"/>
<image name="wesoptAndroidpart" width="375" height="212.33332824707031"/>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
<systemColor name="systemGrayColor">
<color red="0.55686274509803924" green="0.55686274509803924" blue="0.57647058823529407" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
</resources>
</document>
13 changes: 13 additions & 0 deletions 29th_Youtube/29th_Youtube/Sources/HomeVC/Cell/ContentTVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class ContentTVC: UITableViewCell {

static let identifier = "ContentTVC"

var presentToDetailViewController: (() -> Void)?

override func awakeFromNib() {
super.awakeFromNib()
setUI()
Expand All @@ -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?()
}

}

4 changes: 2 additions & 2 deletions 29th_Youtube/29th_Youtube/Sources/HomeVC/Cell/ContentTVC.xib
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="19162" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="19455" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19144"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19454"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import UIKit
struct ContentData{
let contentTitle: String
let thumnbnail: String
let description: String

func makeImage() -> UIImage? {
return UIImage(named: thumnbnail)
Expand Down
28 changes: 23 additions & 5 deletions 29th_Youtube/29th_Youtube/Sources/HomeVC/HomeXib/HomeXibVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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] = []

Expand All @@ -21,6 +23,7 @@ class HomeXibVC: UIViewController {
initContentList()
registerXib()
setUI()
self.navigationController?.isNavigationBarHidden = true
}

func registerXib(){
Expand All @@ -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주 전")
])
}

Expand All @@ -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{
Expand Down Expand Up @@ -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
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<connections>
<outlet property="channelCV" destination="8IQ-Vh-T9u" id="bGe-Ts-96T"/>
<outlet property="contentTV" destination="PLz-Dk-GKD" id="mDO-xC-j4f"/>
<outlet property="profileImg" destination="yJs-d6-INf" id="cue-b6-ARG"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
</placeholder>
Expand Down