From e0a5d1997a38ebfcb377f374c7c305342d9cbbcb Mon Sep 17 00:00:00 2001 From: Joon Baek Date: Fri, 26 May 2023 22:40:27 +0900 Subject: [PATCH 01/15] =?UTF-8?q?[Feat]=20#27=20-=20DMCollectionViewCell,?= =?UTF-8?q?=20DMTableViewCell=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Instagram-iOS.xcodeproj/project.pbxproj | 20 ++++- .../DMList/Cell/DMCollectionViewCell.swift | 57 +++++++++++++ .../Screens/DMList/Cell/DMTableviewCell.swift | 82 +++++++++++++++++++ 3 files changed, 155 insertions(+), 4 deletions(-) create mode 100644 Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMCollectionViewCell.swift create mode 100644 Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableviewCell.swift diff --git a/Instagram-iOS/Instagram-iOS.xcodeproj/project.pbxproj b/Instagram-iOS/Instagram-iOS.xcodeproj/project.pbxproj index 4620ba4..8f8c642 100644 --- a/Instagram-iOS/Instagram-iOS.xcodeproj/project.pbxproj +++ b/Instagram-iOS/Instagram-iOS.xcodeproj/project.pbxproj @@ -7,6 +7,8 @@ objects = { /* Begin PBXBuildFile section */ + 372AAF732A20E7FC009212A8 /* DMTableviewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 372AAF722A20E7FC009212A8 /* DMTableviewCell.swift */; }; + 372AAF752A20E808009212A8 /* DMCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 372AAF742A20E808009212A8 /* DMCollectionViewCell.swift */; }; 37C4BF062A1D3E86006FBFF6 /* SF-Pro-Text-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 37C4BF052A1D3E86006FBFF6 /* SF-Pro-Text-Bold.ttf */; }; 3E6CF47A2A14F43500DC3B2B /* BaseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E6CF4792A14F43500DC3B2B /* BaseViewController.swift */; }; 3E6CF47C2A14F63700DC3B2B /* BaseTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E6CF47B2A14F63700DC3B2B /* BaseTableViewCell.swift */; }; @@ -26,7 +28,6 @@ 3E9683EC2A1654CF00D6DD30 /* UIViewController+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E9683EB2A1654CF00D6DD30 /* UIViewController+.swift */; }; 3E9683EE2A16562700D6DD30 /* UIView+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E9683ED2A16562700D6DD30 /* UIView+.swift */; }; 3E9683F02A1656A800D6DD30 /* SizeLiteral.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E9683EF2A1656A800D6DD30 /* SizeLiteral.swift */; }; - 7E0148BB2A1890530036147D /* MainFeedViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E0148BA2A1890530036147D /* MainFeedViewController.swift */; }; 3EEE765F2A1678E800D0B80E /* UserProfileView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EEE765E2A1678E800D0B80E /* UserProfileView.swift */; }; 3EEE76612A1757D400D0B80E /* NewPostViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EEE76602A1757D400D0B80E /* NewPostViewController.swift */; }; 3EEE76632A175ECD00D0B80E /* BottomMenuContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EEE76622A175ECD00D0B80E /* BottomMenuContentView.swift */; }; @@ -52,6 +53,8 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 372AAF722A20E7FC009212A8 /* DMTableviewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DMTableviewCell.swift; sourceTree = ""; }; + 372AAF742A20E808009212A8 /* DMCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DMCollectionViewCell.swift; sourceTree = ""; }; 37C4BF052A1D3E86006FBFF6 /* SF-Pro-Text-Bold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-Pro-Text-Bold.ttf"; sourceTree = ""; }; 37D49A6D2A17CE5C00FBCA0F /* UIStackView+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIStackView+.swift"; sourceTree = ""; }; 37D49A6F2A18891600FBCA0F /* UITextfield+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITextfield+.swift"; sourceTree = ""; }; @@ -70,7 +73,6 @@ 3E9683EB2A1654CF00D6DD30 /* UIViewController+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+.swift"; sourceTree = ""; }; 3E9683ED2A16562700D6DD30 /* UIView+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+.swift"; sourceTree = ""; }; 3E9683EF2A1656A800D6DD30 /* SizeLiteral.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SizeLiteral.swift; sourceTree = ""; }; - 7E0148BA2A1890530036147D /* MainFeedViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainFeedViewController.swift; sourceTree = ""; }; 3EEE765E2A1678E800D0B80E /* UserProfileView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserProfileView.swift; sourceTree = ""; }; 3EEE76602A1757D400D0B80E /* NewPostViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewPostViewController.swift; sourceTree = ""; }; 3EEE76622A175ECD00D0B80E /* BottomMenuContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BottomMenuContentView.swift; sourceTree = ""; }; @@ -111,6 +113,15 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 372AAF702A20E7C8009212A8 /* Cell */ = { + isa = PBXGroup; + children = ( + 372AAF722A20E7FC009212A8 /* DMTableviewCell.swift */, + 372AAF742A20E808009212A8 /* DMCollectionViewCell.swift */, + ); + path = Cell; + sourceTree = ""; + }; 3EEE766B2A17AEC000D0B80E /* NewPostImageCollection */ = { isa = PBXGroup; children = ( @@ -323,6 +334,7 @@ 7E8DF5942A1237120023948F /* DMList */ = { isa = PBXGroup; children = ( + 372AAF702A20E7C8009212A8 /* Cell */, 7E8DF5B32A1239100023948F /* DMList.swift */, ); path = DMList; @@ -434,12 +446,11 @@ 3EEE766F2A17B5D800D0B80E /* CollectionViewAddCellButton.swift in Sources */, 7E8DF59C2A1238770023948F /* EndPoint.swift in Sources */, 7E8DF59E2A12387E0023948F /* Service.swift in Sources */, + 372AAF732A20E7FC009212A8 /* DMTableviewCell.swift in Sources */, 3E6CF47C2A14F63700DC3B2B /* BaseTableViewCell.swift in Sources */, 3E9683F02A1656A800D6DD30 /* SizeLiteral.swift in Sources */, 3E9683EE2A16562700D6DD30 /* UIView+.swift in Sources */, - 7E8DF5AE2A1238F80023948F /* MainFeed.swift in Sources */, 7E0148BB2A1890530036147D /* MainFeedViewController.swift in Sources */, - 7E8DF5732A12306B0023948F /* ViewController.swift in Sources */, 3EEE765F2A1678E800D0B80E /* UserProfileView.swift in Sources */, 3E6CF47A2A14F43500DC3B2B /* BaseViewController.swift in Sources */, 3E9683E42A16319A00D6DD30 /* UIColor+.swift in Sources */, @@ -455,6 +466,7 @@ 7E8DF56F2A12306B0023948F /* AppDelegate.swift in Sources */, 7E8DF5AC2A1238D40023948F /* Font.swift in Sources */, 7E8DF5712A12306B0023948F /* SceneDelegate.swift in Sources */, + 372AAF752A20E808009212A8 /* DMCollectionViewCell.swift in Sources */, 7E8DF5982A12385E0023948F /* Protocol.swift in Sources */, 7E8DF59A2A12386D0023948F /* API.swift in Sources */, 3E9683EC2A1654CF00D6DD30 /* UIViewController+.swift in Sources */, diff --git a/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMCollectionViewCell.swift b/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMCollectionViewCell.swift new file mode 100644 index 0000000..3a5e63f --- /dev/null +++ b/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMCollectionViewCell.swift @@ -0,0 +1,57 @@ +// +// DMCollectionViewCell.swift +// Instagram-iOS +// +// Created by Joon Baek on 2023/05/26. +// + +import UIKit + +import SnapKit + +final class DMCollectionViewCell: BaseCollectionViewCell { + + // MARK: - Property + // MARK: - UI Property + +// let userProfileView = UserProfileView(usedView: .dm, storyStatus: .none) + let userProfileView: UIImageView = { + let image = UIImageView() + image.backgroundColor = .blue + return image + }() + + let usernameLabel: UILabel = { + let label = UILabel() + label.text = "hanyee" + label.font = .detail4 + label.textColor = .gray2 + return label + }() + + + // MARK: - Layout + + override func setLayout() { + addSubview(userProfileView) + userProfileView.snp.makeConstraints { + $0.top.equalToSuperview().offset(10) + $0.leading.equalToSuperview().offset(7) + $0.centerX.equalToSuperview() + } + + addSubview(usernameLabel) + usernameLabel.snp.makeConstraints { + $0.top.equalTo(userProfileView.snp.bottom).offset(10) + $0.centerX.equalTo(userProfileView) + } + } + + override func setStyle() { + + } + + // MARK: - Custom Method + + +} diff --git a/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableviewCell.swift b/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableviewCell.swift new file mode 100644 index 0000000..0c4fd08 --- /dev/null +++ b/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableviewCell.swift @@ -0,0 +1,82 @@ +// +// DMTableviewCell.swift +// Instagram-iOS +// +// Created by Joon Baek on 2023/05/26. +// + +import UIKit + +import SnapKit + +final class DMTableviewCell: BaseTableViewCell { + + // MARK: - Property + // MARK: - UI Property + +// let userProfileView = UserProfileView(usedView: .dm, storyStatus: .none) + private let userProfileView: UIImageView = { + let image = UIImageView() + image.backgroundColor = .blue + return image + }() + + private let usernameLabel: UILabel = { + let label = UILabel() + label.text = "hanyee" + label.font = .detail2 + label.textColor = .gray2 + return label + }() + + private let textMessageLabel: UILabel = { + let label = UILabel() + label.text = "hanyee" + label.font = .detail2kor + label.textColor = .gray2 + return label + }() + + private lazy var starButton: UIButton = { + let button = UIButton() + button.backgroundColor = .yellow + return button + }() + + + // MARK: - Layout + + override func setLayout() { + addSubview(userProfileView) + userProfileView.snp.makeConstraints { + $0.centerY.equalToSuperview() + $0.leading.equalToSuperview().offset(14) + } + + addSubview(usernameLabel) + usernameLabel.snp.makeConstraints { + $0.top.equalToSuperview().offset(21) + $0.leading.equalTo(userProfileView.snp.trailing).offset(10) + } + + addSubview(textMessageLabel) + textMessageLabel.snp.makeConstraints { + $0.top.equalTo(usernameLabel).offset(2) + $0.leading.equalTo(usernameLabel) + } + + addSubview(starButton) + starButton.snp.makeConstraints { + $0.centerY.equalToSuperview() + $0.trailing.equalToSuperview().offset(-9) + } + } + + override func setStyle() { + + } + + // MARK: - Custom Method + + +} From 29c629dd1d67ca18a410227af34f65ec7e6f0c42 Mon Sep 17 00:00:00 2001 From: Joon Baek Date: Fri, 26 May 2023 22:58:34 +0900 Subject: [PATCH 02/15] =?UTF-8?q?[Chore]=20#27=20-=20#19=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=EB=A6=AC=EB=B7=B0=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Instagram-iOS/Screens/DMList/DMList.swift | 71 ++++++++++--------- 1 file changed, 37 insertions(+), 34 deletions(-) diff --git a/Instagram-iOS/Instagram-iOS/Screens/DMList/DMList.swift b/Instagram-iOS/Instagram-iOS/Screens/DMList/DMList.swift index e2286c0..9a740e0 100644 --- a/Instagram-iOS/Instagram-iOS/Screens/DMList/DMList.swift +++ b/Instagram-iOS/Instagram-iOS/Screens/DMList/DMList.swift @@ -2,7 +2,7 @@ // DMList.swift // Instagram-iOS // -// Created by 김사랑 on 2023/05/15. +// Created by 백준 on 2023/05/15. // import UIKit @@ -13,62 +13,70 @@ final class DMListViewController: BaseViewController { // MARK: - Property + ㅅ + // MARK: - UI Property + let userNameLabel: UILabel = { + let label = UILabel() + label.font = .title1 + label.textColor = .black1 + label.text = "gosopt_cds_app1" + return label + }() + + let arrowDownButton = UIButton() + + let videoCallButton = UIButton() + + let newMessageButton = UIButton() + + let backButton: UIButton = { + let button = UIButton() + button.setImage(ImageLiteral.NavBar.DMList.arrowBack, for: .normal) + return button + }() + let customNaviView = UIView() private let searchTextField: UITextField = { let textField = UITextField() textField.backgroundColor = .gray5 textField.font = .body - textField.placeholder = "검색" + //TODO: - 추후 placeholder 세팅 시 추가하겠습니다 +// textField.placeholder = "검색" return textField }() + + // MARK: - Life Cycle override func viewDidLoad() { super.viewDidLoad() setSearchTextFieldUI() - } + } - // MARK: - Setting +// MARK: - Setting override func setNavigationBar() { super.setNavigationBar() - let backButton = UIButton() - backButton.setImage(ImageLiteral.NavBar.DMList.arrowBack, for: .normal) - let backButtonItem = UIBarButtonItem(customView: backButton) - let userNameLabel: UILabel = { - let label = UILabel() - label.font = .title1 - label.textColor = .black1 - label.text = "gosopt_cds_app1" - return label - }() - let userNameLabelItem = UIBarButtonItem(customView: userNameLabel) - let arrowButton = UIButton() - arrowButton.setImage(ImageLiteral.NavBar.DMList.arrowBottom, for: .normal) - - let arrowButtonItem = UIBarButtonItem(customView: arrowButton) - - let videoCallButton = UIButton() - videoCallButton.setImage(ImageLiteral.NavBar.DMList.camera, for: .normal) + let arrowDownButtonItem = UIBarButtonItem(customView: arrowDownButton) let videoCallButtonItem = UIBarButtonItem(customView: videoCallButton) - let newMessageButton = UIButton() - newMessageButton.setImage(ImageLiteral.NavBar.DMList.newDM, for: .normal) - let newMessageButtonItem = UIBarButtonItem(customView: newMessageButton) - navigationItem.leftBarButtonItems = [backButtonItem, userNameLabelItem, arrowButtonItem] + arrowDownButton.setImage(ImageLiteral.NavBar.DMList.arrowBottom, for: .normal) + videoCallButton.setImage(ImageLiteral.NavBar.DMList.camera, for: .normal) + newMessageButton.setImage(ImageLiteral.NavBar.DMList.newDM, for: .normal) + navigationItem.leftBarButtonItems = [backButtonItem, userNameLabelItem, arrowDownButtonItem] navigationItem.rightBarButtonItems = [videoCallButtonItem, newMessageButtonItem] } @@ -89,21 +97,16 @@ final class DMListViewController: BaseViewController { } } - // MARK: - Action Helper +// MARK: - Action Helper - // MARK: - Custom Method +// MARK: - Custom Method private func setSearchTextFieldUI() { -// let searchImageView = UIImageView(image: ImageLiteral.NavBar.DMList.search) -// searchImageView.frame = CGRect(x: 0, y: 0, width: 10, height: searchTextField.frame.height) - -// searchTextField.leftView = searchImageView -// searchTextField.leftViewMode = .always searchTextField.layer.cornerRadius = 10 searchTextField.backgroundColor = .gray5 searchTextField.font = .body - searchTextField.attributedPlaceholder = NSAttributedString(string: "검색", attributes: [NSAttributedString.Key.foregroundColor: UIColor.lightGray]) +// searchTextField.attributedPlaceholder = NSAttributedString(string: "검색", attributes: [NSAttributedString.Key.foregroundColor: UIColor.lightGray]) } } From 578ca0de6d9ac65f4b0aa12afab785bce8310186 Mon Sep 17 00:00:00 2001 From: Joon Baek Date: Fri, 26 May 2023 23:22:09 +0900 Subject: [PATCH 03/15] =?UTF-8?q?[Feat]=20#27=20-=20DMListTableViewCell=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Instagram-iOS/Screens/DMList/Cell/DMTableviewCell.swift | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableviewCell.swift b/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableviewCell.swift index 0c4fd08..7dd692d 100644 --- a/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableviewCell.swift +++ b/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableviewCell.swift @@ -31,7 +31,7 @@ final class DMTableviewCell: BaseTableViewCell { private let textMessageLabel: UILabel = { let label = UILabel() - label.text = "hanyee" + label.text = "디엠디엠디엠" label.font = .detail2kor label.textColor = .gray2 return label @@ -51,6 +51,7 @@ final class DMTableviewCell: BaseTableViewCell { userProfileView.snp.makeConstraints { $0.centerY.equalToSuperview() $0.leading.equalToSuperview().offset(14) + $0.width.height.equalTo(58) } addSubview(usernameLabel) @@ -61,7 +62,7 @@ final class DMTableviewCell: BaseTableViewCell { addSubview(textMessageLabel) textMessageLabel.snp.makeConstraints { - $0.top.equalTo(usernameLabel).offset(2) + $0.top.equalTo(usernameLabel.snp.bottom).offset(2) $0.leading.equalTo(usernameLabel) } From cafdb19051e5d4526fc00a6f18e3996ea7644844 Mon Sep 17 00:00:00 2001 From: Joon Baek Date: Fri, 26 May 2023 23:22:26 +0900 Subject: [PATCH 04/15] =?UTF-8?q?[Feat]=20#27=20-=20DMListTableView=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Instagram-iOS/Screens/DMList/DMList.swift | 86 +++++++++++++------ 1 file changed, 61 insertions(+), 25 deletions(-) diff --git a/Instagram-iOS/Instagram-iOS/Screens/DMList/DMList.swift b/Instagram-iOS/Instagram-iOS/Screens/DMList/DMList.swift index 9a740e0..8ec9446 100644 --- a/Instagram-iOS/Instagram-iOS/Screens/DMList/DMList.swift +++ b/Instagram-iOS/Instagram-iOS/Screens/DMList/DMList.swift @@ -13,8 +13,6 @@ final class DMListViewController: BaseViewController { // MARK: - Property - ㅅ - // MARK: - UI Property let userNameLabel: UILabel = { @@ -39,27 +37,37 @@ final class DMListViewController: BaseViewController { let customNaviView = UIView() - private let searchTextField: UITextField = { - let textField = UITextField() - textField.backgroundColor = .gray5 - textField.font = .body - //TODO: - 추후 placeholder 세팅 시 추가하겠습니다 -// textField.placeholder = "검색" - return textField +// private let searchTextField: UITextField = { +// let textField = UITextField() +// textField.backgroundColor = .gray5 +// textField.font = .body +// //TODO: - 추후 placeholder 세팅 시 추가하겠습니다 +//// textField.placeholder = "검색" +// return textField +// }() + + private let DMListTableView: UITableView = { + let tableView = UITableView() + tableView.register(DMTableviewCell.self, forCellReuseIdentifier: DMTableviewCell.identifier) + return tableView }() - - // MARK: - Life Cycle override func viewDidLoad() { super.viewDidLoad() - setSearchTextFieldUI() +// setSearchTextFieldUI() + configDelegate() } // MARK: - Setting + private func configDelegate() { + DMListTableView.delegate = self + DMListTableView.dataSource = self + } + override func setNavigationBar() { super.setNavigationBar() @@ -88,12 +96,17 @@ final class DMListViewController: BaseViewController { $0.leading.trailing.equalToSuperview() } - view.addSubview(searchTextField) - searchTextField.snp.makeConstraints { - $0.top.equalTo(customNaviView.snp.bottom).offset(8) - $0.centerX.equalToSuperview() - $0.leading.equalToSuperview().offset(16) - $0.height.equalTo(35) +// view.addSubview(searchTextField) +// searchTextField.snp.makeConstraints { +// $0.top.equalTo(customNaviView.snp.bottom).offset(8) +// $0.centerX.equalToSuperview() +// $0.leading.equalToSuperview().offset(16) +// $0.height.equalTo(35) +// } + + view.addSubview(DMListTableView) + DMListTableView.snp.makeConstraints { + $0.edges.equalToSuperview() } } @@ -101,12 +114,35 @@ final class DMListViewController: BaseViewController { // MARK: - Custom Method - private func setSearchTextFieldUI() { - - searchTextField.layer.cornerRadius = 10 - searchTextField.backgroundColor = .gray5 - searchTextField.font = .body -// searchTextField.attributedPlaceholder = NSAttributedString(string: "검색", attributes: [NSAttributedString.Key.foregroundColor: UIColor.lightGray]) - +// private func setSearchTextFieldUI() { +// +// searchTextField.layer.cornerRadius = 10 +// searchTextField.backgroundColor = .gray5 +// searchTextField.font = .body +//// searchTextField.attributedPlaceholder = NSAttributedString(string: "검색", attributes: [NSAttributedString.Key.foregroundColor: UIColor.lightGray]) +// +// } +} + +//MARK: - UITableViewDelegate +extension DMListViewController: UITableViewDelegate { + +} + +//MARK: - UITableViewDataSource +extension DMListViewController: UITableViewDataSource { + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return 10 + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell = tableView.dequeueReusableCell(withIdentifier: DMTableviewCell.identifier, for: indexPath) as! DMTableviewCell + return cell + } + + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { + return 74 } + + } From 63bed21fb128a1dd19830397f155d0a627be65fa Mon Sep 17 00:00:00 2001 From: Joon Baek Date: Sat, 27 May 2023 00:48:12 +0900 Subject: [PATCH 05/15] =?UTF-8?q?[Feat]=20-=20#27=20TabelViewHeader=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Instagram-iOS.xcodeproj/project.pbxproj | 4 ++ .../DMList/Cell/DMTableViewHeader.swift | 69 +++++++++++++++++++ .../Instagram-iOS/Screens/DMList/DMList.swift | 56 +++++---------- 3 files changed, 92 insertions(+), 37 deletions(-) create mode 100644 Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableViewHeader.swift diff --git a/Instagram-iOS/Instagram-iOS.xcodeproj/project.pbxproj b/Instagram-iOS/Instagram-iOS.xcodeproj/project.pbxproj index 8f8c642..8b1cb35 100644 --- a/Instagram-iOS/Instagram-iOS.xcodeproj/project.pbxproj +++ b/Instagram-iOS/Instagram-iOS.xcodeproj/project.pbxproj @@ -9,6 +9,7 @@ /* Begin PBXBuildFile section */ 372AAF732A20E7FC009212A8 /* DMTableviewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 372AAF722A20E7FC009212A8 /* DMTableviewCell.swift */; }; 372AAF752A20E808009212A8 /* DMCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 372AAF742A20E808009212A8 /* DMCollectionViewCell.swift */; }; + 372AAF772A20F90F009212A8 /* DMTableViewHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 372AAF762A20F90F009212A8 /* DMTableViewHeader.swift */; }; 37C4BF062A1D3E86006FBFF6 /* SF-Pro-Text-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 37C4BF052A1D3E86006FBFF6 /* SF-Pro-Text-Bold.ttf */; }; 3E6CF47A2A14F43500DC3B2B /* BaseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E6CF4792A14F43500DC3B2B /* BaseViewController.swift */; }; 3E6CF47C2A14F63700DC3B2B /* BaseTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E6CF47B2A14F63700DC3B2B /* BaseTableViewCell.swift */; }; @@ -55,6 +56,7 @@ /* Begin PBXFileReference section */ 372AAF722A20E7FC009212A8 /* DMTableviewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DMTableviewCell.swift; sourceTree = ""; }; 372AAF742A20E808009212A8 /* DMCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DMCollectionViewCell.swift; sourceTree = ""; }; + 372AAF762A20F90F009212A8 /* DMTableViewHeader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DMTableViewHeader.swift; sourceTree = ""; }; 37C4BF052A1D3E86006FBFF6 /* SF-Pro-Text-Bold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-Pro-Text-Bold.ttf"; sourceTree = ""; }; 37D49A6D2A17CE5C00FBCA0F /* UIStackView+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIStackView+.swift"; sourceTree = ""; }; 37D49A6F2A18891600FBCA0F /* UITextfield+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITextfield+.swift"; sourceTree = ""; }; @@ -118,6 +120,7 @@ children = ( 372AAF722A20E7FC009212A8 /* DMTableviewCell.swift */, 372AAF742A20E808009212A8 /* DMCollectionViewCell.swift */, + 372AAF762A20F90F009212A8 /* DMTableViewHeader.swift */, ); path = Cell; sourceTree = ""; @@ -457,6 +460,7 @@ 7E0148C02A1BEA9A0036147D /* StoryCollectionViewCell.swift in Sources */, 3E9683E62A16392900D6DD30 /* ImageLiteral.swift in Sources */, 3EEE76682A176C9100D0B80E /* NewPostImageCollectionViewCell.swift in Sources */, + 372AAF772A20F90F009212A8 /* DMTableViewHeader.swift in Sources */, 7E8DF5A02A1238840023948F /* Models.swift in Sources */, 7E0148BE2A1BE8780036147D /* StoryCollectionView.swift in Sources */, 3E6CF47E2A14F84500DC3B2B /* BaseCollectionViewCell.swift in Sources */, diff --git a/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableViewHeader.swift b/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableViewHeader.swift new file mode 100644 index 0000000..4dd749c --- /dev/null +++ b/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableViewHeader.swift @@ -0,0 +1,69 @@ +// +// DMTableViewHeader.swift +// Instagram-iOS +// +// Created by Joon Baek on 2023/05/26. +// + +import UIKit + +import SnapKit + +final class DMTableViewHeader: UITableViewHeaderFooterView { + + static let identifier = "DMTableViewHeader" + + private let titleLabel: UILabel = { + let label = UILabel() + label.font = .bodyKorBold + label.textColor = .black1 + label.text = "즐겨찾기" + return label + }() + + private let searchTextField: UITextField = { + let textField = UITextField() + textField.backgroundColor = .gray5 + textField.font = .body + //TODO: - 추후 placeholder 세팅 시 추가하겠습니다 + // textField.placeholder = "검색" + return textField + }() + + override init(reuseIdentifier: String?) { + super.init(reuseIdentifier: DMTableViewHeader.identifier) + + setLayout() + setSearchTextFieldUI() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + private func setLayout() { + + contentView.addSubview(searchTextField) + searchTextField.snp.makeConstraints { + $0.top.centerX.equalToSuperview() + $0.leading.equalToSuperview().offset(16) + $0.height.equalTo(35) + } + + contentView.addSubview(titleLabel) + titleLabel.snp.makeConstraints { + $0.top.equalTo(searchTextField.snp.bottom).offset(18) + $0.leading.equalToSuperview().offset(20) + } + } + + private func setSearchTextFieldUI() { + + searchTextField.layer.cornerRadius = 10 + searchTextField.backgroundColor = .gray5 + searchTextField.font = .body + // searchTextField.attributedPlaceholder = NSAttributedString(string: "검색", attributes: [NSAttributedString.Key.foregroundColor: UIColor.lightGray]) + + } +} + diff --git a/Instagram-iOS/Instagram-iOS/Screens/DMList/DMList.swift b/Instagram-iOS/Instagram-iOS/Screens/DMList/DMList.swift index 8ec9446..308acab 100644 --- a/Instagram-iOS/Instagram-iOS/Screens/DMList/DMList.swift +++ b/Instagram-iOS/Instagram-iOS/Screens/DMList/DMList.swift @@ -37,18 +37,10 @@ final class DMListViewController: BaseViewController { let customNaviView = UIView() -// private let searchTextField: UITextField = { -// let textField = UITextField() -// textField.backgroundColor = .gray5 -// textField.font = .body -// //TODO: - 추후 placeholder 세팅 시 추가하겠습니다 -//// textField.placeholder = "검색" -// return textField -// }() - private let DMListTableView: UITableView = { let tableView = UITableView() tableView.register(DMTableviewCell.self, forCellReuseIdentifier: DMTableviewCell.identifier) + tableView.register(DMTableViewHeader.self, forHeaderFooterViewReuseIdentifier: DMTableViewHeader.identifier) return tableView }() @@ -57,11 +49,10 @@ final class DMListViewController: BaseViewController { override func viewDidLoad() { super.viewDidLoad() -// setSearchTextFieldUI() configDelegate() - } + } -// MARK: - Setting + // MARK: - Setting private func configDelegate() { DMListTableView.delegate = self @@ -96,43 +87,35 @@ final class DMListViewController: BaseViewController { $0.leading.trailing.equalToSuperview() } -// view.addSubview(searchTextField) -// searchTextField.snp.makeConstraints { -// $0.top.equalTo(customNaviView.snp.bottom).offset(8) -// $0.centerX.equalToSuperview() -// $0.leading.equalToSuperview().offset(16) -// $0.height.equalTo(35) -// } - view.addSubview(DMListTableView) DMListTableView.snp.makeConstraints { $0.edges.equalToSuperview() } } - -// MARK: - Action Helper - -// MARK: - Custom Method - -// private func setSearchTextFieldUI() { -// -// searchTextField.layer.cornerRadius = 10 -// searchTextField.backgroundColor = .gray5 -// searchTextField.font = .body -//// searchTextField.attributedPlaceholder = NSAttributedString(string: "검색", attributes: [NSAttributedString.Key.foregroundColor: UIColor.lightGray]) -// -// } } //MARK: - UITableViewDelegate extension DMListViewController: UITableViewDelegate { + func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { + return 82 + 90 + 22 + } + + func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { + let headerView = tableView.dequeueReusableHeaderFooterView(withIdentifier: DMTableViewHeader.identifier) as! DMTableViewHeader + return headerView + } } //MARK: - UITableViewDataSource extension DMListViewController: UITableViewDataSource { + + func numberOfSections(in tableView: UITableView) -> Int { + return 2 // set your desired number of sections + } + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - return 10 + return 10 // set your desired number of rows per section } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { @@ -141,8 +124,7 @@ extension DMListViewController: UITableViewDataSource { } func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { - return 74 + return 74 // set your desired row height } - - } + From c44d168b5ab8d9e791484afb09667c5b2bb3cb4f Mon Sep 17 00:00:00 2001 From: Joon Baek Date: Tue, 30 May 2023 00:18:08 +0900 Subject: [PATCH 06/15] =?UTF-8?q?[Chore]=20-=20DMList=20=EB=BC=88=EB=8C=80?= =?UTF-8?q?=20UI=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Instagram-iOS/Screens/DMList/DMList.swift | 56 ++++++++++++------- 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/Instagram-iOS/Instagram-iOS/Screens/DMList/DMList.swift b/Instagram-iOS/Instagram-iOS/Screens/DMList/DMList.swift index 308acab..8ec9446 100644 --- a/Instagram-iOS/Instagram-iOS/Screens/DMList/DMList.swift +++ b/Instagram-iOS/Instagram-iOS/Screens/DMList/DMList.swift @@ -37,10 +37,18 @@ final class DMListViewController: BaseViewController { let customNaviView = UIView() +// private let searchTextField: UITextField = { +// let textField = UITextField() +// textField.backgroundColor = .gray5 +// textField.font = .body +// //TODO: - 추후 placeholder 세팅 시 추가하겠습니다 +//// textField.placeholder = "검색" +// return textField +// }() + private let DMListTableView: UITableView = { let tableView = UITableView() tableView.register(DMTableviewCell.self, forCellReuseIdentifier: DMTableviewCell.identifier) - tableView.register(DMTableViewHeader.self, forHeaderFooterViewReuseIdentifier: DMTableViewHeader.identifier) return tableView }() @@ -49,10 +57,11 @@ final class DMListViewController: BaseViewController { override func viewDidLoad() { super.viewDidLoad() +// setSearchTextFieldUI() configDelegate() - } + } - // MARK: - Setting +// MARK: - Setting private func configDelegate() { DMListTableView.delegate = self @@ -87,35 +96,43 @@ final class DMListViewController: BaseViewController { $0.leading.trailing.equalToSuperview() } +// view.addSubview(searchTextField) +// searchTextField.snp.makeConstraints { +// $0.top.equalTo(customNaviView.snp.bottom).offset(8) +// $0.centerX.equalToSuperview() +// $0.leading.equalToSuperview().offset(16) +// $0.height.equalTo(35) +// } + view.addSubview(DMListTableView) DMListTableView.snp.makeConstraints { $0.edges.equalToSuperview() } } + +// MARK: - Action Helper + +// MARK: - Custom Method + +// private func setSearchTextFieldUI() { +// +// searchTextField.layer.cornerRadius = 10 +// searchTextField.backgroundColor = .gray5 +// searchTextField.font = .body +//// searchTextField.attributedPlaceholder = NSAttributedString(string: "검색", attributes: [NSAttributedString.Key.foregroundColor: UIColor.lightGray]) +// +// } } //MARK: - UITableViewDelegate extension DMListViewController: UITableViewDelegate { - func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { - return 82 + 90 + 22 - } - - func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { - let headerView = tableView.dequeueReusableHeaderFooterView(withIdentifier: DMTableViewHeader.identifier) as! DMTableViewHeader - return headerView - } } //MARK: - UITableViewDataSource extension DMListViewController: UITableViewDataSource { - - func numberOfSections(in tableView: UITableView) -> Int { - return 2 // set your desired number of sections - } - func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - return 10 // set your desired number of rows per section + return 10 } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { @@ -124,7 +141,8 @@ extension DMListViewController: UITableViewDataSource { } func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { - return 74 // set your desired row height + return 74 } + + } - From c272606af6a80dc5e7ef6fd9ea3a7379579ba673 Mon Sep 17 00:00:00 2001 From: Joon Baek Date: Thu, 1 Jun 2023 22:19:09 +0900 Subject: [PATCH 07/15] =?UTF-8?q?Auto=20stash=20before=20cherry=20pick=20o?= =?UTF-8?q?f=20"[Add]=20#27=20-=20=ED=94=84=EB=A1=9C=EC=A0=9D=ED=8A=B8=20?= =?UTF-8?q?=ED=8C=8C=EC=9D=BC"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Instagram-iOS.xcodeproj/project.pbxproj | 4 + .../Instagram-iOS/Screens/DMList/DMList.swift | 87 +++++++++++++++---- 2 files changed, 75 insertions(+), 16 deletions(-) diff --git a/Instagram-iOS/Instagram-iOS.xcodeproj/project.pbxproj b/Instagram-iOS/Instagram-iOS.xcodeproj/project.pbxproj index 8b1cb35..c28d4fb 100644 --- a/Instagram-iOS/Instagram-iOS.xcodeproj/project.pbxproj +++ b/Instagram-iOS/Instagram-iOS.xcodeproj/project.pbxproj @@ -10,6 +10,7 @@ 372AAF732A20E7FC009212A8 /* DMTableviewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 372AAF722A20E7FC009212A8 /* DMTableviewCell.swift */; }; 372AAF752A20E808009212A8 /* DMCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 372AAF742A20E808009212A8 /* DMCollectionViewCell.swift */; }; 372AAF772A20F90F009212A8 /* DMTableViewHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 372AAF762A20F90F009212A8 /* DMTableViewHeader.swift */; }; + 372AAF952A24E3C4009212A8 /* DMTableViewCellHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 372AAF942A24E3C4009212A8 /* DMTableViewCellHeader.swift */; }; 37C4BF062A1D3E86006FBFF6 /* SF-Pro-Text-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 37C4BF052A1D3E86006FBFF6 /* SF-Pro-Text-Bold.ttf */; }; 3E6CF47A2A14F43500DC3B2B /* BaseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E6CF4792A14F43500DC3B2B /* BaseViewController.swift */; }; 3E6CF47C2A14F63700DC3B2B /* BaseTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E6CF47B2A14F63700DC3B2B /* BaseTableViewCell.swift */; }; @@ -57,6 +58,7 @@ 372AAF722A20E7FC009212A8 /* DMTableviewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DMTableviewCell.swift; sourceTree = ""; }; 372AAF742A20E808009212A8 /* DMCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DMCollectionViewCell.swift; sourceTree = ""; }; 372AAF762A20F90F009212A8 /* DMTableViewHeader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DMTableViewHeader.swift; sourceTree = ""; }; + 372AAF942A24E3C4009212A8 /* DMTableViewCellHeader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DMTableViewCellHeader.swift; sourceTree = ""; }; 37C4BF052A1D3E86006FBFF6 /* SF-Pro-Text-Bold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-Pro-Text-Bold.ttf"; sourceTree = ""; }; 37D49A6D2A17CE5C00FBCA0F /* UIStackView+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIStackView+.swift"; sourceTree = ""; }; 37D49A6F2A18891600FBCA0F /* UITextfield+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITextfield+.swift"; sourceTree = ""; }; @@ -121,6 +123,7 @@ 372AAF722A20E7FC009212A8 /* DMTableviewCell.swift */, 372AAF742A20E808009212A8 /* DMCollectionViewCell.swift */, 372AAF762A20F90F009212A8 /* DMTableViewHeader.swift */, + 372AAF942A24E3C4009212A8 /* DMTableViewCellHeader.swift */, ); path = Cell; sourceTree = ""; @@ -460,6 +463,7 @@ 7E0148C02A1BEA9A0036147D /* StoryCollectionViewCell.swift in Sources */, 3E9683E62A16392900D6DD30 /* ImageLiteral.swift in Sources */, 3EEE76682A176C9100D0B80E /* NewPostImageCollectionViewCell.swift in Sources */, + 372AAF952A24E3C4009212A8 /* DMTableViewCellHeader.swift in Sources */, 372AAF772A20F90F009212A8 /* DMTableViewHeader.swift in Sources */, 7E8DF5A02A1238840023948F /* Models.swift in Sources */, 7E0148BE2A1BE8780036147D /* StoryCollectionView.swift in Sources */, diff --git a/Instagram-iOS/Instagram-iOS/Screens/DMList/DMList.swift b/Instagram-iOS/Instagram-iOS/Screens/DMList/DMList.swift index 8ec9446..a17452f 100644 --- a/Instagram-iOS/Instagram-iOS/Screens/DMList/DMList.swift +++ b/Instagram-iOS/Instagram-iOS/Screens/DMList/DMList.swift @@ -15,6 +15,25 @@ final class DMListViewController: BaseViewController { // MARK: - UI Property + let header = UIView() + + private let headerTitleLabel: UILabel = { + let label = UILabel() + label.font = .bodyKorBold + label.textColor = .black1 + label.text = "즐겨찾기" + return label + }() + + private let searchTextField: UITextField = { + let textField = UITextField() + textField.backgroundColor = .gray5 + textField.font = .body + //TODO: - 추후 placeholder 세팅 시 추가하겠습니다 + // textField.placeholder = "검색" + return textField + }() + let userNameLabel: UILabel = { let label = UILabel() label.font = .title1 @@ -48,10 +67,12 @@ final class DMListViewController: BaseViewController { private let DMListTableView: UITableView = { let tableView = UITableView() + tableView.register(DMTableViewCellHeader.self, forHeaderFooterViewReuseIdentifier: DMTableViewCellHeader.identifier) tableView.register(DMTableviewCell.self, forCellReuseIdentifier: DMTableviewCell.identifier) return tableView }() + // MARK: - Life Cycle override func viewDidLoad() { @@ -59,7 +80,8 @@ final class DMListViewController: BaseViewController { // setSearchTextFieldUI() configDelegate() - } + setSearchTextFieldUI() + } // MARK: - Setting @@ -85,11 +107,27 @@ final class DMListViewController: BaseViewController { videoCallButton.setImage(ImageLiteral.NavBar.DMList.camera, for: .normal) newMessageButton.setImage(ImageLiteral.NavBar.DMList.newDM, for: .normal) navigationItem.leftBarButtonItems = [backButtonItem, userNameLabelItem, arrowDownButtonItem] - navigationItem.rightBarButtonItems = [videoCallButtonItem, newMessageButtonItem] + navigationItem.rightBarButtonItems = [newMessageButtonItem, videoCallButtonItem] } override func setLayout() { + DMListTableView.tableHeaderView = header + + view.addSubview(header) + header.snp.makeConstraints { + $0.top.equalTo(view.safeAreaLayoutGuide) + $0.leading.trailing.equalToSuperview() + $0.height.equalTo(155) + } + + header.addSubview(searchTextField) + searchTextField.snp.makeConstraints { + $0.top.centerX.equalToSuperview() + $0.leading.equalToSuperview().offset(16) + $0.height.equalTo(35) + } + view.addSubview(customNaviView) customNaviView.snp.makeConstraints { $0.top.equalTo(view.safeAreaLayoutGuide.snp.top) @@ -109,28 +147,45 @@ final class DMListViewController: BaseViewController { $0.edges.equalToSuperview() } } + + private func setSearchTextFieldUI() { -// MARK: - Action Helper - -// MARK: - Custom Method + searchTextField.layer.cornerRadius = 10 + searchTextField.backgroundColor = .gray5 + searchTextField.font = .body + // searchTextField.attributedPlaceholder = NSAttributedString(string: "검색", attributes: [NSAttributedString.Key.foregroundColor: UIColor.lightGray]) -// private func setSearchTextFieldUI() { -// -// searchTextField.layer.cornerRadius = 10 -// searchTextField.backgroundColor = .gray5 -// searchTextField.font = .body -//// searchTextField.attributedPlaceholder = NSAttributedString(string: "검색", attributes: [NSAttributedString.Key.foregroundColor: UIColor.lightGray]) -// -// } + } } //MARK: - UITableViewDelegate -extension DMListViewController: UITableViewDelegate { - -} + +extension DMListViewController: UITableViewDelegate {} //MARK: - UITableViewDataSource + extension DMListViewController: UITableViewDataSource { + + //MARK: - Header + +// func numberOfSections(in tableView: UITableView) -> Int { +// return 1 // set your desired number of sections +// } + + func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { + guard let header = tableView.dequeueReusableHeaderFooterView(withIdentifier: DMTableViewCellHeader.identifier) as? DMTableViewCellHeader else { + fatalError("header fail") + } + + return header + } + + func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { + return 47 + } + + //MARK: - Cells + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return 10 } From a72647028e0600f6d3bdc16e56c6963095295233 Mon Sep 17 00:00:00 2001 From: Joon Baek Date: Tue, 30 May 2023 00:00:43 +0900 Subject: [PATCH 08/15] =?UTF-8?q?[Feat]=20#27=20-=20DMTableViewCellHeader?= =?UTF-8?q?=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DMList/Cell/DMTableViewCellHeader.swift | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableViewCellHeader.swift diff --git a/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableViewCellHeader.swift b/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableViewCellHeader.swift new file mode 100644 index 0000000..34a879d --- /dev/null +++ b/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableViewCellHeader.swift @@ -0,0 +1,43 @@ +// +// DMTableViewCellHeader.swift +// Instagram-iOS +// +// Created by Joon Baek on 2023/05/29. +// + +import UIKit + +import SnapKit + +final class DMTableViewCellHeader: UITableViewHeaderFooterView { + + static let identifier = "DMTableViewCellHeader" + + private let sectionLabel: UILabel = { + let label = UILabel() + label.font = .bodyKorBold + label.textColor = .black1 + label.text = "메시지" + return label + }() + + override init(reuseIdentifier: String?) { + super.init(reuseIdentifier: reuseIdentifier) + + setLayout() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + private func setLayout() { + + addSubview(sectionLabel) + + sectionLabel.snp.makeConstraints { + $0.leading.equalToSuperview().offset(16) + $0.bottom.equalToSuperview().offset(-8) + } + } +} From d81272f310b68681d7835ca6318e7c31f493cc86 Mon Sep 17 00:00:00 2001 From: Joon Baek Date: Sat, 3 Jun 2023 01:28:48 +0900 Subject: [PATCH 09/15] =?UTF-8?q?[Chore]=20#27=20-=20=EB=BC=88=EB=8C=80?= =?UTF-8?q?=EB=B7=B0=20=EC=99=84=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DMList/Cell/DMCollectionViewCell.swift | 1 + .../DMList/Cell/DMTableViewHeader.swift | 81 +++++++++++- .../Instagram-iOS/Screens/DMList/DMList.swift | 121 ++++-------------- 3 files changed, 102 insertions(+), 101 deletions(-) diff --git a/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMCollectionViewCell.swift b/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMCollectionViewCell.swift index 3a5e63f..0eea0ab 100644 --- a/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMCollectionViewCell.swift +++ b/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMCollectionViewCell.swift @@ -37,6 +37,7 @@ final class DMCollectionViewCell: BaseCollectionViewCell { userProfileView.snp.makeConstraints { $0.top.equalToSuperview().offset(10) $0.leading.equalToSuperview().offset(7) + $0.width.height.equalTo(58) $0.centerX.equalToSuperview() } diff --git a/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableViewHeader.swift b/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableViewHeader.swift index 4dd749c..d2df4a9 100644 --- a/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableViewHeader.swift +++ b/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableViewHeader.swift @@ -9,9 +9,17 @@ import UIKit import SnapKit -final class DMTableViewHeader: UITableViewHeaderFooterView { +final class DMTableViewHeader: UIView { - static let identifier = "DMTableViewHeader" + private lazy var storyCollectionView: UICollectionView = { + let layout = UICollectionViewFlowLayout() + layout.scrollDirection = .horizontal + + let collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout) + collectionView.translatesAutoresizingMaskIntoConstraints = false + collectionView.showsVerticalScrollIndicator = false + return collectionView + }() private let titleLabel: UILabel = { let label = UILabel() @@ -30,9 +38,11 @@ final class DMTableViewHeader: UITableViewHeaderFooterView { return textField }() - override init(reuseIdentifier: String?) { - super.init(reuseIdentifier: DMTableViewHeader.identifier) + override init(frame: CGRect) { + super.init(frame: frame) + register() + configDelegate() setLayout() setSearchTextFieldUI() } @@ -41,20 +51,42 @@ final class DMTableViewHeader: UITableViewHeaderFooterView { fatalError("init(coder:) has not been implemented") } + //MARK: - Setting + + private func register() { + storyCollectionView.register(DMCollectionViewCell.self, forCellWithReuseIdentifier: DMCollectionViewCell.identifier) + } + + private func configDelegate() { + storyCollectionView.delegate = self + storyCollectionView.dataSource = self + } + private func setLayout() { - contentView.addSubview(searchTextField) + backgroundColor = .white1 + + addSubview(searchTextField) searchTextField.snp.makeConstraints { - $0.top.centerX.equalToSuperview() + $0.top.centerX.equalToSuperview().offset(8) + $0.centerX.equalToSuperview() $0.leading.equalToSuperview().offset(16) $0.height.equalTo(35) } - contentView.addSubview(titleLabel) + addSubview(titleLabel) titleLabel.snp.makeConstraints { $0.top.equalTo(searchTextField.snp.bottom).offset(18) $0.leading.equalToSuperview().offset(20) } + + addSubview(storyCollectionView) + storyCollectionView.snp.makeConstraints { + $0.top.equalTo(titleLabel.snp.bottom).offset(4) + $0.centerX.equalToSuperview() + $0.leading.equalToSuperview().offset(14) + $0.height.equalTo(90) + } } private func setSearchTextFieldUI() { @@ -67,3 +99,38 @@ final class DMTableViewHeader: UITableViewHeaderFooterView { } } +//MARK: - UICollectionViewDelegateFlowLayout + +extension DMTableViewHeader: UICollectionViewDelegateFlowLayout { + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { + return CGSize(width: 72, height: 90) + } + + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat { + return 4 + } + + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat { + return 0 + } + +// func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets { +// return UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0) +// } +} + +//MARK: - UICollectionViewDataSource + +extension DMTableViewHeader: UICollectionViewDataSource { + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + return 9 + } + + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: DMCollectionViewCell.identifier, for: indexPath) as? DMCollectionViewCell else { return UICollectionViewCell() } + + return cell + } + + +} diff --git a/Instagram-iOS/Instagram-iOS/Screens/DMList/DMList.swift b/Instagram-iOS/Instagram-iOS/Screens/DMList/DMList.swift index a17452f..d006275 100644 --- a/Instagram-iOS/Instagram-iOS/Screens/DMList/DMList.swift +++ b/Instagram-iOS/Instagram-iOS/Screens/DMList/DMList.swift @@ -6,33 +6,13 @@ // import UIKit - import SnapKit final class DMListViewController: BaseViewController { - // MARK: - Property - // MARK: - UI Property - let header = UIView() - - private let headerTitleLabel: UILabel = { - let label = UILabel() - label.font = .bodyKorBold - label.textColor = .black1 - label.text = "즐겨찾기" - return label - }() - - private let searchTextField: UITextField = { - let textField = UITextField() - textField.backgroundColor = .gray5 - textField.font = .body - //TODO: - 추후 placeholder 세팅 시 추가하겠습니다 - // textField.placeholder = "검색" - return textField - }() + private let headerView = DMTableViewHeader() let userNameLabel: UILabel = { let label = UILabel() @@ -56,17 +36,9 @@ final class DMListViewController: BaseViewController { let customNaviView = UIView() -// private let searchTextField: UITextField = { -// let textField = UITextField() -// textField.backgroundColor = .gray5 -// textField.font = .body -// //TODO: - 추후 placeholder 세팅 시 추가하겠습니다 -//// textField.placeholder = "검색" -// return textField -// }() - private let DMListTableView: UITableView = { - let tableView = UITableView() + let tableView = UITableView(frame: .zero, style: .grouped) + tableView.separatorColor = .clear tableView.register(DMTableViewCellHeader.self, forHeaderFooterViewReuseIdentifier: DMTableViewCellHeader.identifier) tableView.register(DMTableviewCell.self, forCellReuseIdentifier: DMTableviewCell.identifier) return tableView @@ -78,14 +50,10 @@ final class DMListViewController: BaseViewController { override func viewDidLoad() { super.viewDidLoad() -// setSearchTextFieldUI() - configDelegate() - setSearchTextFieldUI() + configTableView() } -// MARK: - Setting - - private func configDelegate() { + private func configTableView() { DMListTableView.delegate = self DMListTableView.dataSource = self } @@ -111,81 +79,48 @@ final class DMListViewController: BaseViewController { } override func setLayout() { - - DMListTableView.tableHeaderView = header - - view.addSubview(header) - header.snp.makeConstraints { - $0.top.equalTo(view.safeAreaLayoutGuide) - $0.leading.trailing.equalToSuperview() - $0.height.equalTo(155) - } - - header.addSubview(searchTextField) - searchTextField.snp.makeConstraints { - $0.top.centerX.equalToSuperview() - $0.leading.equalToSuperview().offset(16) - $0.height.equalTo(35) - } - view.addSubview(customNaviView) customNaviView.snp.makeConstraints { $0.top.equalTo(view.safeAreaLayoutGuide.snp.top) $0.leading.trailing.equalToSuperview() } - -// view.addSubview(searchTextField) -// searchTextField.snp.makeConstraints { -// $0.top.equalTo(customNaviView.snp.bottom).offset(8) -// $0.centerX.equalToSuperview() -// $0.leading.equalToSuperview().offset(16) -// $0.height.equalTo(35) -// } + + DMListTableView.tableHeaderView = headerView view.addSubview(DMListTableView) DMListTableView.snp.makeConstraints { - $0.edges.equalToSuperview() + $0.top.equalTo(view.safeAreaLayoutGuide) + $0.leading.bottom.trailing.equalToSuperview() } } - - private func setSearchTextFieldUI() { - - searchTextField.layer.cornerRadius = 10 - searchTextField.backgroundColor = .gray5 - searchTextField.font = .body - // searchTextField.attributedPlaceholder = NSAttributedString(string: "검색", attributes: [NSAttributedString.Key.foregroundColor: UIColor.lightGray]) - - } } //MARK: - UITableViewDelegate -extension DMListViewController: UITableViewDelegate {} - -//MARK: - UITableViewDataSource - -extension DMListViewController: UITableViewDataSource { - - //MARK: - Header - -// func numberOfSections(in tableView: UITableView) -> Int { -// return 1 // set your desired number of sections -// } - +extension DMListViewController: UITableViewDelegate { func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { - guard let header = tableView.dequeueReusableHeaderFooterView(withIdentifier: DMTableViewCellHeader.identifier) as? DMTableViewCellHeader else { - fatalError("header fail") + switch section { + case 0: + return DMTableViewHeader() + default: + guard let header = tableView.dequeueReusableHeaderFooterView(withIdentifier: DMTableViewCellHeader.identifier) as? DMTableViewCellHeader else {fatalError("header fail")} + return header } - - return header } func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { - return 47 + switch section { + case 0: + return 172 + default: + return 47 + } } - - //MARK: - Cells - +} + +//MARK: - UITableViewDataSource + +extension DMListViewController: UITableViewDataSource { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return 10 } @@ -198,6 +133,4 @@ extension DMListViewController: UITableViewDataSource { func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { return 74 } - - } From 1974260e382c86345abb02f2815377bb459d6205 Mon Sep 17 00:00:00 2001 From: Joon Baek Date: Sat, 3 Jun 2023 01:29:18 +0900 Subject: [PATCH 10/15] =?UTF-8?q?[Chore]=20#27=20-=20DMTableViewCellHeader?= =?UTF-8?q?=EC=97=90=20=EB=A7=88=ED=81=AC=EC=A3=BC=EC=84=9D=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/DMList/Cell/DMTableViewCellHeader.swift | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableViewCellHeader.swift b/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableViewCellHeader.swift index 34a879d..de43e9f 100644 --- a/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableViewCellHeader.swift +++ b/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableViewCellHeader.swift @@ -10,8 +10,11 @@ import UIKit import SnapKit final class DMTableViewCellHeader: UITableViewHeaderFooterView { - + // MARK: - Property + static let identifier = "DMTableViewCellHeader" + + // MARK: - UI Property private let sectionLabel: UILabel = { let label = UILabel() @@ -21,6 +24,8 @@ final class DMTableViewCellHeader: UITableViewHeaderFooterView { return label }() + // MARK: - Life Cycle + override init(reuseIdentifier: String?) { super.init(reuseIdentifier: reuseIdentifier) @@ -31,10 +36,11 @@ final class DMTableViewCellHeader: UITableViewHeaderFooterView { fatalError("init(coder:) has not been implemented") } + // MARK: - Layout + private func setLayout() { addSubview(sectionLabel) - sectionLabel.snp.makeConstraints { $0.leading.equalToSuperview().offset(16) $0.bottom.equalToSuperview().offset(-8) From 198d0afc8e51985aa8771ad369407db57b2872ad Mon Sep 17 00:00:00 2001 From: Joon Baek Date: Sat, 3 Jun 2023 13:52:08 +0900 Subject: [PATCH 11/15] =?UTF-8?q?[Chore]=20#27=20-=20userProfileView=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/DMList/Cell/DMCollectionViewCell.swift | 7 +------ .../Screens/DMList/Cell/DMTableViewHeader.swift | 10 +--------- .../Screens/DMList/Cell/DMTableviewCell.swift | 12 +++++------- 3 files changed, 7 insertions(+), 22 deletions(-) diff --git a/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMCollectionViewCell.swift b/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMCollectionViewCell.swift index 0eea0ab..24be607 100644 --- a/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMCollectionViewCell.swift +++ b/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMCollectionViewCell.swift @@ -14,12 +14,7 @@ final class DMCollectionViewCell: BaseCollectionViewCell { // MARK: - Property // MARK: - UI Property -// let userProfileView = UserProfileView(usedView: .dm, storyStatus: .none) - let userProfileView: UIImageView = { - let image = UIImageView() - image.backgroundColor = .blue - return image - }() + let userProfileView = UserProfileView(usedView: .dm, storyStatus: .none) let usernameLabel: UILabel = { let label = UILabel() diff --git a/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableViewHeader.swift b/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableViewHeader.swift index d2df4a9..8bac9b2 100644 --- a/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableViewHeader.swift +++ b/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableViewHeader.swift @@ -77,7 +77,7 @@ final class DMTableViewHeader: UIView { addSubview(titleLabel) titleLabel.snp.makeConstraints { $0.top.equalTo(searchTextField.snp.bottom).offset(18) - $0.leading.equalToSuperview().offset(20) + $0.leading.equalToSuperview().offset(16) } addSubview(storyCollectionView) @@ -109,14 +109,6 @@ extension DMTableViewHeader: UICollectionViewDelegateFlowLayout { func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat { return 4 } - - func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat { - return 0 - } - -// func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets { -// return UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0) -// } } //MARK: - UICollectionViewDataSource diff --git a/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableviewCell.swift b/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableviewCell.swift index 7dd692d..b46d8da 100644 --- a/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableviewCell.swift +++ b/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableviewCell.swift @@ -12,14 +12,10 @@ import SnapKit final class DMTableviewCell: BaseTableViewCell { // MARK: - Property + // MARK: - UI Property -// let userProfileView = UserProfileView(usedView: .dm, storyStatus: .none) - private let userProfileView: UIImageView = { - let image = UIImageView() - image.backgroundColor = .blue - return image - }() + let userProfileView = UserProfileView(usedView: .dm, storyStatus: .none) private let usernameLabel: UILabel = { let label = UILabel() @@ -39,7 +35,8 @@ final class DMTableviewCell: BaseTableViewCell { private lazy var starButton: UIButton = { let button = UIButton() - button.backgroundColor = .yellow + button.setImage(UIImage(systemName: "star.fill"), for: .normal) + button.tintColor = .systemYellow return button }() @@ -70,6 +67,7 @@ final class DMTableviewCell: BaseTableViewCell { starButton.snp.makeConstraints { $0.centerY.equalToSuperview() $0.trailing.equalToSuperview().offset(-9) + $0.width.height.equalTo(29) } } From e4fb03f23f8b5fdbede5c205fe1520c0657c75e6 Mon Sep 17 00:00:00 2001 From: Joon Baek Date: Sun, 4 Jun 2023 15:52:16 +0900 Subject: [PATCH 12/15] =?UTF-8?q?[Chore]=20#27=20-=20MessageLabel=20?= =?UTF-8?q?=EB=A0=88=EC=9D=B4=EC=95=84=EC=9B=83=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DMList/Cell/DMTableViewHeader.swift | 14 +++++++++ .../Instagram-iOS/Screens/DMList/DMList.swift | 29 ++++++++++--------- 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableViewHeader.swift b/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableViewHeader.swift index 8bac9b2..56a59e5 100644 --- a/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableViewHeader.swift +++ b/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableViewHeader.swift @@ -38,6 +38,14 @@ final class DMTableViewHeader: UIView { return textField }() + private let sectionLabel: UILabel = { + let label = UILabel() + label.font = .bodyKorBold + label.textColor = .black1 + label.text = "메시지" + return label + }() + override init(frame: CGRect) { super.init(frame: frame) @@ -87,6 +95,12 @@ final class DMTableViewHeader: UIView { $0.leading.equalToSuperview().offset(14) $0.height.equalTo(90) } + + addSubview(sectionLabel) + sectionLabel.snp.makeConstraints { + $0.leading.equalToSuperview().offset(16) + $0.bottom.equalToSuperview().offset(-8) + } } private func setSearchTextFieldUI() { diff --git a/Instagram-iOS/Instagram-iOS/Screens/DMList/DMList.swift b/Instagram-iOS/Instagram-iOS/Screens/DMList/DMList.swift index d006275..a40147f 100644 --- a/Instagram-iOS/Instagram-iOS/Screens/DMList/DMList.swift +++ b/Instagram-iOS/Instagram-iOS/Screens/DMList/DMList.swift @@ -99,22 +99,25 @@ final class DMListViewController: BaseViewController { extension DMListViewController: UITableViewDelegate { func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { - switch section { - case 0: - return DMTableViewHeader() - default: - guard let header = tableView.dequeueReusableHeaderFooterView(withIdentifier: DMTableViewCellHeader.identifier) as? DMTableViewCellHeader else {fatalError("header fail")} - return header - } +// switch section { +// case 0: +// return DMTableViewHeader() +// default: +// guard let header = tableView.dequeueReusableHeaderFooterView(withIdentifier: DMTableViewCellHeader.identifier) as? DMTableViewCellHeader else {fatalError("header fail")} +// return header +// } + return DMTableViewHeader() } func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { - switch section { - case 0: - return 172 - default: - return 47 - } +// switch section { +// case 0: +// return 172 +// default: +// return 47 +// } + + return 172 + 42 } } From 8d5133377383d5a64716fa3c3bf9f5d28e0d8a70 Mon Sep 17 00:00:00 2001 From: Joon Baek Date: Sun, 4 Jun 2023 21:22:22 +0900 Subject: [PATCH 13/15] =?UTF-8?q?[Chore]=20#27=20-=20=EB=B6=88=ED=95=84?= =?UTF-8?q?=EC=9A=94=ED=95=9C=20=EC=A3=BC=EC=84=9D=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Instagram-iOS/Screens/DMList/DMList.swift | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/Instagram-iOS/Instagram-iOS/Screens/DMList/DMList.swift b/Instagram-iOS/Instagram-iOS/Screens/DMList/DMList.swift index a40147f..d7f93ca 100644 --- a/Instagram-iOS/Instagram-iOS/Screens/DMList/DMList.swift +++ b/Instagram-iOS/Instagram-iOS/Screens/DMList/DMList.swift @@ -99,24 +99,10 @@ final class DMListViewController: BaseViewController { extension DMListViewController: UITableViewDelegate { func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { -// switch section { -// case 0: -// return DMTableViewHeader() -// default: -// guard let header = tableView.dequeueReusableHeaderFooterView(withIdentifier: DMTableViewCellHeader.identifier) as? DMTableViewCellHeader else {fatalError("header fail")} -// return header -// } return DMTableViewHeader() } func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { -// switch section { -// case 0: -// return 172 -// default: -// return 47 -// } - return 172 + 42 } } From 45363584b534aa3df36af759d191976dd30a947a Mon Sep 17 00:00:00 2001 From: Joon Baek Date: Tue, 6 Jun 2023 20:50:32 +0900 Subject: [PATCH 14/15] =?UTF-8?q?[Feat]=20#27=20-=20=EC=BD=94=EB=93=9C?= =?UTF-8?q?=EB=A6=AC=EB=B7=B0=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/DMList/Cell/DMCollectionViewCell.swift | 9 +-------- .../Screens/DMList/Cell/DMTableViewCellHeader.swift | 1 + .../Screens/DMList/Cell/DMTableViewHeader.swift | 13 ++++--------- .../Screens/DMList/Cell/DMTableviewCell.swift | 11 ----------- 4 files changed, 6 insertions(+), 28 deletions(-) diff --git a/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMCollectionViewCell.swift b/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMCollectionViewCell.swift index 24be607..ccdfc0b 100644 --- a/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMCollectionViewCell.swift +++ b/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMCollectionViewCell.swift @@ -11,7 +11,6 @@ import SnapKit final class DMCollectionViewCell: BaseCollectionViewCell { - // MARK: - Property // MARK: - UI Property let userProfileView = UserProfileView(usedView: .dm, storyStatus: .none) @@ -24,7 +23,6 @@ final class DMCollectionViewCell: BaseCollectionViewCell { return label }() - // MARK: - Layout override func setLayout() { @@ -43,11 +41,6 @@ final class DMCollectionViewCell: BaseCollectionViewCell { } } - override func setStyle() { - - } - // MARK: - Custom Method - - + } diff --git a/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableViewCellHeader.swift b/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableViewCellHeader.swift index de43e9f..68260f5 100644 --- a/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableViewCellHeader.swift +++ b/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableViewCellHeader.swift @@ -10,6 +10,7 @@ import UIKit import SnapKit final class DMTableViewCellHeader: UITableViewHeaderFooterView { + // MARK: - Property static let identifier = "DMTableViewCellHeader" diff --git a/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableViewHeader.swift b/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableViewHeader.swift index 56a59e5..bc69d7e 100644 --- a/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableViewHeader.swift +++ b/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableViewHeader.swift @@ -35,6 +35,7 @@ final class DMTableViewHeader: UIView { textField.font = .body //TODO: - 추후 placeholder 세팅 시 추가하겠습니다 // textField.placeholder = "검색" + textField.layer.cornerRadius = 10 return textField }() @@ -52,6 +53,7 @@ final class DMTableViewHeader: UIView { register() configDelegate() setLayout() + setStyle() setSearchTextFieldUI() } @@ -72,8 +74,6 @@ final class DMTableViewHeader: UIView { private func setLayout() { - backgroundColor = .white1 - addSubview(searchTextField) searchTextField.snp.makeConstraints { $0.top.centerX.equalToSuperview().offset(8) @@ -103,13 +103,8 @@ final class DMTableViewHeader: UIView { } } - private func setSearchTextFieldUI() { - - searchTextField.layer.cornerRadius = 10 - searchTextField.backgroundColor = .gray5 - searchTextField.font = .body - // searchTextField.attributedPlaceholder = NSAttributedString(string: "검색", attributes: [NSAttributedString.Key.foregroundColor: UIColor.lightGray]) - + private func setStyle() { + backgroundColor = .white1 } } diff --git a/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableviewCell.swift b/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableviewCell.swift index b46d8da..9f26d02 100644 --- a/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableviewCell.swift +++ b/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableviewCell.swift @@ -11,8 +11,6 @@ import SnapKit final class DMTableviewCell: BaseTableViewCell { - // MARK: - Property - // MARK: - UI Property let userProfileView = UserProfileView(usedView: .dm, storyStatus: .none) @@ -40,7 +38,6 @@ final class DMTableviewCell: BaseTableViewCell { return button }() - // MARK: - Layout override func setLayout() { @@ -70,12 +67,4 @@ final class DMTableviewCell: BaseTableViewCell { $0.width.height.equalTo(29) } } - - override func setStyle() { - - } - - // MARK: - Custom Method - - } From 83e42ddc3645a693c15507af1484cecf4bf2c815 Mon Sep 17 00:00:00 2001 From: Joon Baek Date: Tue, 6 Jun 2023 21:01:33 +0900 Subject: [PATCH 15/15] =?UTF-8?q?[Chore]=20#27=20-=20ScrollIndicator=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Instagram-iOS/Screens/DMList/Cell/DMTableViewHeader.swift | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableViewHeader.swift b/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableViewHeader.swift index bc69d7e..43050a6 100644 --- a/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableViewHeader.swift +++ b/Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableViewHeader.swift @@ -17,7 +17,7 @@ final class DMTableViewHeader: UIView { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout) collectionView.translatesAutoresizingMaskIntoConstraints = false - collectionView.showsVerticalScrollIndicator = false + collectionView.showsHorizontalScrollIndicator = false return collectionView }() @@ -54,7 +54,6 @@ final class DMTableViewHeader: UIView { configDelegate() setLayout() setStyle() - setSearchTextFieldUI() } required init?(coder: NSCoder) {