-
Notifications
You must be signed in to change notification settings - Fork 5
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] #61 - NetworkModel 옵셔널변수 설정 및 예외처리 #70
Conversation
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: - User | ||
|
||
struct User: Codable { | ||
let userID: String | ||
|
||
enum CodingKeys: String, CodingKey { | ||
case userID = "userId" | ||
} | ||
|
||
init(from decoder: Decoder) throws { | ||
let values = try decoder.container(keyedBy: CodingKeys.self) | ||
userID = (try? values.decode(String.self, forKey: .userID)) ?? "" | ||
} |
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.
그냥 이렇게 빼주셨군요 감사합니다 ㅜㅜㅜ
|
||
init(from decoder: Decoder) throws { | ||
let values = try decoder.container(keyedBy: CodingKeys.self) | ||
cardID = (try? values.decode(String.self, forKey: .cardID)) ?? "" | ||
background = (try? values.decode(String.self, forKey: .background)) ?? "" | ||
title = (try? values.decode(String.self, forKey: .title)) ?? "" | ||
name = (try? values.decode(String.self, forKey: .name)) ?? "" | ||
birthDate = (try? values.decode(String.self, forKey: .birthDate)) ?? "" | ||
age = (try? values.decode(String.self, forKey: .age)) ?? "" | ||
mbti = (try? values.decode(String.self, forKey: .mbti)) ?? "" | ||
instagram = (try? values.decode(String.self, forKey: .instagram)) | ||
linkName = (try? values.decode(String.self, forKey: .linkName)) | ||
link = (try? values.decode(String.self, forKey: .link)) | ||
cardDescription = (try? values.decode(String.self, forKey: .cardDescription)) | ||
} | ||
} |
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.
아하👍🏻
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 요약
🌱 작업한 브랜치
🌱 작업한 내용
📮 관련 이슈