-
Notifications
You must be signed in to change notification settings - Fork 147
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-1] maxhyunm #305
Open
maxhyunm
wants to merge
20
commits into
yagom-academy:ic_9_maxhyunm
Choose a base branch
from
maxhyunm:step2
base: ic_9_maxhyunm
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
e2902c2
feat: CoreData 추가
maxhyunm c2f2b34
feat: ViewModel 타입 생성
maxhyunm 927d71b
feat: ViewController 수정 및 View, Cell 추가, 바인딩 추가
maxhyunm 71b6d89
chore: 파일 위치 변경
maxhyunm f2d8785
refactor: delegate 처리
maxhyunm 58588f7
refactor: CoreData 어트리뷰트 수정
maxhyunm 1d1e8a8
refactor: ToDoStatus rawValue 삭제
maxhyunm 65f1757
refactor: CoreDataManager struct로 수정, ViewModel Error 타입 변경
maxhyunm 6365a6c
refactor: AlertBuilder 수정, Cell prepareForReuse 메서드 수정
maxhyunm 10da8ea
refactor: error title 연산 프로퍼티로 수정
maxhyunm 85e9290
refactor: CoreDataManager에 Nested 구조체 Value 생성
maxhyunm 35afc35
refactor: ViewModel의 dataList 분리, handle error 메서드 생성
maxhyunm d7227d6
chore: 오타 수정
maxhyunm cd820ed
refactor: 의존성 주입 수정
maxhyunm 43a34de
feat: 자식 뷰컨트롤러 분할
maxhyunm 75f8243
feat: 배치 업데이트 추가
maxhyunm 829791e
chore: 파일 순서 정리
maxhyunm bfd087b
refactor: Input/Output으로 ViewModel 구분
maxhyunm 3e68a43
refactor: UseCase 분리, PopOverView 추가
maxhyunm 6876bb6
refactor: Alert Builder struct로 수정
maxhyunm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
ProjectManager/ProjectManager.xcodeproj/xcshareddata/xcschemes/ProjectManager.xcscheme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Scheme | ||
LastUpgradeVersion = "1430" | ||
version = "1.7"> | ||
<BuildAction | ||
parallelizeBuildables = "YES" | ||
buildImplicitDependencies = "YES"> | ||
<BuildActionEntries> | ||
<BuildActionEntry | ||
buildForTesting = "YES" | ||
buildForRunning = "YES" | ||
buildForProfiling = "YES" | ||
buildForArchiving = "YES" | ||
buildForAnalyzing = "YES"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "C7431F0125F51E1D0094C4CF" | ||
BuildableName = "ProjectManager.app" | ||
BlueprintName = "ProjectManager" | ||
ReferencedContainer = "container:ProjectManager.xcodeproj"> | ||
</BuildableReference> | ||
</BuildActionEntry> | ||
</BuildActionEntries> | ||
</BuildAction> | ||
<TestAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
shouldAutocreateTestPlan = "YES"> | ||
</TestAction> | ||
<LaunchAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
launchStyle = "0" | ||
useCustomWorkingDirectory = "NO" | ||
ignoresPersistentStateOnLaunch = "NO" | ||
debugDocumentVersioning = "YES" | ||
debugServiceExtension = "internal" | ||
allowLocationSimulation = "YES"> | ||
<BuildableProductRunnable | ||
runnableDebuggingMode = "0"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "C7431F0125F51E1D0094C4CF" | ||
BuildableName = "ProjectManager.app" | ||
BlueprintName = "ProjectManager" | ||
ReferencedContainer = "container:ProjectManager.xcodeproj"> | ||
</BuildableReference> | ||
</BuildableProductRunnable> | ||
</LaunchAction> | ||
<ProfileAction | ||
buildConfiguration = "Release" | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
savedToolIdentifier = "" | ||
useCustomWorkingDirectory = "NO" | ||
debugDocumentVersioning = "YES"> | ||
<BuildableProductRunnable | ||
runnableDebuggingMode = "0"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "C7431F0125F51E1D0094C4CF" | ||
BuildableName = "ProjectManager.app" | ||
BlueprintName = "ProjectManager" | ||
ReferencedContainer = "container:ProjectManager.xcodeproj"> | ||
</BuildableReference> | ||
</BuildableProductRunnable> | ||
</ProfileAction> | ||
<AnalyzeAction | ||
buildConfiguration = "Debug"> | ||
</AnalyzeAction> | ||
<ArchiveAction | ||
buildConfiguration = "Release" | ||
revealArchiveInOrganizer = "YES"> | ||
</ArchiveAction> | ||
</Scheme> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
// | ||
// AlertBuilder.swift | ||
// ProjectManager | ||
// | ||
// Created by Max on 2023/09/24. | ||
// | ||
|
||
import UIKit | ||
|
||
final class AlertBuilder { | ||
let alertController: UIAlertController | ||
private let viewController: UIViewController | ||
havilog marked this conversation as resolved.
Show resolved
Hide resolved
|
||
private var controllerTitle: String = "" | ||
private var controllerMessage: String = "" | ||
private var alertActions: [UIAlertAction] = [] | ||
|
||
init(viewController: UIViewController, prefferedStyle: UIAlertController.Style) { | ||
self.viewController = viewController | ||
self.alertController = UIAlertController(title: nil, message: nil, preferredStyle: prefferedStyle) | ||
} | ||
|
||
func setControllerTitle(title: String) { | ||
self.controllerTitle = title | ||
} | ||
|
||
func setControllerMessage(message: String) { | ||
self.controllerMessage = message | ||
} | ||
|
||
func addAction(_ actionType: AlertActionType, action: ((UIAlertAction) -> Void)? = nil) { | ||
let action = UIAlertAction(title: actionType.title, style: actionType.style, handler: action) | ||
alertActions.append(action) | ||
} | ||
|
||
@discardableResult | ||
func show() -> Self { | ||
alertController.title = controllerTitle | ||
alertController.message = controllerMessage | ||
alertActions.forEach { alertController.addAction($0) } | ||
|
||
viewController.present(alertController, animated: true) | ||
|
||
return self | ||
} | ||
} | ||
|
||
extension AlertBuilder { | ||
enum AlertActionType { | ||
case confirm | ||
case cancel | ||
case delete | ||
case other(title: String, style: UIAlertAction.Style) | ||
|
||
var title: String { | ||
switch self { | ||
case .confirm: | ||
return "확인" | ||
case .cancel: | ||
return "취소" | ||
case .delete: | ||
return "삭제" | ||
case .other(let title, _): | ||
return title | ||
} | ||
} | ||
|
||
var style: UIAlertAction.Style { | ||
switch self { | ||
case .cancel: | ||
return .cancel | ||
case .delete: | ||
return .destructive | ||
case .other(_, let style): | ||
return style | ||
default: | ||
return .default | ||
} | ||
} | ||
} | ||
} | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
coreDataManager의 경우 하나를 만들어 공유할 일이 많지만 ViewModel은 뷰/뷰컨트롤러에 따라 제각기 다른 뷰모델을 만들어야 할 수 있기 때문에 전부 SceneDelegate에서 따로 만들어서 주입하게 되면 너무 복잡할 것 같다고 생각하여 위처럼 작업하였습니다!
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.
요거는 만들어서 주입해주는게 좋을거 같아요
dependency injection과 testing도 같이 공부해보시면 좋을거 같아여
요건 민망하지만 제가 2년전쯤 쓴 블로그
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.
https://techblog.woowahan.com/2704/ 요것도 보세여 다른 글 들도 보시구