-
Notifications
You must be signed in to change notification settings - Fork 2
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] #27 - DMList뼈대 UI구현 #37
Open
joonBaek12
wants to merge
18
commits into
CDS-Mobile1:develop
Choose a base branch
from
joonBaek12:feat/27-DmList_tableView
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
30328f5
Merge remote-tracking branch 'upstream/develop' into feat/27-DmList_t…
joonBaek12 f25bf14
[Merge] #27 - Pull Develop
joonBaek12 e0a5d19
[Feat] #27 - DMCollectionViewCell, DMTableViewCell 구현
joonBaek12 29c629d
[Chore] #27 - #19 코드리뷰 반영
joonBaek12 578ca0d
[Feat] #27 - DMListTableViewCell 구현
joonBaek12 cafdb19
[Feat] #27 - DMListTableView 구현
joonBaek12 63bed21
[Feat] - #27 TabelViewHeader 구현
joonBaek12 c44d168
[Chore] - DMList 뼈대 UI 구현
joonBaek12 c272606
Auto stash before cherry pick of "[Add] #27 - 프로젝트 파일"
joonBaek12 a726470
[Feat] #27 - DMTableViewCellHeader 구현
joonBaek12 d81272f
[Chore] #27 - 뼈대뷰 완성
joonBaek12 1974260
[Chore] #27 - DMTableViewCellHeader에 마크주석 추가
joonBaek12 198d0af
[Chore] #27 - userProfileView 적용
joonBaek12 ea56562
[Merge] #27 - Pull Develop
joonBaek12 e4fb03f
[Chore] #27 - MessageLabel 레이아웃 추가
joonBaek12 8d51333
[Chore] #27 - 불필요한 주석 삭제
joonBaek12 4536358
[Feat] #27 - 코드리뷰 반영
joonBaek12 83e42dd
[Chore] #27 - ScrollIndicator 수정
joonBaek12 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMCollectionViewCell.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// | ||
// DMCollectionViewCell.swift | ||
// Instagram-iOS | ||
// | ||
// Created by Joon Baek on 2023/05/26. | ||
// | ||
|
||
import UIKit | ||
|
||
import SnapKit | ||
|
||
final class DMCollectionViewCell: BaseCollectionViewCell { | ||
|
||
// MARK: - UI Property | ||
|
||
let userProfileView = UserProfileView(usedView: .dm, storyStatus: .none) | ||
|
||
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.width.height.equalTo(58) | ||
$0.centerX.equalToSuperview() | ||
} | ||
|
||
addSubview(usernameLabel) | ||
usernameLabel.snp.makeConstraints { | ||
$0.top.equalTo(userProfileView.snp.bottom).offset(10) | ||
$0.centerX.equalTo(userProfileView) | ||
} | ||
} | ||
|
||
// MARK: - Custom Method | ||
|
||
} |
50 changes: 50 additions & 0 deletions
50
Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableViewCellHeader.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// | ||
// DMTableViewCellHeader.swift | ||
// Instagram-iOS | ||
// | ||
// Created by Joon Baek on 2023/05/29. | ||
// | ||
|
||
import UIKit | ||
|
||
import SnapKit | ||
|
||
final class DMTableViewCellHeader: UITableViewHeaderFooterView { | ||
|
||
// MARK: - Property | ||
|
||
static let identifier = "DMTableViewCellHeader" | ||
|
||
// MARK: - UI Property | ||
|
||
private let sectionLabel: UILabel = { | ||
let label = UILabel() | ||
label.font = .bodyKorBold | ||
label.textColor = .black1 | ||
label.text = "메시지" | ||
return label | ||
}() | ||
|
||
// MARK: - Life Cycle | ||
|
||
override init(reuseIdentifier: String?) { | ||
super.init(reuseIdentifier: reuseIdentifier) | ||
|
||
setLayout() | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
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) | ||
} | ||
} | ||
} |
136 changes: 136 additions & 0 deletions
136
Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableViewHeader.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
// | ||
// DMTableViewHeader.swift | ||
// Instagram-iOS | ||
// | ||
// Created by Joon Baek on 2023/05/26. | ||
// | ||
|
||
import UIKit | ||
|
||
import SnapKit | ||
|
||
final class DMTableViewHeader: UIView { | ||
|
||
private lazy var storyCollectionView: UICollectionView = { | ||
let layout = UICollectionViewFlowLayout() | ||
layout.scrollDirection = .horizontal | ||
|
||
let collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout) | ||
collectionView.translatesAutoresizingMaskIntoConstraints = false | ||
collectionView.showsHorizontalScrollIndicator = false | ||
return collectionView | ||
}() | ||
|
||
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 = "검색" | ||
textField.layer.cornerRadius = 10 | ||
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) | ||
|
||
register() | ||
configDelegate() | ||
setLayout() | ||
setStyle() | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
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() { | ||
|
||
addSubview(searchTextField) | ||
searchTextField.snp.makeConstraints { | ||
$0.top.centerX.equalToSuperview().offset(8) | ||
$0.centerX.equalToSuperview() | ||
$0.leading.equalToSuperview().offset(16) | ||
$0.height.equalTo(35) | ||
} | ||
|
||
addSubview(titleLabel) | ||
titleLabel.snp.makeConstraints { | ||
$0.top.equalTo(searchTextField.snp.bottom).offset(18) | ||
$0.leading.equalToSuperview().offset(16) | ||
} | ||
|
||
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) | ||
} | ||
|
||
addSubview(sectionLabel) | ||
sectionLabel.snp.makeConstraints { | ||
$0.leading.equalToSuperview().offset(16) | ||
$0.bottom.equalToSuperview().offset(-8) | ||
} | ||
} | ||
|
||
private func setStyle() { | ||
backgroundColor = .white1 | ||
} | ||
} | ||
|
||
//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 | ||
} | ||
} | ||
|
||
//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 | ||
} | ||
|
||
|
||
} |
70 changes: 70 additions & 0 deletions
70
Instagram-iOS/Instagram-iOS/Screens/DMList/Cell/DMTableviewCell.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// | ||
// DMTableviewCell.swift | ||
// Instagram-iOS | ||
// | ||
// Created by Joon Baek on 2023/05/26. | ||
// | ||
|
||
import UIKit | ||
|
||
import SnapKit | ||
|
||
final class DMTableviewCell: BaseTableViewCell { | ||
|
||
// MARK: - UI Property | ||
|
||
let userProfileView = UserProfileView(usedView: .dm, storyStatus: .none) | ||
|
||
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 = "디엠디엠디엠" | ||
label.font = .detail2kor | ||
label.textColor = .gray2 | ||
return label | ||
}() | ||
|
||
private lazy var starButton: UIButton = { | ||
let button = UIButton() | ||
button.setImage(UIImage(systemName: "star.fill"), for: .normal) | ||
button.tintColor = .systemYellow | ||
return button | ||
}() | ||
|
||
// MARK: - Layout | ||
|
||
override func setLayout() { | ||
addSubview(userProfileView) | ||
userProfileView.snp.makeConstraints { | ||
$0.centerY.equalToSuperview() | ||
$0.leading.equalToSuperview().offset(14) | ||
$0.width.height.equalTo(58) | ||
} | ||
|
||
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.snp.bottom).offset(2) | ||
$0.leading.equalTo(usernameLabel) | ||
} | ||
|
||
addSubview(starButton) | ||
starButton.snp.makeConstraints { | ||
$0.centerY.equalToSuperview() | ||
$0.trailing.equalToSuperview().offset(-9) | ||
$0.width.height.equalTo(29) | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
p3;
요건 굳이 함수로 안빼도 되고 DMCollectionView 선언한 곳에 넣어도 될 듯 하네요 !!