-
Notifications
You must be signed in to change notification settings - Fork 166
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
쥬스메이커 [STEP 2] 제이티, Ari #119
Changes from 1 commit
68927c4
c8f2ac6
e083fff
293f811
a560ab2
57031d7
eb48bef
0331594
8edd150
b28fab2
5d1c1da
f7bb20f
8bfece8
5f09d5c
d252b60
0484cd1
494468c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// | ||
// Text.swift | ||
// JuiceMaker | ||
// | ||
// Created by 김진태 on 2021/10/28. | ||
// | ||
|
||
import Foundation | ||
|
||
enum Message: CustomStringConvertible { | ||
case juiceFinish(juice: Juice) | ||
case unknownError | ||
case outOfStock | ||
|
||
var description: String { | ||
switch self { | ||
case .juiceFinish(let juice): | ||
return "\(juice.name) 쥬스 나왔습니다! 맛있게 드세요!" | ||
case .unknownError: | ||
return "알 수 없는 에러가 발생했습니다." | ||
case .outOfStock: | ||
return "재료가 모자라요. 재고를 수정할까요?" | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,27 +5,28 @@ | |
// Created by 김진태 on 2021/10/28. | ||
// | ||
|
||
import Foundation | ||
import UIKit.UIButton | ||
|
||
enum Message: CustomStringConvertible { | ||
case juiceFinish(juice: Juice) | ||
case unknownError | ||
case outOfStock | ||
enum Text { | ||
case cancel | ||
case ok | ||
|
||
var description: String { | ||
var title: String { | ||
return localizedTitle(key: self.key) | ||
} | ||
|
||
private var key: String { | ||
switch self { | ||
case .juiceFinish(let juice): | ||
return "\(juice.name) 쥬스 나왔습니다! 맛있게 드세요!" | ||
case .unknownError: | ||
return "알 수 없는 에러가 발생했습니다." | ||
case .outOfStock: | ||
return "재료가 모자라요. 재고를 수정할까요?" | ||
case .cancel: | ||
return "Cancel" | ||
case .ok: | ||
return "OK" | ||
} | ||
} | ||
|
||
private func localizedTitle(key: String) -> String { | ||
let bundle = Bundle.init(for: UIButton.self) | ||
let title = bundle.localizedString(forKey: key, value: nil, table: nil) | ||
return title | ||
} | ||
Comment on lines
+27
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Apple에서 제공하는 다국어 지원 String을 사용하고자 해당 메소드를 구현했습니다!
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NotificationCenter를 사용하지 않고 해당 기능을 구현한 것으로 인해 앱을 실행한 뒤, 기기의 언어를 변경하고 앱에 다시 돌아가면 언어가 제대로 변경되지 않는 현상이 발생할 수 있는지도 궁금합니다! |
||
} |
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.
해당 부분도 피드백 반영하여 개선해보았습니다 😄
오늘 시간내서 코드리뷰 해주셔서 정말 감사합니다! 많은 도움이 되었어요!!!!! 😊🙏🏻