Skip to content

Commit

Permalink
[#10] detailVC로 데이터 전달
Browse files Browse the repository at this point in the history
  • Loading branch information
dlwns33 committed Dec 24, 2021
1 parent 66eb8c6 commit 79a4704
Show file tree
Hide file tree
Showing 6 changed files with 139 additions and 8 deletions.
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
29 changes: 29 additions & 0 deletions 29th_Youtube/29th_Youtube/Sources/DetailVC/DetailVC.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//
// 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?

override func viewDidLoad() {
super.viewDidLoad()
setUI()
}

private func setUI() {
thumbnail.image = UIImage(named: contentList?.thumnbnail ?? "")
videoTitle.text = contentList?.contentTitle
videoDescription.text = contentList?.description
}

}
81 changes: 81 additions & 0 deletions 29th_Youtube/29th_Youtube/Sources/DetailVC/DetailVC.xib
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?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"/>
</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>
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
16 changes: 10 additions & 6 deletions 29th_Youtube/29th_Youtube/Sources/HomeVC/HomeXib/HomeXibVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ class HomeXibVC: UIViewController {

func initContentList(){
contentList.append(contentsOf: [
ContentData(contentTitle: "weSoptPlanPart", thumnbnail: "wesoptPlanPart"),
ContentData(contentTitle: "weSoptDesignPart", thumnbnail: "wesoptDesignPart"),
ContentData(contentTitle: "weSoptAndroidPart", thumnbnail: "wesoptAndroidPart"),
ContentData(contentTitle: "weSoptiOSPart", thumnbnail: "wesoptiOSPart"),
ContentData(contentTitle: "weSoptServerPart", thumnbnail: "wesoptServerPart"),
ContentData(contentTitle: "weSoptWebPart", thumnbnail: "wesoptWebPart")
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 Down Expand Up @@ -124,6 +124,10 @@ extension HomeXibVC: UITableViewDataSource{
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

0 comments on commit 79a4704

Please sign in to comment.