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차 과제 #21

Open
wants to merge 1 commit 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
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
1430B1602710A298005A0538 /* LoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1430B15F2710A298005A0538 /* LoginViewController.swift */; };
1430B1622710A2C5005A0538 /* SignUpViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1430B1612710A2C5005A0538 /* SignUpViewController.swift */; };
1430B1642710A2D0005A0538 /* CompleteViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1430B1632710A2D0005A0538 /* CompleteViewController.swift */; };
143AEB8C2775FDB30024789D /* HomeDetailVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 143AEB8B2775FDB30024789D /* HomeDetailVC.swift */; };
146C9E942710980D0065A609 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 146C9E932710980D0065A609 /* AppDelegate.swift */; };
146C9E962710980D0065A609 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 146C9E952710980D0065A609 /* SceneDelegate.swift */; };
146C9E982710980D0065A609 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 146C9E972710980D0065A609 /* ViewController.swift */; };
Expand Down Expand Up @@ -47,6 +48,7 @@
1430B15F2710A298005A0538 /* LoginViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginViewController.swift; sourceTree = "<group>"; };
1430B1612710A2C5005A0538 /* SignUpViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignUpViewController.swift; sourceTree = "<group>"; };
1430B1632710A2D0005A0538 /* CompleteViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CompleteViewController.swift; sourceTree = "<group>"; };
143AEB8B2775FDB30024789D /* HomeDetailVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeDetailVC.swift; sourceTree = "<group>"; };
146C9E902710980D0065A609 /* assignment-Youtube.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "assignment-Youtube.app"; sourceTree = BUILT_PRODUCTS_DIR; };
146C9E932710980D0065A609 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
146C9E952710980D0065A609 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -142,6 +144,7 @@
14020A092722F24C00AF0375 /* SubscriptionVC.swift */,
146C9E972710980D0065A609 /* ViewController.swift */,
14020A012722F1FD00AF0375 /* YoutubeTabBarController.swift */,
143AEB8B2775FDB30024789D /* HomeDetailVC.swift */,
);
path = VC;
sourceTree = "<group>";
Expand Down Expand Up @@ -372,6 +375,7 @@
1430B1622710A2C5005A0538 /* SignUpViewController.swift in Sources */,
14020A062722F22800AF0375 /* ShortsVC.swift in Sources */,
1430B1642710A2D0005A0538 /* CompleteViewController.swift in Sources */,
143AEB8C2775FDB30024789D /* HomeDetailVC.swift in Sources */,
14EFE90D2741419900864A81 /* NetworkResult.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,29 @@ class HomeTableViewCell: UITableViewCell {
@IBOutlet weak var homeVideoSpec: UILabel!
@IBOutlet weak var homeVideoActButton: UIButton!

var showVideoDetail: (() -> ())?

override func awakeFromNib() {
super.awakeFromNib()
// homeVideoThumbnail.addGestureRecognizer(UIGestureRecognizer(target: self, action: #selector(imageTapped(_:))))
setGesture()
}

func setGesture() {
let gesture = UITapGestureRecognizer(target: self, action: #selector(imageTapped))
homeVideoThumbnail.addGestureRecognizer(gesture)
homeVideoThumbnail.isUserInteractionEnabled = true
}

override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
}

@objc func imageTapped(_ sender: UITapGestureRecognizer) {
print("taptap")
showVideoDetail?()
}

func setData(appData: HomeVideo) {
homeVideoThumbnail.image = appData.makeVideoThumbnailImage()
homeVideoProfileImage.image = appData.makeVideoOwnerImage()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?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">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="19529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19454"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19519"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
Expand All @@ -18,6 +18,7 @@
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="w7x-cf-gV4">
<rect key="frame" x="0.0" y="0.0" width="375" height="212"/>
<gestureRecognizers/>
<constraints>
<constraint firstAttribute="height" constant="212" id="9jl-nY-h34"/>
<constraint firstAttribute="width" constant="375" id="DB0-kq-ZR4"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="19529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="19529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="hZ3-4t-ho1">
<device id="retina5_9" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19519"/>
Expand Down Expand Up @@ -565,6 +565,75 @@
</objects>
<point key="canvasLocation" x="28" y="55.418719211822662"/>
</scene>
<!--Home DetailVC-->
<scene sceneID="sMM-wZ-urp">
<objects>
<viewController storyboardIdentifier="HomeDetailVC" id="QDj-fx-Hel" customClass="HomeDetailVC" customModule="assignment_Youtube" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="w9O-8H-uMB">
<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" translatesAutoresizingMaskIntoConstraints="NO" id="xIL-tQ-D09">
<rect key="frame" x="0.0" y="44" width="375" height="212"/>
<constraints>
<constraint firstAttribute="height" constant="212" id="rWg-nU-jwz"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="동영상 이름" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iQH-fP-ctv">
<rect key="frame" x="12" y="268" width="69" height="18"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="동영상 설명" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Qn4-9d-ceD">
<rect key="frame" x="12" y="292" width="78" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Y39-iI-GVl">
<rect key="frame" x="15" y="59" width="50" height="50"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="NNg-1C-lDk"/>
<constraint firstAttribute="width" secondItem="Y39-iI-GVl" secondAttribute="height" multiplier="1:1" id="aEA-aI-4Ei"/>
<constraint firstAttribute="width" constant="50" id="svV-Ie-tB8"/>
</constraints>
<state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="plain" title="">
<backgroundConfiguration key="background">
<color key="backgroundColor" systemColor="linkColor"/>
</backgroundConfiguration>
</buttonConfiguration>
<connections>
<action selector="goToVideoList:" destination="QDj-fx-Hel" eventType="touchUpInside" id="HIL-Cg-WsR"/>
</connections>
</button>
</subviews>
<viewLayoutGuide key="safeArea" id="Fxf-eg-Rbz"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="Fxf-eg-Rbz" firstAttribute="trailing" secondItem="xIL-tQ-D09" secondAttribute="trailing" id="3w8-Eg-gzN"/>
<constraint firstItem="Y39-iI-GVl" firstAttribute="leading" secondItem="Fxf-eg-Rbz" secondAttribute="leading" constant="15" id="4Ri-r3-j42"/>
<constraint firstItem="iQH-fP-ctv" firstAttribute="leading" secondItem="Fxf-eg-Rbz" secondAttribute="leading" constant="12" id="7kt-5E-g7F"/>
<constraint firstItem="Qn4-9d-ceD" firstAttribute="top" secondItem="iQH-fP-ctv" secondAttribute="bottom" constant="5" id="AEd-ur-EKN"/>
<constraint firstItem="xIL-tQ-D09" firstAttribute="top" secondItem="Fxf-eg-Rbz" secondAttribute="top" id="HKA-UV-7n8"/>
<constraint firstItem="Y39-iI-GVl" firstAttribute="top" secondItem="Fxf-eg-Rbz" secondAttribute="top" constant="15" id="JiH-bk-9dX"/>
<constraint firstItem="xIL-tQ-D09" firstAttribute="leading" secondItem="Fxf-eg-Rbz" secondAttribute="leading" id="YQp-JC-P0Z"/>
<constraint firstItem="Qn4-9d-ceD" firstAttribute="leading" secondItem="iQH-fP-ctv" secondAttribute="leading" id="pNW-bq-iBY"/>
<constraint firstItem="iQH-fP-ctv" firstAttribute="top" secondItem="xIL-tQ-D09" secondAttribute="bottom" constant="12" id="wbQ-rb-jbm"/>
</constraints>
</view>
<connections>
<outlet property="detailImageView" destination="xIL-tQ-D09" id="DQy-1e-T10"/>
<outlet property="detailVideoNameLabel" destination="iQH-fP-ctv" id="MDM-1f-I1i"/>
<outlet property="detailVideoSpecLabel" destination="Qn4-9d-ceD" id="JaX-YI-UzK"/>
<outlet property="goToVideoListButton" destination="Y39-iI-GVl" id="UY3-4z-6gV"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="kYe-oI-XgQ" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="3608.8000000000002" y="1483.7438423645322"/>
</scene>
</scenes>
<resources>
<image name="SearchIcon" width="32.333332061767578" height="32"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
//
// HomeDetailVC.swift
// assignment-Youtube
//
// Created by 이남준 on 2021/12/24.
//

import UIKit

class HomeDetailVC: UIViewController {

static let identifier = "HomeDetailVC"

@IBOutlet weak var detailImageView: UIImageView!
@IBOutlet weak var detailVideoNameLabel: UILabel!
@IBOutlet weak var detailVideoSpecLabel: UILabel!
@IBOutlet weak var goToVideoListButton: UIButton!

var detailInfo: HomeVideo?

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

func setUIConfigure() {
goToVideoListButton.layer.zPosition = 1000
}

func setData() {
guard let detailInfo = self.detailInfo else {return}
self.detailImageView.image = detailInfo.makeVideoThumbnailImage()
self.detailVideoNameLabel.text = detailInfo.videoName
self.detailVideoSpecLabel.text = detailInfo.videoDescription
}

@IBAction func goToVideoList(_ sender: Any) {
// guard let presentingVC = self.presentingViewController as? UINavigationController else { return }
// let viewControllerStack = presentingVC.viewControllers
self.dismiss(animated: true, completion: nil)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import UIKit

class HomeVC: UIViewController {

@IBOutlet weak var accountButton: UIButton!

@IBOutlet weak var homeVideoTableView: UITableView!
Expand Down Expand Up @@ -69,6 +70,11 @@ class HomeVC: UIViewController {
self.present(nextVC, animated: true, completion: nil)
}

func showVideoDetail() {
guard let detailVC = self.storyboard?.instantiateViewController(withIdentifier: "HomeDetailVC") as? HomeDetailVC else {return}

self.present(detailVC, animated: true, completion: nil)
}
}

extension HomeVC: UITableViewDelegate {
Expand All @@ -87,10 +93,18 @@ extension HomeVC: UITableViewDataSource {
HomeTableViewCell else {return UITableViewCell()}

cell.setData(appData: homeVideoList[indexPath.row])

cell.showVideoDetail = {
guard let detailVC = self.storyboard?.instantiateViewController(withIdentifier: "HomeDetailVC") as? HomeDetailVC else {return}

detailVC.detailInfo = self.homeVideoList[indexPath.row]

detailVC.modalPresentationStyle = .fullScreen
self.present(detailVC, animated: true, completion: nil)
}

return cell
}


}

extension HomeVC: UICollectionViewDataSource {
Expand All @@ -103,6 +117,7 @@ extension HomeVC: UICollectionViewDataSource {
as? HomeCollectionViewCell else {return UICollectionViewCell()}

cell.setData(iconImage: homeShortsVideoList[indexPath.row].makeVideoOwnerImage(), nameLabel: homeShortsVideoList[indexPath.row].videoOwnerName)

return cell
}
}
Expand Down