Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

책 편집하는 뷰 작성 #71

Merged
merged 29 commits into from
Nov 21, 2024
Merged

책 편집하는 뷰 작성 #71

merged 29 commits into from
Nov 21, 2024

Conversation

iceHood
Copy link
Collaborator

@iceHood iceHood commented Nov 21, 2024

#️⃣ 연관된 이슈


⏰ 작업 시간

편집셀하고 테이블뷰 관련 내용이 합쳐져 있어서 시간계산이 애매하네요

  • 편집 셀 (평균: 6.3, 본인: 7)
  • 테이블 뷰 만들기 aka수정화면 (평균: 2.3, 본인: 4)
    위에가 원래 시간이긴한데,일단 테이블뷰 만들기를 가져가고 편집셀에서는 반정도 가져오겠습니다.
    평균: 3+2.3 = 5.3
    본인: 3.5+4 = 7.5
    실제 투자한 시간은 3.5정도입니다... 그동안 졸프때매 질질끌었네요... 죄송합니다 ㅠㅠ
예상 시간 실제 걸린 시간
5.3 3.5

📝 작업 내용

  • 필요한 에셋 추가
  • edit 뷰모델까지 연결만 하기 (필수)
  • 버튼 액션 연결만 하기 (필수)
  • 키보드 로직 구현하기 (중요도 낮음)
    • 버튼이랑 같이 올라오기 정도

📸 스크린샷

2024-11-21.11.42.24.mov

📒 리뷰 노트

ViewModel에 대한 input-output 구성

어떻게 할지 살짝 고민입니다.
발행을 눌렀을 때 저장을 하게 하면 셀이 재사용되면서 내부 내용을 지워질것같다? 라는 느낌이 들어서...

  • 변경된 것을 추적해서 발행버튼을 눌러서 해당 페이지들만 저장하는 방법도 있을 것 같습니다.
  • 또는, 입력을 할 때마다 실시간으로 저장하는 방법이 있습니다. (이경우 input이 많아질수도? MHData를 먼저 만들어서 보관하는 로직으로 구현해야 할지 고민입니다.)

사실 저장이 주요로직이다보니... 레포가 불확정적이라 문제네요 일단 다음 목표는 사진, 동영상 등등을 표현할 수 있는 뷰를 만드는 것을 목표로 잡겠습니다.


@iceHood iceHood added ✨ Feature 기능 관련 작업 🎨 Design 에셋, 컴포넌트 작업 labels Nov 21, 2024
@iceHood iceHood added this to the 0.2 milestone Nov 21, 2024
@iceHood iceHood self-assigned this Nov 21, 2024
@iceHood iceHood linked an issue Nov 21, 2024 that may be closed by this pull request
Copy link
Collaborator

@k2645 k2645 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

정말 수고 많으셨습니다 🥹 이제 드디어 대망의 편집뷰.. 시작.. ㄷㄷ

