Skip to content

변예린) lv7. 구현 완료 및 객체화 완료#6

Open
devBambu wants to merge 23 commits into
yerin_mainfrom
yerin_dev
Open

변예린) lv7. 구현 완료 및 객체화 완료#6
devBambu wants to merge 23 commits into
yerin_mainfrom
yerin_dev

Conversation

@devBambu

Copy link
Copy Markdown
Collaborator

Lv.3까지 구현 완료하였습니다.

추후 파일 분리 및 중복 기능 함수는 리팩토링 예정입니다... 지금은 어떻게 압축할지 아직 정리가 안되네요..

피드백해주시면 감사하겠습니다!

@devBambu devBambu changed the title 변예린) lv3. 구현 완료 변예린) lv4. 구현 완료 Jan 29, 2026
func setUI() {
view.backgroundColor = .white

let book = getBook(num: 1)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

현재 getBook을 통해 받아온 데이터를 직접 사용하고 계시는데, 매번 데이터를 새로 호출하는 방법 대신 [Book] 타입 멤버 변수를 클래스 내부에 선언하여 데이터를 저장해두고 재사용하는 방식으로 구조를 변경하는 것이 좋을 것 같습니다.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

여러 시행착오를 거쳐.. (기존 코드로는 시리즈 버튼 생성에 어려움이 있었습니다.)
ViewController 내부에 [book] 배열을 두도록 수정하였습니다.. 피드백 감사합니다!

@Jaesung-Jung

Copy link
Copy Markdown

파이팅입니다. 💪

리팩토링 진행중...
더보기 버튼 더보기-접기 기능 구현 완료
- SeriesButtonAction 중복 동작 수정 필요 (버튼 1번 클릭 시 액션이 2번 실행되고 있음)
- setInfoScroll 수정 예정
- 파일 분리 예정
- 파일 분리
- 시리즈 버튼 액션 중복 설정 동작 제거
- 커스텀 시리즈 버튼 클래스 제거
- infoScroll contentsLayoutGuide 활용
return LabelSetting(font: .boldSystemFont(ofSize: 18), textColor: .black)
}
}
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

String 설정값을 이렇게 나누셨군요! 효율적인거 같아요 참고하겠습니당!!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

이렇게 하니 매 레이블마다 일일이 설정하지 않아도 되어 좋더라구요! 감사합니다 ☺️

Comment on lines +20 to +29
var bookImageView = UIImageView()
var infoBookTitleLabel = UILabel()
var authorLabel = UILabel()
var releasedDateLabel = UILabel()
var pagesLabel = UILabel()

var dedicationLabel = UILabel()
var summaryLabel = UILabel()

var moreButton = MoreButton()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

var -> let

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

앗 모두 수정하였습니다! 감사합니다!

Comment on lines +183 to +195
let more = UIAction { [weak self] _ in
self?.moreButton.isSelected.toggle()
guard let isSelected = self?.moreButton.isSelected else {
return
}

// isSelected 상태 저장
self?.moreButton.delegate?.saveStatus(isSelected)
self?.isMore = isSelected

// 요약 텍스트 재설정
self?.summaryLabel.text = self?.getSummaryText()
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[weak self]로 쓰니깐 self가 Optional 타입이라 처리하기 까다로운 부분이 생기죠?

guard let self else {
  return
}

으로 먼저 self 참조를 unwrap 하면 guard 아래로는 self 를 쓰지 않아도 됩니다.
아니면 UIAction은 self가 해제 된 이후에도 살아있을 수 없는 객체이기에 [unowned self] 를 써도 됩니다.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

조언 감사합니다! 안 그래도 계속 이렇게 바인딩해줘야하나 고민했던 부분이었는데 self를 언래핑하는 것은 떠올리지 못햇었습니다..
두 방식 모두 써볼까 싶어서 시리즈 버튼에는 [unowned self]를, 더보기 버튼에는 [weak self]를 언래핑하여 사용해보았습니다!

@devBambu devBambu changed the title 변예린) lv4. 구현 완료 변예린) lv7. 구현 완료 및 객체화 완료 Jan 31, 2026
coduhee

This comment was marked as resolved.

@coduhee coduhee left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

해당 방식으로 버튼의 상태에 따른 UI변화를 처리할 수 있다는 점을 알고갑니다.!! 직접 케이스를 나누는 복잡한 방식보다 훨씬 깔끔하고 좋은것같아요 참고하겠습니다 😊

(리뷰를 이렇게 남기는게 맞는지 모르겠습니다..)

- 챕터 레이블 numberOfLines
- infoScroll bottom equalTo(view.safeAreaLayoutGuide)
- delegate 함수 이름 바꾸기
- JSON 파싱 코딩키 수정
  - set 함수들 init에서 호출
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants