-
Notifications
You must be signed in to change notification settings - Fork 6
[Feat] #65 - 마이페이지 API 연결 #72
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
[Feat] #65 - 마이페이지 API 연결 #72
The head ref may contain hidden characters: "feat/#65-\uB9C8\uC774\uD398\uC774\uC9C0-API-\uC5F0\uACB0"
Conversation
서버통신 이후 UI에 받아 온 데이터 값이 반영될 수 있도록 수정
lsj8706
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수고하셨습니다~~!
리뷰 반영해서 푸시하고 머지해주세요~!!!
|
|
||
| import Foundation | ||
|
|
||
| // MARK: - MyPageDto |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
가능하다면 MARK 구문 밑에 한줄은 여백으로 남겨주세요!
| let level, levelPercent: Int | ||
|
|
||
| enum CodingKeys: String, CodingKey { | ||
| case machineID = "machineId" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
지금 이 구문이 있는 이유는 machineId라고 서버에서 보내준 것을 struct 프로퍼티에서는 machineID 라고 이름짓기 위해서 들어 있는 거에요! 퀵타입이 Id가 싫어서 ID로 맘대로 바꾼거죠! ㅋㅋㅋㅋ
그래서 뭐 이대로 둬도 상관은 없는데 우리는 그냥 서버에서 주는대로 Id 라고 적고 있어서 이 enum 자체를 없애고 17줄에 machineID를 machineId로 바꿔도 똑같이 동작할 거에요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
헉 ㅋ
| setMyRunningLevelLavel(label: myRunningLevelLavel, model: model) | ||
| } | ||
|
|
||
| private func setMyRunningProgressPercentLabel(label: UILabel, model: MyPageDto) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
함수로 잘 분리해서 만들었네요~~! 👍
| extension MyPageVC { | ||
| func getMyPageInfo() { | ||
| LoadingIndicator.showLoading() | ||
| myPageProvider.request(.getMyPageInfo) { [weak self] response in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
weak self 를 왜 사용하는지에 대해서도 깊게 공부해보면 좋아요!! Swift의 핵심 특징중 하나인 ARC에 관련된 내용이라 나중에 시간 나면 꼭꼭 공부해보면 좋을 거 같아요~!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵! 그냥 따라했어욥..ㅋ
| if responseDto.status == 200 { | ||
| guard let data = responseDto.data else { return } | ||
| self.setData(model: data) | ||
| } else { | ||
| self.showToast(message: responseDto.message) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
여기서 if responseDto.status == 200 를 제가 다른 코드에서 쓴 이유는 해당 API 에서는 200으로 오는 경우랑 201로 오는 경우를 구분해야 했어서 그런거였어요! 만약 이 API 에서는 200과 다른 200번대 status 의 별다른 차이가 없다면 지금 이 if~else 구문은 없애고 바로
guard let data = ~~
self.setData(~~)
이렇게 써도 됩니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
헉
🌱 작업한 내용
🌱 PR Point
📸 스크린샷
생략
📮 관련 이슈