-
Notifications
You must be signed in to change notification settings - Fork 0
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
[#84] SettingView 내 ListView 분리 및 추가 리팩터링 #89
base: develop
Are you sure you want to change the base?
Conversation
현재 HomeReducer로 이관됨
- confirmLogoutTapped - configurePushAuthorizationTapped
버전이슈 해결 필요
.onChange(of: isPushAuthorizationEnabled) { | ||
action() | ||
} |
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.
.onChange(of: isPushAuthorizationEnabled) { | |
action() | |
} | |
.onChange(of: isPushAuthorizationEnabled.wrappedValue) { newValue in | |
action() | |
} |
이렇게 사용하면 에러가 안나요!
제가 추측하기로는 onChange(of:perform:) 메서드를 사용할 때, of: 매개변수로 전달하는 값이 Equatable 프로토콜을 준수해야 해서 값을 전달할 때 .wrappedValue
를 사용하고, 클로저의 매개변수를 newValue로 선언함으로써 Bool 타입임을 명확히 알 수 있어서 에러가 안나는거 같아요...!
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.
.wrappedValue
를 통해 Bool 타입을 명시적으로 받아왔다고 생각했는데 아닌가보군요..!
감사합니다! 저도 조금 더 알아볼께요.
// .onReceive(isPushAuthorizationEnabled.projectedValue) { newValue in | ||
// action() | ||
// } |
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.
주석이 필요한 부분이 아니면 삭제하는게 좋을 것 같아요! 위에 TODO도 마찬가지로요!
} | ||
} | ||
|
||
struct ItemModel: View { |
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.
한 가지 걸리는 건 ItemModel
이란 네이밍이 적절할까 고민이긴 한데,, ItemModel하면 뭔가 View가 아닌 느낌이 더 들어서, Row나 RowView와 같은 이름이 더 적절할 것 같아요!
private extension SettingView.SettingList { | ||
func currentAppVersion() -> String { | ||
if let info: [String: Any] = Bundle.main.infoDictionary, | ||
let currentVersion: String | ||
= info["CFBundleShortVersionString"] as? String { | ||
return currentVersion | ||
} | ||
return "-" | ||
} | ||
} | ||
|
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.
해당 부분이 비즈니스 로직이라고 생각하면, SettingReducer에서 처리해서 가져오는게 더 적절하지 않을까요?
여기에 앱 버전을 가져오는 로직이 적절할지 논의해보면 좋을 것 같습니다!
📌 Summary
✍️ Description
💡 PR Point
SettingView 내에 있던 List를 분리하는 과정에서 아래와 같은 이슈가 있습니다.
.toggle
의 경우Binding<Bool>
타입의 연관값을 받습니다.isOn.wrappedValue
로 전달하였습니다..onReceive
를 사용하는 방법으로 해결해야할까요?📚 Reference
🔥 Test