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] 7주차 과제 #10

Open
wants to merge 2 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
28 changes: 28 additions & 0 deletions Youtube_Clone/Youtube_Clone.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
36A6022827100790002BBF40 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 36A6022627100790002BBF40 /* LaunchScreen.storyboard */; };
36A60235271008C2002BBF40 /* Login.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 36A60234271008C2002BBF40 /* Login.storyboard */; };
36A60237271008DE002BBF40 /* LoginVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36A60236271008DE002BBF40 /* LoginVC.swift */; };
36B69F862775DD7C00FEEAAE /* Detail.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 36B69F852775DD7C00FEEAAE /* Detail.storyboard */; };
36B69F892775DD9700FEEAAE /* DetailVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36B69F882775DD9700FEEAAE /* DetailVC.swift */; };
36B69F8B2775EBE400FEEAAE /* HomeDataModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36B69F8A2775EBE400FEEAAE /* HomeDataModel.swift */; };
36F8F6C72721464E00092338 /* TabbarVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36F8F6C62721464E00092338 /* TabbarVC.swift */; };
36F8F6CB272146DD00092338 /* HomeVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36F8F6CA272146DD00092338 /* HomeVC.swift */; };
36F8F6CF2721470D00092338 /* Home.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 36F8F6CE2721470D00092338 /* Home.storyboard */; };
Expand Down Expand Up @@ -79,6 +82,9 @@
36A6022927100790002BBF40 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
36A60234271008C2002BBF40 /* Login.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Login.storyboard; sourceTree = "<group>"; };
36A60236271008DE002BBF40 /* LoginVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginVC.swift; sourceTree = "<group>"; };
36B69F852775DD7C00FEEAAE /* Detail.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Detail.storyboard; sourceTree = "<group>"; };
36B69F882775DD9700FEEAAE /* DetailVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailVC.swift; sourceTree = "<group>"; };
36B69F8A2775EBE400FEEAAE /* HomeDataModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeDataModel.swift; sourceTree = "<group>"; };
36F8F6C62721464E00092338 /* TabbarVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabbarVC.swift; sourceTree = "<group>"; };
36F8F6CA272146DD00092338 /* HomeVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeVC.swift; sourceTree = "<group>"; };
36F8F6CE2721470D00092338 /* Home.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Home.storyboard; sourceTree = "<group>"; };
Expand Down Expand Up @@ -186,6 +192,7 @@
isa = PBXGroup;
children = (
362F42FE273CF5BA0033E580 /* LoginDataModel.swift */,
36B69F8A2775EBE400FEEAAE /* HomeDataModel.swift */,
);
path = Models;
sourceTree = "<group>";
Expand Down Expand Up @@ -254,6 +261,7 @@
36A60232271007FE002BBF40 /* VCs */ = {
isa = PBXGroup;
children = (
36B69F872775DD8900FEEAAE /* Detail */,
36F8F6E52722DDD700092338 /* Saves */,
36F8F6E42722DDCF00092338 /* Subscibe */,
36F8F6E32722DDCA00092338 /* Adds */,
Expand All @@ -269,6 +277,7 @@
36A6023327100812002BBF40 /* Storyboards */ = {
isa = PBXGroup;
children = (
36B69F842775DD6E00FEEAAE /* Detail */,
36F8F6DC2722DD8C00092338 /* Saves */,
36F8F6D92722DD7000092338 /* Subscribe */,
36F8F6D62722DD6000092338 /* Adds */,
Expand All @@ -282,6 +291,22 @@
path = Storyboards;
sourceTree = "<group>";
};
36B69F842775DD6E00FEEAAE /* Detail */ = {
isa = PBXGroup;
children = (
36B69F852775DD7C00FEEAAE /* Detail.storyboard */,
);
path = Detail;
sourceTree = "<group>";
};
36B69F872775DD8900FEEAAE /* Detail */ = {
isa = PBXGroup;
children = (
36B69F882775DD9700FEEAAE /* DetailVC.swift */,
);
path = Detail;
sourceTree = "<group>";
};
36F8F6C82721469C00092338 /* Home */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -477,6 +502,7 @@
36F8F6D12721482100092338 /* Tabbar.storyboard in Resources */,
36A602232710078F002BBF40 /* Main.storyboard in Resources */,
366D23F42710627600652491 /* Register.storyboard in Resources */,
36B69F862775DD7C00FEEAAE /* Detail.storyboard in Resources */,
36631C11272C04F2001BEC5B /* VideoTVC.xib in Resources */,
36F8F6DB2722DD7E00092338 /* Subscribe.storyboard in Resources */,
366D23F827106D5300652491 /* CompleteLogin.storyboard in Resources */,
Expand Down Expand Up @@ -538,6 +564,7 @@
36631C01272BDF31001BEC5B /* UITableView++.swift in Sources */,
36631C04272BF533001BEC5B /* ShortsTVC.swift in Sources */,
36F8F6E72722DDE600092338 /* AddsVC.swift in Sources */,
36B69F892775DD9700FEEAAE /* DetailVC.swift in Sources */,
366D23FA27106D6200652491 /* CompleteLoginVC.swift in Sources */,
362F4305273D0AC70033E580 /* RegisterService.swift in Sources */,
36F8F6C72721464E00092338 /* TabbarVC.swift in Sources */,
Expand All @@ -552,6 +579,7 @@
36F8F6E02722DDB100092338 /* ShortsVC.swift in Sources */,
362F4303273CFD530033E580 /* UIViewController++.swift in Sources */,
362F42FD273CF40E0033E580 /* Constants.swift in Sources */,
36B69F8B2775EBE400FEEAAE /* HomeDataModel.swift in Sources */,
362F4301273CF9320033E580 /* LoginService.swift in Sources */,
366D23F62710628800652491 /* RegisterVC.swift in Sources */,
36F8F6E92722DDF800092338 /* SubscribeVC.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -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
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -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
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "wesoptiOSPart.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "wesoptiOSPart@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "wesoptiOSPart@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="19162" 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="19144"/>
<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>
<scenes>
<!--DetailVC-->
<scene sceneID="s0d-6b-0kx">
<objects>
<viewController storyboardIdentifier="DetailVC" id="Y6W-OH-hqX" customClass="DetailVC" customModule="Youtube_Clone" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="5EZ-qb-Rvc">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<viewLayoutGuide key="safeArea" id="vDu-zF-Fre"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Ief-a0-LHa" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="139" y="134"/>
</scene>
</scenes>
<resources>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>
14 changes: 14 additions & 0 deletions Youtube_Clone/Youtube_Clone/Source/Models/HomeDataModel.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// HomeDataModel.swift
// Youtube_Clone
//
// Created by 박익범 on 2021/12/24.
//

import Foundation

struct homeDataModel{
var titleText: String
var detailText: String
var imageName: String
}
38 changes: 35 additions & 3 deletions Youtube_Clone/Youtube_Clone/Source/TVCs/VideoTVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,19 @@ import UIKit
import SnapKit
import Then

protocol isImageViewClickedDelegate{
func isImageViewClicked(title: String, detail: String, image: String)
}


class VideoTVC: UITableViewCell {

var delegate: isImageViewClickedDelegate?
var title: String = ""
var subText: String = ""
var imageName: String = ""


private let videoImageView = UIImageView().then{
$0.image = UIImage(named: "wesoptAndroidpart")
}
Expand All @@ -21,6 +32,8 @@ class VideoTVC: UITableViewCell {
private let nameLabel = UILabel().then{
$0.text = "ㅇㅇ"
$0.font = UIFont.systemFont(ofSize: 15)
$0.numberOfLines = 2
$0.lineBreakMode = .byCharWrapping
$0.textColor = UIColor.black
}
private let subLabel = UILabel().then{
Expand All @@ -32,6 +45,22 @@ class VideoTVC: UITableViewCell {
$0.setBackgroundImage(UIImage(named: "moreMenuIcon"), for: .normal)
}

func setData(titleText: String, detailText: String, image: String){
nameLabel.text = titleText
title = titleText
subLabel.text = detailText
subText = detailText
videoImageView.image = UIImage(named: image)
imageName = image
}


@objc private func imageViewClicked(_ sender: UIImageView){
print("눌림")
delegate?.isImageViewClicked(title: title, detail: subText, image: imageName)
}


func setLayout(){
contentView.addsubViews([videoImageView, profileImageView,nameLabel,subLabel,moreButton])

Expand All @@ -53,10 +82,10 @@ class VideoTVC: UITableViewCell {
$0.width.height.equalTo(26)
}
nameLabel.snp.makeConstraints{
$0.top.equalTo(videoImageView.snp.bottom).offset(12)
$0.top.equalTo(profileImageView.snp.top).offset(0)
$0.leading.equalTo(profileImageView.snp.trailing).offset(12)
$0.trailing.equalTo(moreButton.snp.leading).offset(-19)
$0.height.equalTo(35)
$0.height.equalTo(50)
}
subLabel.snp.makeConstraints{
$0.top.equalTo(nameLabel.snp.bottom).offset(4)
Expand All @@ -70,13 +99,16 @@ class VideoTVC: UITableViewCell {

override func awakeFromNib() {
super.awakeFromNib()
self.selectionStyle = .none
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(imageViewClicked(_:)))
videoImageView.isUserInteractionEnabled = true
videoImageView.addGestureRecognizer(tapGesture)
setLayout()
// Initialization code
}

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

// Configure the view for the selected state
}

Expand Down
88 changes: 88 additions & 0 deletions Youtube_Clone/Youtube_Clone/Source/VCs/Detail/DetailVC.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
//
// DetailVC.swift
// Youtube_Clone
//
// Created by 박익범 on 2021/12/24.
//

import UIKit
import SnapKit
import Then

class DetailVC: UIViewController {

private let imageView = UIImageView().then{
$0.image = UIImage(named: "wesoptAndroidpart")
}

private let titleLabel = UILabel().then{
$0.font = UIFont.systemFont(ofSize: 15, weight: .regular)
$0.textColor = UIColor.black
$0.lineBreakMode = .byCharWrapping
$0.numberOfLines = 2
}

private let detailLabel = UILabel().then{
$0.font = UIFont.systemFont(ofSize: 13, weight: .regular)
$0.textColor = UIColor.systemGray
}
private let backButton = UIButton().then{
$0.setBackgroundImage(UIImage(named: "icn_dismissBtn"), for: .normal)
$0.addTarget(self, action: #selector(dismissButtonClicked(_:)), for: .touchUpInside)
}
private let expandButton = UIButton().then{
$0.setBackgroundImage(UIImage(named: "icn_expandBtn"), for: .normal)
}


func setData(title: String, detail: String, image: String){
titleLabel.text = title
detailLabel.text = detail
imageView.image = UIImage(named: image)
}


func setLayout(){
view.addsubViews([imageView, titleLabel, detailLabel, backButton, expandButton])

imageView.snp.makeConstraints{
$0.leading.trailing.equalToSuperview().offset(0)
$0.top.equalToSuperview().offset(50)
$0.height.equalTo(212)
}
backButton.snp.makeConstraints{
$0.leading.equalToSuperview().offset(0)
$0.top.equalToSuperview().offset(50)
$0.height.width.equalTo(48)
}
titleLabel.snp.makeConstraints{
$0.top.equalTo(imageView.snp.bottom).offset(12)
$0.leading.equalToSuperview().offset(12)
$0.width.equalTo(270)
}
expandButton.snp.makeConstraints{
$0.top.equalTo(imageView.snp.bottom).offset(12)
$0.trailing.equalToSuperview().offset(-7)
$0.width.height.equalTo(26)
}
detailLabel.snp.makeConstraints{
$0.top.equalTo(titleLabel.snp.bottom).offset(4)
$0.leading.equalToSuperview().offset(12)
$0.width.equalTo(270)
}
}

@objc private func dismissButtonClicked(_ sender: UIButton){
self.dismiss(animated: true, completion: nil)
}


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




}
Loading