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

[Refactor] #198 - 홈 UI 로직 변경 #204

Merged
merged 17 commits into from
Jan 7, 2024
Merged

[Refactor] #198 - 홈 UI 로직 변경 #204

merged 17 commits into from
Jan 7, 2024

Conversation

jeongdung-eo
Copy link
Member

@jeongdung-eo jeongdung-eo commented Nov 21, 2023

🫧 작업한 내용

  • 홈 뷰 데이터 로직 수정했습니다.
  • 데이터 소스와 레이아웃 VC와 분리
  • 미션 추가/ 삭제 시 데이터 밀림 현상 해결했습니다.

🔫 PR Point

  • 미션 리스트를 삭제하고 추가하는 과정에서 데이터가 밀리는 현상이 발생했습니다. 이는 데이터 update하는 부분에서 발생한 이슈라고 생각했습니다. 이슈를 해결하기 위해서 private var currentSection: [Sections] = [.empty] 변수를 선언하여 데이터가 업데이트 될 때마다 현재의 section을 지우고 새로운 section을 append하도록 수정했습니다.

📸 스크린샷

Simulator.Screen.Recording.-.iPhone.SE.3rd.generation.-.2023-11-24.at.01.10.19.mp4

📮 관련 이슈

case .success(let response):
do {
self.missionDailyData = try response.map(GeneralArrayResponse<DailyMissionResponseDTO>?.self)
guard let missionDailtData = self.missionDailyData else { return }
Copy link
Member

Choose a reason for hiding this comment

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

이 함수에서 completion이 escaping 클로저여서 이 함수가 끝났다는 것을 알려주는 역할을 하는데
요렇게 return 부분에 completion handler가 없으면 끝났다는걸 알릴 방법이 없어진다고 하네여!!
그래서 요 부분에도 밑에 .failure 에 completion(nil) 추가해준 것처럼 completion을 추가해주면 좋을 것 같습니다~

관련내용은 Meet async/await in Swift라는 WWDC 세션에 앞부분에 나와여! (결국 여기서 하는 말은 이거 다 개발자 책임이니까 이제 async, await를 쓰라고 하긴 함 ㅋㅋ ㅠㅠ)

밑에 제가 세션들으면서 필기한 내용 간단히 캡쳐한거 올려보겟슴다..

image image

Copy link
Member Author

Choose a reason for hiding this comment

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

오오 !! 감사합니다:)
return 부분에 completion은 생각을 못하고 있었던 부분인 것 같아요! ㅠㅠ

Copy link
Member Author

Choose a reason for hiding this comment

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

Comment on lines 151 to 156
HomeAPI.shared.getDailyMission(date: date) { response in
guard let response = response else { return }
guard let data = response.data else { return }
let missionList = data
self.updateData(item: missionList)
}
Copy link
Member

Choose a reason for hiding this comment

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

escaping closure라서 weak self를 써줘야 안전하게 메모리 해제될 것 같네여~

Copy link
Member Author

Choose a reason for hiding this comment

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

앗 ! 이 부분도 수정하겠습니당!

Copy link
Member Author

Choose a reason for hiding this comment

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

private let horizonStackView = UIStackView()
private let leftButton = UIButton()
private let rightButton = UIButton()
var calendar = WeekMonthFSCalendar()
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
Member Author

Choose a reason for hiding this comment

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

어멋 ..ㅎㅎ

Copy link
Member Author

Choose a reason for hiding this comment

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

snapshot.appendItems([.empty], toSection: .empty)
}

func updateSnapShot(missioList: [DailyMissionResponseDTO]) {
Copy link
Member

Choose a reason for hiding this comment

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

missio 오타같아용 ㅎ.ㅎ

Copy link
Member Author

Choose a reason for hiding this comment

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

@jeongdung-eo jeongdung-eo merged commit 3109e11 into develop Jan 7, 2024
1 check passed
@jeongdung-eo jeongdung-eo deleted the feat/#198 branch January 7, 2024 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Refactor] 홈 UI 로직 변경
2 participants