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

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
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@
4FD1828A270DD75900BC7DE2 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4FD18288270DD75900BC7DE2 /* LaunchScreen.storyboard */; };
4FD182B627104CFB00BC7DE2 /* SignUpVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FD182B527104CFB00BC7DE2 /* SignUpVC.swift */; };
4FD182B82710658E00BC7DE2 /* CompleteVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FD182B72710658E00BC7DE2 /* CompleteVC.swift */; };
4FDDACC22775F50E004DBF03 /* DetailContent.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4FDDACC12775F50E004DBF03 /* DetailContent.storyboard */; };
4FDDACC42775F5D0004DBF03 /* DetailContentVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FDDACC32775F5D0004DBF03 /* DetailContentVC.swift */; };
4FDDACC62775F941004DBF03 /* DetailContent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FDDACC52775F941004DBF03 /* DetailContent.swift */; };
4FDDACC827760078004DBF03 /* PresentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FDDACC727760078004DBF03 /* PresentView.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand Down Expand Up @@ -99,6 +103,10 @@
4FD1828B270DD75900BC7DE2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
4FD182B527104CFB00BC7DE2 /* SignUpVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignUpVC.swift; sourceTree = "<group>"; };
4FD182B72710658E00BC7DE2 /* CompleteVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CompleteVC.swift; sourceTree = "<group>"; };
4FDDACC12775F50E004DBF03 /* DetailContent.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = DetailContent.storyboard; sourceTree = "<group>"; };
4FDDACC32775F5D0004DBF03 /* DetailContentVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailContentVC.swift; sourceTree = "<group>"; };
4FDDACC52775F941004DBF03 /* DetailContent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailContent.swift; sourceTree = "<group>"; };
4FDDACC727760078004DBF03 /* PresentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PresentView.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -188,6 +196,7 @@
4F4256EF2722202D0001F62E /* HomeVC.swift */,
4F819C55272BF4EA008B41DD /* HomeVC+CollectionView.swift */,
4F819C4D272BE38C008B41DD /* HomeVC+TableView.swift */,
4FDDACC32775F5D0004DBF03 /* DetailContentVC.swift */,
);
path = Controller;
sourceTree = "<group>";
Expand All @@ -196,6 +205,7 @@
isa = PBXGroup;
children = (
4F4256ED27221A7F0001F62E /* Home.storyboard */,
4FDDACC12775F50E004DBF03 /* DetailContent.storyboard */,
);
path = Storyboard;
sourceTree = "<group>";
Expand Down Expand Up @@ -320,6 +330,7 @@
4F819C49272BD8CF008B41DD /* HomeManager.swift */,
4F819C53272BF20D008B41DD /* Channel.swift */,
4F838C91272DA871008D4DFB /* Tag.swift */,
4FDDACC52775F941004DBF03 /* DetailContent.swift */,
);
path = Model;
sourceTree = "<group>";
Expand All @@ -331,6 +342,7 @@
4F838C9C272DB2C3008D4DFB /* ChannelManger.swift */,
4F838C9E272DB2EA008D4DFB /* ThumbnailManager.swift */,
4F838CA0272DB481008D4DFB /* TagManager.swift */,
4FDDACC727760078004DBF03 /* PresentView.swift */,
);
path = Protocols;
sourceTree = "<group>";
Expand Down Expand Up @@ -456,6 +468,7 @@
files = (
4F4256E1272217870001F62E /* TabBar.storyboard in Resources */,
4F4256EE27221A7F0001F62E /* Home.storyboard in Resources */,
4FDDACC22775F50E004DBF03 /* DetailContent.storyboard in Resources */,
4F819C45272BCA6B008B41DD /* ThumbnailTVC.xib in Resources */,
4F4256FE2722246B0001F62E /* Add.storyboard in Resources */,
4FD1828A270DD75900BC7DE2 /* LaunchScreen.storyboard in Resources */,
Expand Down Expand Up @@ -485,6 +498,7 @@
4F819C54272BF20D008B41DD /* Channel.swift in Sources */,
4FD182B627104CFB00BC7DE2 /* SignUpVC.swift in Sources */,
4F4256F02722202D0001F62E /* HomeVC.swift in Sources */,
4FDDACC62775F941004DBF03 /* DetailContent.swift in Sources */,
4F4256E52722184B0001F62E /* TBC.swift in Sources */,
4F819C48272BD1B2008B41DD /* Thumbnail.swift in Sources */,
4F838C95272DA98E008D4DFB /* CellProtocol.swift in Sources */,
Expand All @@ -499,13 +513,15 @@
4F819C56272BF4EA008B41DD /* HomeVC+CollectionView.swift in Sources */,
4F838C9F272DB2EA008D4DFB /* ThumbnailManager.swift in Sources */,
4FD18280270DD75700BC7DE2 /* SceneDelegate.swift in Sources */,
4FDDACC42775F5D0004DBF03 /* DetailContentVC.swift in Sources */,
4F838C9A272DAEF0008D4DFB /* TagCVC.swift in Sources */,
4F838C9D272DB2C4008D4DFB /* ChannelManger.swift in Sources */,
4F819C44272BCA6B008B41DD /* ThumbnailTVC.swift in Sources */,
4F4257052722263F0001F62E /* SubscriptionsVC.swift in Sources */,
4FB8EFCD2741055200A5BB7E /* UserSignService.swift in Sources */,
4F2AE03227426577006785E4 /* UIViewController+makeAlert.swift in Sources */,
4FB8EFD32741263A00A5BB7E /* AuthResponse.swift in Sources */,
4FDDACC827760078004DBF03 /* PresentView.swift in Sources */,
4F01E4DB272FD9A200785744 /* UIView+IBInspectable.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
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" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"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" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"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,12 @@
//
// PresentView.swift
// 29th-assignment
//
// Created by Noah on 2021/12/24.
//

import UIKit

protocol PresentView: AnyObject {
func present(viewController: UIViewController)
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@ import UIKit
class ThumbnailTVC: UITableViewCell {

var manager = HomeManager.shared
weak var delegate: PresentView?

@IBOutlet weak var thumbnailImage: UIImageView!
@IBOutlet weak var profileImage: UIImageView!
@IBOutlet weak var thumbnailTitle: UILabel!
@IBOutlet weak var infoLabel: UILabel!
@IBOutlet weak var thumbnailImage: UIImageView?
@IBOutlet weak var profileImage: UIImageView?
@IBOutlet weak var thumbnailTitle: UILabel?
@IBOutlet weak var infoLabel: UILabel?

override func awakeFromNib() {
super.awakeFromNib()
initTapGestureForImageView()
}

override func setSelected(_ selected: Bool, animated: Bool) {
Expand All @@ -30,11 +32,33 @@ extension ThumbnailTVC: CellProtocol {
static let identifier = "ThumbnailTVC"

func getCellConfigureAt(_ index: Int) {
thumbnailImage.image = manager.getThumbnailImage(index)
thumbnailTitle.text = manager.getThumbnailTitle(index)
thumbnailImage?.image = manager.getThumbnailImage(index)
thumbnailTitle?.text = manager.getThumbnailTitle(index)
let author = manager.getThumbnailAuthor(index)
let views = manager.getThumbnailViews(index)
let created = manager.getThumbnailCreatedDate(index)
infoLabel.text = "\(author) ・ 조회수 \(views) ・ \(created)"
infoLabel?.text = "\(author) ・ 조회수 \(views) ・ \(created)"
}
}

extension ThumbnailTVC {
private func initTapGestureForImageView() {
let tapRecognizer = UITapGestureRecognizer(target: self,
action: #selector(self.profileImageDidTap))
thumbnailImage?.addGestureRecognizer(tapRecognizer)
thumbnailImage?.isUserInteractionEnabled = true
}

@objc func profileImageDidTap() {
let detailContentSB = UIStoryboard(name: "DetailContent", bundle: nil)
guard let detailContentVC = detailContentSB.instantiateViewController(withIdentifier: DetailContentVC.identifier) as? DetailContentVC
else { return }
detailContentVC.modalPresentationStyle = .fullScreen

let detailContentData = DetailContent(contentImage: thumbnailImage?.image,
contentTitle: thumbnailTitle?.text,
contentInfo: infoLabel?.text)
detailContentVC.contentData = detailContentData
delegate?.present(viewController: detailContentVC)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="ThumbnailTVC" id="KGk-i7-Jjw" customClass="ThumbnailTVC" customModule="_9th_assignment" customModuleProvider="target">
<tableViewCell contentMode="scaleToFill" restorationIdentifier="ThumbnailTVC" selectionStyle="default" indentationWidth="10" reuseIdentifier="ThumbnailTVC" id="KGk-i7-Jjw" customClass="ThumbnailTVC" customModule="_9th_assignment" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="375" height="306"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
Expand All @@ -18,6 +18,7 @@
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="wesoptiOSPart" translatesAutoresizingMaskIntoConstraints="NO" id="zSs-r5-z1Z">
<rect key="frame" x="0.0" y="0.0" width="375" height="212"/>
<gestureRecognizers/>
<constraints>
<constraint firstAttribute="height" constant="212" id="4fx-gU-fRg"/>
</constraints>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//
// DetailContentVC.swift
// 29th-assignment
//
// Created by Noah on 2021/12/24.
//

import UIKit

class DetailContentVC: UIViewController {

@IBOutlet private weak var contentImage: UIImageView?
@IBOutlet private weak var contentTitle: UILabel?
@IBOutlet private weak var contentInfo: UILabel?

lazy var contentData = DetailContent()

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

@IBAction func dismissBtnDidTap(_ sender: Any) {
dismiss(animated: true)
}
}

extension DetailContentVC {
static let identifier = "DetailContentVC"

private func setUI() {
contentImage?.image = contentData.contentImage
contentTitle?.text = contentData.contentTitle
contentInfo?.text = contentData.contentInfo
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,16 @@ extension HomeVC: UITableViewDataSource {

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCell(withIdentifier: ThumbnailTVC.identifier) as? ThumbnailTVC else { return UITableViewCell() }

cell.getCellConfigureAt(indexPath.row)
cell.delegate = self

return cell
}
}

extension HomeVC: PresentView {
func present(viewController: UIViewController) {
self.present(viewController, animated: true)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// DetailContent.swift
// 29th-assignment
//
// Created by Noah on 2021/12/24.
//

import UIKit

struct DetailContent {
var contentImage: UIImage?
var contentTitle: String?
var contentInfo: String?
}
Loading