Comment on lines 101 to 103
private func configureNavigationBar() {
navigationController?.navigationBar.isHidden = true
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: 생각해보니 저희 디자인엔 없지만.. 편집이 아니라 책을 새로 만드는 경우에는 뒤로 가기를 통해 책 표지 생성 페이지로 갈 수 있어야하지 않았나요...? 디자인 수정을 못해서 죄송합니다.. ㅠㅠ 그냥 네비바를 놔두고 좌상단엔 뒤로가기, 우상단에 발생을 넣는건 어떨까.. 싶습니당..

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

좋습니당!! 저도 사실 불편하다고 생각하고 있었어욤

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

처음 만들었을 때는 아래의 예쁜 발행버튼으로 나오기로 했습니다.
홈에서 들어갈 때는 오른쪽위에 저장버튼이 나오도록 했습니다!
사실 alert도 저장이 어떻게 되냐에 따라 달라지기는 하는 것같긴 합니다...

2024-11-21.1.32.00.mov

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

너무 좋습니당 .ᐟ.ᐟ

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

그럼 이 화면에서는 네비 오른쪽 버튼과 타이틀은 없는 걸까요 ??

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

그럼 이 화면에서는 네비 오른쪽 버튼과 타이틀은 없는 걸까요 ??

홈화면에서 누를경우에는 오른쪽위에 저장버튼 나오는 식으로 구성할 생각입니다! (일단 그렇게 코딩은 해놓음)
책정보에서 title가져오는 것은 좋을 듯 싶습니다! <- TODO로 남겨놓을게욤!

Comment on lines +145 to +156
NotificationCenter.default.addObserver(
self,
selector: #selector(keyboardWillAppear),
name: UIResponder.keyboardWillShowNotification,
object: nil
)
NotificationCenter.default.addObserver(
self,
selector: #selector(keyboardWillHide),
name: UIResponder.keyboardWillHideNotification,
object: nil
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: NotificationCenter에 addObserver를 해줄경우 해당 VC가 deinit될 때, observing하고 있는 것을 remove해줘야합니다 ! remove코드도 제 editPhotoViewController에 존재하니 확인해보시고 추가해주시면 좋을 것 같습니다 !

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

제가 알기로는 이 방식으로 추가해준 것은 따로 removeObserver를 안해주어도 되는 것으로 압니다! 문서링크

If your app targets iOS 9.0 and later or macOS 10.11 and later, you do not need to unregister an observer that you created with this function. If you forget or are unable to remove an observer, the system cleans up the next time it would have posted to it.

하지만, 통일성을 위해서 deinit에 넣어놓겠습니다! (혹시 제가 아는 것과 다른 점이 있으면 알려주세용!)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

전에 다른 멘토님께 remove 자동으로 된다고 들었는데, (자료 찾아보겠습니다)
꼭 remove 명시해줘야 한다는 자료가 있나요 ??

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

엇 전에 제가 봤던 자료가 정현님이 올리신 거입니다
근데 저럴거면 없애는 걸로 통일하는게 좋지 않나요 ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

옹 저는 remove를 해줘야한다는 것까지만 읽고 그 뒤에 iOS 9 이상부터는 안해도 된다는 부분을 안 읽었던 것 같습니다...ᐟ.ᐟ 그럼 제 코드에서 remove 부분을 삭제하는게 맞는 것 같네용 .ᐟ.ᐟ 정현님 번거롭게 해드려 죄송합니다 ㅠㅠ

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

엇 전에 제가 봤던 자료가 정현님이 올리신 거입니다 근데 저럴거면 없애는 걸로 통일하는게 좋지 않나요 ?

둏습니다!

// MARK: - UITableViewDataSource
extension EditBookViewController: UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 10
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: 해당 부분은 dummy data이고 아마 viewModel의 page 개수를 가져올 자리인 것 같은데 TODO를 남겨두거나 viewModel.page.count로 수정하는건 어떨까요??

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

반영완료했읍니다!

return output.eraseToAnyPublisher()
}
private func fetchPages() {
pages = ["Image", "Video", "Text", "Audio"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: 해당 부분도 TODO로 dummy data임을 표시해주거나 삭제해주는게 좋을 것 같습니다 !

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

요것도 완료했읍니다!

Copy link
Member

@Kyxxn Kyxxn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다 !!!
뷰모델 방식에 대한 부분은 어렵긴 하네요, 다같이 얘기 해봐도 좋을 거 같습니다 !

Comment on lines +63 to +68
// MARK: - TouchEvent
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
textView.becomeFirstResponder()

super.touchesBegan(touches, with: event)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

잘 몰라서 그런데 얘는 무슨 동작을 하고 어떨 때 쓰이나요?!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이게 그냥 TableViewCell에 TextView를 넣고 누르면 TableViewCell이 먼저 반응해서 TextView가 동작을 안하더라구요... 그래서 TableViewCell에서 온 터치 이벤트를 TextView에게 �알려주어서 키보드를 띄운다음에 didSelectRowAt이 되도록 super로 후속이벤트를 처리하게 했습니다!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

감사합니다 이 메소드를 잘 몰랐어서 궁금했습니다..!
responder chain 개념에 대한 코드 이군요
제가 더 알아보겠습니다 !!!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

감사합니다 이 메소드를 잘 몰랐어서 궁금했습니다..! responder chain 개념에 대한 코드 이군요 제가 더 알아보겠습니다 !!!

혹시 찾아보시다가 더 좋은방법!이 있다면 공유 부탁드립니다 ㅎㅎ헿

Comment on lines +145 to +156
NotificationCenter.default.addObserver(
self,
selector: #selector(keyboardWillAppear),
name: UIResponder.keyboardWillShowNotification,
object: nil
)
NotificationCenter.default.addObserver(
self,
selector: #selector(keyboardWillHide),
name: UIResponder.keyboardWillHideNotification,
object: nil
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

전에 다른 멘토님께 remove 자동으로 된다고 들었는데, (자료 찾아보겠습니다)
꼭 remove 명시해줘야 한다는 자료가 있나요 ??

Comment on lines +251 to +267
// MARK: - Keyboard Appear & Hide
@objc private func keyboardWillAppear(_ notification: Notification) {
guard let keyboardInfo = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey],
let keyboardSize = keyboardInfo as? CGRect else { return }
let bottomConstant = -(keyboardSize.height - view.safeAreaInsets.bottom + 10)
buttonStackViewBottomConstraint?.constant = bottomConstant
UIView.animate(withDuration: 0.3) { [weak self] in
self?.view.layoutIfNeeded()
}
}
@objc private func keyboardWillHide() {
buttonStackViewBottomConstraint?.constant = Self.buttonBottomConstant
UIView.animate(withDuration: 0.3) { [weak self] in
self?.view.layoutIfNeeded()
}
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오 이게 키보드 활성화 됐을 때 뷰 바닥이 키보드 위로 간다는 거군요
역시 대영현

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

윤철하는 부분입니다...

@iceHood iceHood requested a review from k2645 November 21, 2024 04:53
Copy link
Collaborator

@yuncheol-AHN yuncheol-AHN left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's gooooood~~~
정현님 고생하셧습니다😄

Copy link
Collaborator

@k2645 k2645 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고 많으셨습니다 .ᐟ.ᐟ removeObserver는 없어도 될 듯 하네용..ㅎㅅㅎ

아 그리고 정현님 description에 적어주신 내용 저장하는 것은 같이 상의해봐야할 것 같긴합니다.. 개인적으로 한 페이지마다 발행버튼을 눌러서 저장하는 방식은 어색하다고 느껴져서... 흠.. 페이지 생성을 하고 해당 페이지에 내용이 작성될 때마다 내용을 저장하는 식으로 하는게 더 좋을 것 같다는 의견입니다 !

Comment on lines +145 to +156
NotificationCenter.default.addObserver(
self,
selector: #selector(keyboardWillAppear),
name: UIResponder.keyboardWillShowNotification,
object: nil
)
NotificationCenter.default.addObserver(
self,
selector: #selector(keyboardWillHide),
name: UIResponder.keyboardWillHideNotification,
object: nil
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

옹 저는 remove를 해줘야한다는 것까지만 읽고 그 뒤에 iOS 9 이상부터는 안해도 된다는 부분을 안 읽었던 것 같습니다...ᐟ.ᐟ 그럼 제 코드에서 remove 부분을 삭제하는게 맞는 것 같네용 .ᐟ.ᐟ 정현님 번거롭게 해드려 죄송합니다 ㅠㅠ

@iceHood iceHood merged commit c1c0642 into develop Nov 21, 2024
2 checks passed
@iceHood iceHood deleted the feature/book-edit-layout branch November 21, 2024 05:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎨 Design 에셋, 컴포넌트 작업 ✨ Feature 기능 관련 작업
Projects
None yet
Development

Successfully merging this pull request may close these issues.

책 내용 편집 Layout
4 participants