Open
Conversation
- 굳이 파일 분리가 필요없음. 파일 통합 - 파일 구조 변경 - DTO 추가 - addSubviews extension추가 - logIn 함수 JSONDecoder 사용
OneTen19
reviewed
Nov 9, 2024
Comment on lines
+93
to
+100
| do { | ||
| let logInResponse = try JSONDecoder().decode(LogInResponse.self, from: data) | ||
| let token = logInResponse.result.token | ||
| TokenManager.shared.saveToken(token) | ||
| completion(.success(logInResponse)) | ||
| } catch { | ||
| completion(.failure(.unknownError)) | ||
| } |
| } | ||
|
|
||
| let headers: HTTPHeaders = [ | ||
| "Content-Type": "application/json", |
Member
There was a problem hiding this comment.
저는 그냥 ["token": "(token)"] 이렇게만 작성했는데 별 문제 없이 괜찮았어요!
Comment on lines
+137
to
+138
| username: userNameTextField.text!, // optional처리 | ||
| password: userPasswordTextField.text! |
Member
There was a problem hiding this comment.
강제 언래핑보다는 guard let으로 옵셔널 바인딩 처리해주거나
아니면 그냥 userNameTextField.text ?? "" 이런 식으로 기본 값 세팅해주는 게 더 안전할 것 같아요!
hooni0918
approved these changes
Nov 9, 2024
|
|
||
| import UIKit | ||
|
|
||
| //$0, $1, $2 ... - param을 축약 |
Comment on lines
+44
to
+51
| /// public let result: Result<Success, Failure> | ||
| /// Alamofire의 data response에는 result 프로퍼티가 존재하는데, 해당 프로퍼티는 Result<Success, Failure> 타입임! | ||
| /// 이 말은, 타입이 다른 함수에서 리턴되어 넘어갈 때, success로 넘어갈 수 있고 failure로 넘어갈 수 있다는 것 | ||
| /// 그리고 그 안에는 우리가 원하는 결과값들이 존재한다. | ||
| /// Result<Bool, NetworkError> : 성공 시 Bool, 실패 시 NetworkError값을 return 하게 됨. | ||
| /// Success 하면 Bool 값을, Failure 하면 NetworkError를 리턴하겠다는 뜻 | ||
| /// Success에는 원하는 타입이 올 수 있고, Failure에는 Error 프로토콜이 채택된 것이 리턴될 수 있도록 되어야 함 | ||
| switch response.result { |
|
|
||
| import UIKit | ||
|
|
||
| class LogInViewController: UIViewController { //hee eun |
yurim830
approved these changes
Nov 10, 2024
|
|
||
| private func setLayout() { | ||
| // SnapKit을 통해 오토레이아웃 코드 변경하기. | ||
| NSLayoutConstraint.activate( |
There was a problem hiding this comment.
SnapKit import 하셨는데 �SnapKit으로 레이아웃을 설정하지 않으신 이유가 궁금합니다!
| } | ||
| } | ||
|
|
||
| extension ChartViewController: UITableViewDelegate{} |
There was a problem hiding this comment.
작성한 코드가 없다면 delegate는 삭제해도 좋을 것 같습니다:D
|
|
||
| import Foundation | ||
|
|
||
| class TokenManager { |
There was a problem hiding this comment.
오호 TokenManager로 토근을 관리하�셨군요!! 흥미롭습니다
| let token = logInResponse.result.token | ||
| TokenManager.shared.saveToken(token) | ||
| completion(.success(logInResponse)) | ||
| } catch { |
There was a problem hiding this comment.
잘 몰라서 그러는데, .success 케이스 안에서도 에러가 발생하는 경우가 있나요? 있다면 어떤 경우인지 궁금합니다!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
API 연동하기
이슈
작업 내용
Simulator
추가 구현 필요 부분