Style/#428 댓글, 답글 UI 구현#440
Hidden character warning
Conversation
추후 서버 연결시 주석해제
|
|
||
| import UIKit | ||
|
|
||
| protocol KeyboardHandleProtocol: UIViewController { |
There was a problem hiding this comment.
우와 protocol이 UIViewController를 상속받은 건가요 .......?????? 컴파일 에러가 발생하지 않았나요 . . . ? 신기하네요 ...
프로토콜에서 채택 타입에 따른 제약은 저는 보통
extension KeyboardHandleProtocol where Self: UIViewController { ~
이런식으로 사용했던 것 같은데 ...!
There was a problem hiding this comment.
생각해보니 안나더라고요.... 왜지.. where로 수정하겠습니다!!
| let writtenAt: String | ||
| let content: String | ||
| let writerID: Int | ||
| let userID: Int |
There was a problem hiding this comment.
writerID는 왜 이름을 id라고 지은 건가용?
There was a problem hiding this comment.
디티오가 바뀌어서 그거에 따라 수정해주었습니다!!
| protocol CommentProtocol: AnyObject { | ||
| func moreLabelDidTap(commentID: Int) | ||
| func replyIconDidTap(commentID: Int) | ||
| } | ||
|
|
||
| extension CommentProtocol { | ||
| func replyIconDidTap(commentID: Int) { } | ||
| } |
| showAllText: Bool, | ||
| isReplySheet: Bool | ||
| ) { | ||
| if let _ = replyCount { |
There was a problem hiding this comment.
이거 replyCount != nil 이렇게 해주어도 될 듯 해요 !
There was a problem hiding this comment.
고생하셧어요 , . . . . 애증의 더보기
| func likeButtonDidTap() | ||
| } | ||
|
|
||
| final class QuestContentView: UIView { |
There was a problem hiding this comment.
얘는 BaseView 사용하지 않은 이유가 잇나용
| func moreLabelDidTap(commentID: Int) { | ||
| let updatedItems = dataSource.snapshot().itemIdentifiers.map { item -> CommentItem in | ||
| guard item.entity.commentID == commentID else { return item } | ||
| return CommentItem(entity: item.entity, showAllText: true) |
dev-domo
left a comment
There was a problem hiding this comment.
수고하셨습니다! Diffable 활용 대단하네요😯 코멘트만 확인 부탁드려요!
|
|
||
| struct CommonQuestAnswerRepliesResponseDTO: Decodable { | ||
| let totalCount: Int | ||
| let comment: CommonQuestAnswerCommentResponseDTO |
There was a problem hiding this comment.
comment도 여러 개 들어올 수 있지 않나요?
There was a problem hiding this comment.
하나의 댓글에 대한 답글 리스트 DTO여서 comment는 하나만 들어올 수 있습니다!!
| } | ||
| } | ||
|
|
||
| func keyboardWillHide(duration: Double) { |
There was a problem hiding this comment.
KeyboardHandleProtocol의 keyboardWillShow와 keyboardWillHide 메서드의 차이점이 키보드 높이뿐이어서 height 파라미터에 기본값을 0을 부여하면 두 메서드를 하나로 합쳐서 사용 가능할 것 같아요!
🔗 연결된 이슈
📄 작업 내용
💻 주요 코드 설명
댓글 입력 컴포넌트
CommentTextFieldViewUITextView 내의 TextContainer에 존재하는 기본 패딩값을 조정하기 위해 offset을 계산하여 넣어주었습니다.
텍스트뷰가 입력 중일 때, 레이아웃이 바뀌는 것들은 모두 UITextViewDelegate 내부에서 분기처리를 해주었습니다.
최대 1~5줄까지만 보이고, 6줄부터는 스크롤이 가능하게 하기 위해서 최대 높이를 지정하여 분기처리를 해주었습니다.
더보기 라벨
하 정말 힘들었습니다 어떻게 해결했는지 적어볼게요 ..
UITextView에 텍스트 라인수를 구하는 함수를 하나 만들어서, cell을 configure해줄 때 계산합니다
exclusive path는 text container 안에서 텍스트가 렌더링되지 않는 부분을 정할 수 있는 것이라고 합니당
베지어 패스타입으로 받더라구요 애니메에서보던건데여기서보니까신기햇슴
Diffable Datasource를 이용한 댓글 테이블뷰 구현
더보기 라벨을 구현하면서, 변경된 UI만 반영할 수 있는 디파블 데이터 소스를 써보고 싶어서 클로드랑 같이.. 도전해보았습니다..
댓글, 답글은 같은 entity를 사용해서 하나의 item으로 같이 사용합니다
historyVC근데 이렇게 사용하는게 맞는진 잘 모르겠어요 ..
댓글+답글 수정,삭제,신고,차단은 이슈 따로 파서 구현하겠습니다!