-
Notifications
You must be signed in to change notification settings - Fork 1
Refactor/#336 2차스프린트 2차 QA 반영 #337
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
The head ref may contain hidden characters: "refactor/#336-2\uCC28-qa"
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| // | ||
| // isValidQuestAnswerUseCase.swift | ||
| // ByeBoo-iOS | ||
| // | ||
| // Created by 이나연 on 12/4/25. | ||
| // | ||
|
|
||
| import Foundation | ||
|
|
||
| protocol IsValidQuestAnswerUseCase { | ||
| func execute(previousText: String, changingText: String) -> Bool | ||
| } | ||
|
|
||
| struct DefaultIsValidQuestAnswerUseCase: IsValidQuestAnswerUseCase { | ||
| func execute(previousText: String, changingText: String) -> Bool { | ||
| if previousText.isEmpty { | ||
| if isValidAnswerText(text: changingText) { | ||
| return true | ||
| } else { | ||
| return false | ||
| } | ||
| } else { | ||
| if previousText != changingText && isValidAnswerText(text: changingText) { | ||
| return true | ||
| } else { | ||
| return false | ||
| } | ||
| } | ||
| } | ||
|
|
||
| private func isValidAnswerText(text: String) -> Bool { | ||
| if (text.count >= 10) && !text.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { | ||
| return true | ||
| } else { | ||
| return false | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,11 +6,10 @@ | |
| // | ||
|
|
||
| protocol QuestCompleteProtocol: AnyObject { | ||
|
Collaborator
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. 기존에 만들어두신 EditQuestProtocol에 메서드를 추가하는 대신 QuestCompleteProtocol을 따로 정의한 이유가 있는지 궁금합니다!
Collaborator
Author
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. 원래 기존에는 QuestCompleteProtocol이 있고 수정기능을 추가하면서 edit protocol을 만들었는데요! |
||
| func changeStyle(count: Int) | ||
| func changeStyleWhenEditing(changedText: String) | ||
| func changeCount(count: Int) | ||
| func updateButtonWhenWriting(text: String) | ||
| } | ||
|
|
||
| extension QuestCompleteProtocol { | ||
| func changeStyle(count: Int) { return } | ||
| func changeStyleWhenEditing(changedText: String) { return } | ||
| func changeCount(count: Int) { 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.
저는 if-else문을 최대한 안 쓰는 편이라 아래처럼 해도 괜찮을 것 같아요. 참고만 해주세용!