-
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
[TNT-142] Domain - UserUseCase 관련 로직 작성 #35
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.
고생하셨습니다!
struct KeyboardDismissModifier: ViewModifier { | ||
var dismissOnDrag: Bool = true | ||
|
||
func body(content: Content) -> some View { | ||
content | ||
.frame(maxWidth: .infinity, maxHeight: .infinity) | ||
.background(Color.clear) | ||
.onTapGesture { | ||
dismissKeyboard() | ||
} | ||
.simultaneousGesture( | ||
dismissOnDrag ? DragGesture().onChanged { _ in dismissKeyboard() } : nil | ||
) | ||
} | ||
|
||
/// Modifier 내부에서 직접 키보드 내리는 함수 | ||
private func dismissKeyboard() { | ||
guard let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene else { return } | ||
windowScene.windows.forEach { $0.endEditing(true) } | ||
} | ||
} | ||
|
||
/// `View`에 `.keyboardDismissOnTap()`을 추가할 수 있도록 Extension | ||
extension View { | ||
func keyboardDismissOnTap(dismissOnDrag: Bool = true) -> some View { | ||
self.modifier(KeyboardDismissModifier(dismissOnDrag: dismissOnDrag)) | ||
} | ||
} |
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.
오호 이거 UIKit에서 firstResponse 대신에 이런 방법이 있는건가요?
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.
넵 이 친구도 되는데 생각해보니 firstResponseResign도 있었네요
이 방법은 해당 화면의 모든 작성 상태를 끝내는 방식인데 추후 수정해야할 수도 있을 것 같습니다!
📌 What is the PR?
원활한 PR 리뷰를 위해 내용을 분리했습니다.
Domain단의 UserUseCase를 작성하고, 이에 필요한 코드들을 작성했습니다.
🪄 Changes
🌐 Common Changes
🔥 PR Point
초기화 비용이 큰 DateFormatter의 특성 + 서비스에서 날짜를 빈번하게 사용하는 특성을 고려하여,
DateFormatter를 특정 Format 별로 캐싱하고 이를 재사용할 수 있게 했습니다.
사용법은 다음과 같습니다.
String이 검증이 필요한 경우 - regex를 통한 경우와 dateFormat을 통한 경우를 고려하여 각 케이스를 포함한 validator를 작성했습니다.
사용법은 다음과 같습니다.
Domain <-> Presentation 레이어간 비즈니스 로직 인터페이스의 역할을 담당하며, Swift-Dependencies 등록을 통해 Reducer에 쉽게 주입이 가능합니다.
사용법은 다음과 같습니다.
🙆🏻 To Reviewers
💭 Related Issues