-
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] BMO #311
Draft
bubblecocoa
wants to merge
14
commits into
yagom-academy:ic_9_bmo94
Choose a base branch
from
bubblecocoa:Step2-1
base: ic_9_bmo94
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.
Draft
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
dce3811
rename: ViewController -> MainViewController로 이름 변경
bubblecocoa 5244625
feat: ManagerCell 생성
bubblecocoa 37f400f
feat: tableView3개, ManagerCell 적용
bubblecocoa 1d71613
refactor: navigationController 적용
bubblecocoa 5f5c5bd
refactor: 요구사항에 맞게 UI 변경
bubblecocoa 712f872
rename: ManagerCell 이름을 WorkCell로 변경
bubblecocoa b746187
feat: Observable 클래스 생성, todoList에 MVVM 적용
bubblecocoa 93144aa
refactor: 폴더 구조 변경
bubblecocoa 08db61b
refactor: WorkView 생성에 따른 코드 분리
bubblecocoa e9e1043
refactor: final, private 키워드 추가
bubblecocoa b3cd7ef
refactor: WorkType 열거형을 Work 구조체의 중첩타입으로 이동, Status로 이름 변경
bubblecocoa 47a592b
refactor: 불필요한 코드 제거
bubblecocoa bf25526
refactor: cell에 prepareForReuse 작성
bubblecocoa a47913a
refactor: Work 구조체에 Equatable, Sendable 채택
bubblecocoa 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
File renamed without changes.
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,20 @@ | ||
// | ||
// Work.swift | ||
// ProjectManager | ||
// | ||
// Created by BMO on 2023/10/01. | ||
// | ||
|
||
import Foundation | ||
|
||
struct Work: Equatable, Sendable { | ||
let title: String | ||
let description: String | ||
let deadline: Date | ||
|
||
enum Status: String { | ||
case todo = "TODO" | ||
case doing = "DOING" | ||
case done = "DONE" | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
72 changes: 72 additions & 0 deletions
72
ProjectManager/ProjectManager/View/MainViewController.swift
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,72 @@ | ||
// | ||
// ProjectManager - MainViewController.swift | ||
// Created by yagom. | ||
// Copyright © yagom. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
final class MainViewController: UIViewController { | ||
private let todoView: WorkView | ||
private let doingView: WorkView | ||
private let doneView: WorkView | ||
|
||
init() { | ||
self.todoView = WorkView(workStatus: .todo) | ||
self.doingView = WorkView(workStatus: .doing) | ||
self.doneView = WorkView(workStatus: .done) | ||
|
||
super.init(nibName: nil, bundle: nil) | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
|
||
private let mainStackView: UIStackView = { | ||
let stackView = UIStackView() | ||
stackView.translatesAutoresizingMaskIntoConstraints = false | ||
stackView.axis = .horizontal | ||
stackView.spacing = 10 | ||
stackView.distribution = .fillEqually | ||
|
||
return stackView | ||
}() | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
|
||
setNavigationItem() | ||
setUI() | ||
} | ||
|
||
private func setNavigationItem() { | ||
navigationItem.title = "Project Manager" | ||
|
||
let addAction = UIAction { _ in | ||
// TODO: + 버튼 터치 시 동작 작성 | ||
|
||
print("touch addAction") | ||
} | ||
|
||
navigationItem.rightBarButtonItem = UIBarButtonItem(systemItem: .add, primaryAction: addAction) | ||
} | ||
|
||
private func setUI() { | ||
view.backgroundColor = .systemBackground | ||
|
||
view.addSubview(mainStackView) | ||
mainStackView.addArrangedSubview(todoView) | ||
mainStackView.addArrangedSubview(doingView) | ||
mainStackView.addArrangedSubview(doneView) | ||
|
||
mainStackView.backgroundColor = .systemGray4 | ||
|
||
NSLayoutConstraint.activate([ | ||
mainStackView.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor), | ||
mainStackView.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor), | ||
mainStackView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor), | ||
mainStackView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor) | ||
]) | ||
} | ||
} |
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 @@ | ||
// | ||
// WorkCell.swift | ||
// ProjectManager | ||
// | ||
// Created by BMO on 2023/09/25. | ||
// | ||
|
||
import UIKit | ||
|
||
final class WorkCell: UITableViewCell { | ||
static let identifier: String = "WorkCell" | ||
|
||
private let stackView: UIStackView = { | ||
let stackView = UIStackView() | ||
stackView.translatesAutoresizingMaskIntoConstraints = false | ||
stackView.axis = .vertical | ||
stackView.spacing = 8 | ||
stackView.distribution = .equalSpacing | ||
|
||
return stackView | ||
}() | ||
|
||
private let titleLabel: UILabel = { | ||
let label = UILabel() | ||
|
||
return label | ||
}() | ||
|
||
private let descriptionLabel: UILabel = { | ||
let label = UILabel() | ||
label.numberOfLines = 3 | ||
label.textColor = .gray | ||
|
||
return label | ||
}() | ||
|
||
private let deadlineLabel: UILabel = { | ||
let label = UILabel() | ||
|
||
return label | ||
}() | ||
|
||
required init?(coder: NSCoder) { | ||
super.init(coder: coder) | ||
setUI() | ||
} | ||
|
||
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { | ||
super.init(style: style, reuseIdentifier: reuseIdentifier) | ||
setUI() | ||
} | ||
|
||
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. prepare for reuse를 처리하는 부분이 없네요 |
||
override func prepareForReuse() { | ||
titleLabel.text = "" | ||
deadlineLabel.text = "" | ||
deadlineLabel.text = "" | ||
} | ||
|
||
private func setUI() { | ||
separatorInset = UIEdgeInsets.zero | ||
|
||
addSubview(stackView) | ||
|
||
stackView.addArrangedSubview(titleLabel) | ||
stackView.addArrangedSubview(descriptionLabel) | ||
stackView.addArrangedSubview(deadlineLabel) | ||
|
||
NSLayoutConstraint.activate([ | ||
stackView.leadingAnchor.constraint(equalTo: layoutMarginsGuide.leadingAnchor), | ||
stackView.trailingAnchor.constraint(equalTo: layoutMarginsGuide.trailingAnchor), | ||
stackView.topAnchor.constraint(equalTo: layoutMarginsGuide.topAnchor), | ||
stackView.bottomAnchor.constraint(equalTo: layoutMarginsGuide.bottomAnchor) | ||
]) | ||
} | ||
|
||
func config(title: String, description: String, deadline: Date) { | ||
titleLabel.text = title | ||
descriptionLabel.text = description | ||
deadlineLabel.text = deadline.description | ||
} | ||
} |
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.
요런건 항상 프로토콜을 사용하는 습관이 좋을 듯 합니당