Skip to content

Commit

Permalink
[Feat] #51 - 답글달기 바텀시트 뷰 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
yeonsu0-0 committed Jan 14, 2024
1 parent 4e866f7 commit fda735e
Show file tree
Hide file tree
Showing 10 changed files with 647 additions and 8 deletions.
20 changes: 20 additions & 0 deletions DontBe-iOS/DontBe-iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,17 @@
2F8735462B4C34A500E55552 /* HomeCollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F8735452B4C34A500E55552 /* HomeCollectionView.swift */; };
2F8735482B4C355100E55552 /* HomeCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F8735472B4C355100E55552 /* HomeCollectionViewCell.swift */; };
2F87354C2B4D28D700E55552 /* HomeCollectionFooterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F87354B2B4D28D700E55552 /* HomeCollectionFooterView.swift */; };
2FB64FF02B5310DD0082A414 /* WriteReplyViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2FB64FEF2B5310DD0082A414 /* WriteReplyViewController.swift */; };
2FB64FF22B5318C50082A414 /* WriteReplyPostView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2FB64FF12B5318C50082A414 /* WriteReplyPostView.swift */; };
2FB64FF42B531A5C0082A414 /* WriteReplyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2FB64FF32B531A5C0082A414 /* WriteReplyView.swift */; };
2FB64FF62B531E4F0082A414 /* WriteReplyEditorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2FB64FF52B531E4F0082A414 /* WriteReplyEditorView.swift */; };
2FB769D02B5277BD004C7752 /* PostReplyTextFieldView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2FB769CF2B5277BD004C7752 /* PostReplyTextFieldView.swift */; };
2FB818D12B51693400B7498F /* PostViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2FB818D02B51693400B7498F /* PostViewController.swift */; };
2FB818D32B51694F00B7498F /* PostView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2FB818D22B51694F00B7498F /* PostView.swift */; };
2FB818D52B517EE700B7498F /* PostDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2FB818D42B517EE700B7498F /* PostDetailView.swift */; };
2FB818D92B5186FC00B7498F /* PostReplyCollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2FB818D82B5186FC00B7498F /* PostReplyCollectionView.swift */; };
2FB818DC2B51875D00B7498F /* PostReplyCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2FB818DB2B51875D00B7498F /* PostReplyCollectionViewCell.swift */; };
2FBBADF12B53AF9B002D6286 /* PostReplyCollectionFooterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2FBBADF02B53AF9B002D6286 /* PostReplyCollectionFooterView.swift */; };
3C01692A2B4DC82D0075334B /* DontBePopupView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C0920DB2B4D78DA003BD080 /* DontBePopupView.swift */; };
3C0920DE2B4D98CD003BD080 /* DontBeToastView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C0920DD2B4D98CD003BD080 /* DontBeToastView.swift */; };
3C2854FD2B3A9FD800369C99 /* ExampleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C2854FC2B3A9FD800369C99 /* ExampleViewController.swift */; };
Expand Down Expand Up @@ -153,12 +158,17 @@
2F8735452B4C34A500E55552 /* HomeCollectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeCollectionView.swift; sourceTree = "<group>"; };
2F8735472B4C355100E55552 /* HomeCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeCollectionViewCell.swift; sourceTree = "<group>"; };
2F87354B2B4D28D700E55552 /* HomeCollectionFooterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeCollectionFooterView.swift; sourceTree = "<group>"; };
2FB64FEF2B5310DD0082A414 /* WriteReplyViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WriteReplyViewController.swift; sourceTree = "<group>"; };
2FB64FF12B5318C50082A414 /* WriteReplyPostView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WriteReplyPostView.swift; sourceTree = "<group>"; };
2FB64FF32B531A5C0082A414 /* WriteReplyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WriteReplyView.swift; sourceTree = "<group>"; };
2FB64FF52B531E4F0082A414 /* WriteReplyEditorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WriteReplyEditorView.swift; sourceTree = "<group>"; };
2FB769CF2B5277BD004C7752 /* PostReplyTextFieldView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostReplyTextFieldView.swift; sourceTree = "<group>"; };
2FB818D02B51693400B7498F /* PostViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = PostViewController.swift; path = "DontBe-iOS/Presentation/Post/ViewControllers/PostViewController.swift"; sourceTree = SOURCE_ROOT; };
2FB818D22B51694F00B7498F /* PostView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostView.swift; sourceTree = "<group>"; };
2FB818D42B517EE700B7498F /* PostDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostDetailView.swift; sourceTree = "<group>"; };
2FB818D82B5186FC00B7498F /* PostReplyCollectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostReplyCollectionView.swift; sourceTree = "<group>"; };
2FB818DB2B51875D00B7498F /* PostReplyCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostReplyCollectionViewCell.swift; sourceTree = "<group>"; };
2FBBADF02B53AF9B002D6286 /* PostReplyCollectionFooterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostReplyCollectionFooterView.swift; sourceTree = "<group>"; };
3C0920DB2B4D78DA003BD080 /* DontBePopupView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DontBePopupView.swift; sourceTree = "<group>"; };
3C0920DD2B4D98CD003BD080 /* DontBeToastView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DontBeToastView.swift; sourceTree = "<group>"; };
3C2854FC2B3A9FD800369C99 /* ExampleViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExampleViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -409,6 +419,7 @@
2FB818CE2B5168D400B7498F /* ViewControllers */ = {
isa = PBXGroup;
children = (
2FB64FEF2B5310DD0082A414 /* WriteReplyViewController.swift */,
2FB818D02B51693400B7498F /* PostViewController.swift */,
);
path = ViewControllers;
Expand All @@ -420,7 +431,11 @@
2FB818D42B517EE700B7498F /* PostDetailView.swift */,
2FB818D22B51694F00B7498F /* PostView.swift */,
2FB818D82B5186FC00B7498F /* PostReplyCollectionView.swift */,
2FBBADF02B53AF9B002D6286 /* PostReplyCollectionFooterView.swift */,
2FB769CF2B5277BD004C7752 /* PostReplyTextFieldView.swift */,
2FB64FF32B531A5C0082A414 /* WriteReplyView.swift */,
2FB64FF12B5318C50082A414 /* WriteReplyPostView.swift */,
2FB64FF52B531E4F0082A414 /* WriteReplyEditorView.swift */,
);
path = Views;
sourceTree = "<group>";
Expand Down Expand Up @@ -808,6 +823,7 @@
2F1741882B500C270089FC4D /* UIApplication+.swift in Sources */,
3C2F544E2B50F65500E7BF01 /* DontBeBottomSheetView.swift in Sources */,
3C61930C2B3A782100220CEB /* StringLiterals.swift in Sources */,
2FB64FF22B5318C50082A414 /* WriteReplyPostView.swift in Sources */,
2FB818D52B517EE700B7498F /* PostDetailView.swift in Sources */,
2F8735462B4C34A500E55552 /* HomeCollectionView.swift in Sources */,
3CEE4CBD2B500A7800F506AF /* DontBeTransparencyInfoView.swift in Sources */,
Expand All @@ -820,6 +836,7 @@
3C2F54522B51224500E7BF01 /* MyPageAccountInfoViewController.swift in Sources */,
3CE9C1352B4C4BC20086E4A3 /* CircleProgressbar.swift in Sources */,
2AF069B22B518F8E00CA3E48 /* MyPageNicknameEditView.swift in Sources */,
2FB64FF42B531A5C0082A414 /* WriteReplyView.swift in Sources */,
3C6193192B3A7AC700220CEB /* Config.swift in Sources */,
3CF184D12B4EFF9900816D5F /* MyPageProfileView.swift in Sources */,
3C61931B2B3A7AD000220CEB /* NetworkError.swift in Sources */,
Expand Down Expand Up @@ -862,6 +879,8 @@
2A8D70D32B4DD360009F4C6C /* JoinAgreeViewModel.swift in Sources */,
3C2855012B3AA0A000369C99 /* ExampleCollectionViewCell.swift in Sources */,
3C2F54542B5126C600E7BF01 /* UIBarButtonItem+.swift in Sources */,
2FBBADF12B53AF9B002D6286 /* PostReplyCollectionFooterView.swift in Sources */,
2FB64FF62B531E4F0082A414 /* WriteReplyEditorView.swift in Sources */,
2FB769D02B5277BD004C7752 /* PostReplyTextFieldView.swift in Sources */,
2A2671FD2B4C3A9F009D214F /* LoginViewModel.swift in Sources */,
2FB818DC2B51875D00B7498F /* PostReplyCollectionViewCell.swift in Sources */,
Expand All @@ -881,6 +900,7 @@
2AF069AE2B514B0100CA3E48 /* NotificationEmptyViewCell.swift in Sources */,
2AC9FB1B2B4DE77400D31071 /* AgreementListCustomView.swift in Sources */,
2F17418A2B500CC20089FC4D /* HomeBottomsheetView.swift in Sources */,
2FB64FF02B5310DD0082A414 /* WriteReplyViewController.swift in Sources */,
3C01692A2B4DC82D0075334B /* DontBePopupView.swift in Sources */,
2A2671FF2B4C3AF0009D214F /* Publisher+UIControl.swift in Sources */,
3C4993672B4F2644002A99CF /* MyPageContentViewController.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ extension HomeViewController {
private func setLayout() {
homeCollectionView.snp.makeConstraints {
$0.top.equalTo(myView.safeAreaLayoutGuide.snp.top).offset(52.adjusted)
$0.bottom.equalTo(tabBarHeight)
$0.bottom.equalTo(tabBarHeight.adjusted)
$0.width.equalToSuperview()
}

uploadToastView.snp.makeConstraints {
$0.leading.trailing.equalToSuperview().inset(16.adjusted)
$0.bottom.equalTo(tabBarHeight).inset(6.adjusted)
$0.bottom.equalTo(tabBarHeight.adjusted).inset(6.adjusted)
$0.height.equalTo(44)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ extension PostViewController {
private func setUI() {
self.navigationItem.title = StringLiterals.Post.navigationTitleLabel
textFieldView.replyTextFieldLabel.text = (postUserNickname ?? "") + StringLiterals.Post.textFieldLabel
self.view.backgroundColor = .donGray1

self.view.backgroundColor = .donWhite
}

private func setHierarchy() {
Expand Down Expand Up @@ -105,7 +106,7 @@ extension PostViewController {
}

textFieldView.snp.makeConstraints {
$0.bottom.equalTo(tabBarHeight)
$0.bottom.equalTo(tabBarHeight.adjusted)
$0.leading.trailing.equalToSuperview()
$0.height.equalTo(56.adjusted)
}
Expand All @@ -129,7 +130,12 @@ extension PostViewController {
}

@objc func textFieldDidTapped() {

showReplyVC()
}

private func showReplyVC() {
let navigationController = UINavigationController(rootViewController: WriteReplyViewController())
present(navigationController, animated: true, completion: nil)
}
}

Expand All @@ -156,7 +162,13 @@ extension PostViewController: UICollectionViewDataSource {
}

func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
guard let footer = postReplyCollectionView.dequeueReusableSupplementaryView(ofKind: UICollectionView.elementKindSectionFooter, withReuseIdentifier: "HomeCollectionFooterView", for: indexPath) as? HomeCollectionFooterView else { return UICollectionReusableView() }
guard let footer = postReplyCollectionView.dequeueReusableSupplementaryView(ofKind: UICollectionView.elementKindSectionFooter, withReuseIdentifier: "PostReplyCollectionFooterView", for: indexPath) as? PostReplyCollectionFooterView else { return UICollectionReusableView() }
footer.backgroundColor = .red
return footer
}

func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForFooterInSection section: Int) -> CGSize {

return CGSize(width: UIScreen.main.bounds.width, height: 24.adjusted)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
//
// WriteReplyViewController.swift
// DontBe-iOS
//
// Created by yeonsu on 1/14/24.
//

import UIKit

final class WriteReplyViewController: UIViewController {

// MARK: - Properties

// MARK: - UI Components

private let myView = WriteReplyView()

// MARK: - Life Cycles

override func loadView() {
super.loadView()

view = myView
}

override func viewDidLoad() {
super.viewDidLoad()

getAPI()
setUI()
setHierarchy()
setLayout()
setDelegate()
setBottomSheet()
setNavigationBarButtonItem()
}
}

// MARK: - Extensions

extension WriteReplyViewController {
private func setUI() {
myView.backgroundColor = .donWhite
title = "답글달기"
}

private func setHierarchy() {

}

private func setLayout() {

}

private func setDelegate() {

}

private func setBottomSheet() {
/// 밑으로 내려도 dismiss되지 않는 옵션 값
isModalInPresentation = true

if let sheet = sheetPresentationController {
sheet.detents = [.medium(), .large()]
sheet.selectedDetentIdentifier = .large
sheet.largestUndimmedDetentIdentifier = .medium
sheet.prefersScrollingExpandsWhenScrolledToEdge = true
sheet.prefersGrabberVisible = false
}
}

private func setNavigationBarButtonItem() {
let cancelButton = UIBarButtonItem(title: "취소", primaryAction: .init(handler: { [weak self] _Arg in
self?.dismiss(animated: true)
}))
navigationItem.leftBarButtonItem = cancelButton
let attributes: [NSAttributedString.Key: Any] = [
.foregroundColor: UIColor.donGray11,
.font: UIFont.font(.caption4)
]
cancelButton.setTitleTextAttributes(attributes, for: .normal)
cancelButton.setTitleTextAttributes(attributes, for: .highlighted)
}
}

// MARK: - Network

extension WriteReplyViewController {
private func getAPI() {

}
}

//extension ExampleViewController: UICollectionViewDelegate {
//
//}
//
//extension ExampleViewController: UICollectionViewDataSource {
//
//}
//
//extension ExampleViewController: UICollectionViewFlowLayout {
//
//}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
//
// PostReplyCollectionFooterView.swift
// DontBe-iOS
//
// Created by yeonsu on 1/14/24.
//

import UIKit

final class PostReplyCollectionFooterView: UICollectionReusableView {

// MARK: - Properties

static let identifier = "PostReplyCollectionFooterView"

// MARK: - UI Components

private let footerView: UIView = {
let view = UIView()
view.backgroundColor = .orange
return view
}()

// MARK: - Life Cycles

override init(frame: CGRect) {
super.init(frame: frame)

setUI()
setHierarchy()
setLayout()
}

@available(*, unavailable)
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}

// MARK: - Extensions

extension PostReplyCollectionFooterView {
func setUI() {
self.backgroundColor = .donGray1
}

func setHierarchy() {
self.addSubviews(footerView)
}

func setLayout() {
footerView.snp.makeConstraints {
$0.height.equalTo(2.adjusted)

}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ private extension PostReplyCollectionView {

func setRegisterCell() {
PostReplyCollectionViewCell.register(collectionView: collectionView)
collectionView.register(HomeCollectionFooterView.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionFooter, withReuseIdentifier: "HomeCollectionFooterView")
collectionView.register(PostReplyCollectionFooterView.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionFooter, withReuseIdentifier: "PostReplyCollectionFooterView")
}
}
Loading

0 comments on commit fda735e

Please sign in to comment.