Skip to content
This repository has been archived by the owner on Jan 6, 2024. It is now read-only.

Asset에 아이콘 추가, CategoryCoordinator 생성 #51

Merged
merged 9 commits into from
Jun 14, 2022
66 changes: 47 additions & 19 deletions Weekand/Weekand.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
7D76AEB628445AA5001C668D /* MainTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D76AEB528445AA5001C668D /* MainTableViewCell.swift */; };
7D76AEB828448C79001C668D /* Font.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D76AEB728448C79001C668D /* Font.swift */; };
7D80021B283DEAE7007874C6 /* WelcomeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D80021A283DEAE7007874C6 /* WelcomeViewController.swift */; };
7DA4AB7128586615009E91FB /* CategoryListViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DA4AB7028586615009E91FB /* CategoryListViewModel.swift */; };
7DA4AB7328586641009E91FB /* CategoryCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DA4AB7228586641009E91FB /* CategoryCoordinator.swift */; };
7DA4AB7628586F97009E91FB /* CategoryDetailViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DA4AB7528586F97009E91FB /* CategoryDetailViewModel.swift */; };
7DA4AB7828586FA7009E91FB /* CategoryEditViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DA4AB7728586FA7009E91FB /* CategoryEditViewModel.swift */; };
7DA4AB7A285871E0009E91FB /* UIButton+setImageInset.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DA4AB79285871E0009E91FB /* UIButton+setImageInset.swift */; };
7DAA861F284B968000F21E35 /* ScehduleMain.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DAA861E284B968000F21E35 /* ScehduleMain.swift */; };
7DB5E13C284B4DA400DBB7EA /* MainCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DB5E13B284B4DA400DBB7EA /* MainCoordinator.swift */; };
7DB5E13E284B4E3C00DBB7EA /* MainViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DB5E13D284B4E3C00DBB7EA /* MainViewModel.swift */; };
Expand Down Expand Up @@ -94,6 +99,11 @@
7D76AEB528445AA5001C668D /* MainTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainTableViewCell.swift; sourceTree = "<group>"; };
7D76AEB728448C79001C668D /* Font.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Font.swift; sourceTree = "<group>"; };
7D80021A283DEAE7007874C6 /* WelcomeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomeViewController.swift; sourceTree = "<group>"; };
7DA4AB7028586615009E91FB /* CategoryListViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CategoryListViewModel.swift; sourceTree = "<group>"; };
7DA4AB7228586641009E91FB /* CategoryCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CategoryCoordinator.swift; sourceTree = "<group>"; };
7DA4AB7528586F97009E91FB /* CategoryDetailViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CategoryDetailViewModel.swift; sourceTree = "<group>"; };
7DA4AB7728586FA7009E91FB /* CategoryEditViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CategoryEditViewModel.swift; sourceTree = "<group>"; };
7DA4AB79285871E0009E91FB /* UIButton+setImageInset.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIButton+setImageInset.swift"; sourceTree = "<group>"; };
7DAA861E284B968000F21E35 /* ScehduleMain.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScehduleMain.swift; sourceTree = "<group>"; };
7DB5E13B284B4DA400DBB7EA /* MainCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainCoordinator.swift; sourceTree = "<group>"; };
7DB5E13D284B4E3C00DBB7EA /* MainViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainViewModel.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -248,10 +258,8 @@
7D76AEB2284458AC001C668D /* View */ = {
isa = PBXGroup;
children = (
7D76AEB528445AA5001C668D /* MainTableViewCell.swift */,
7DA4AB742858669E009E91FB /* SubViews */,
7D76AEB3284458C2001C668D /* MainViewController.swift */,
7DF96889284DF2EB00CE077E /* MainTableViewHeader.swift */,
7DF9688B284E019A00CE077E /* MainCalendarView.swift */,
);
path = View;
sourceTree = "<group>";
Expand Down Expand Up @@ -282,6 +290,34 @@
path = View;
sourceTree = "<group>";
};
7DA4AB6E28586602009E91FB /* ViewModel */ = {
isa = PBXGroup;
children = (
7DA4AB7028586615009E91FB /* CategoryListViewModel.swift */,
7DA4AB7528586F97009E91FB /* CategoryDetailViewModel.swift */,
7DA4AB7728586FA7009E91FB /* CategoryEditViewModel.swift */,
);
path = ViewModel;
sourceTree = "<group>";
};
7DA4AB6F28586608009E91FB /* Coordinator */ = {
isa = PBXGroup;
children = (
7DA4AB7228586641009E91FB /* CategoryCoordinator.swift */,
);
path = Coordinator;
sourceTree = "<group>";
};
7DA4AB742858669E009E91FB /* SubViews */ = {
isa = PBXGroup;
children = (
7D76AEB528445AA5001C668D /* MainTableViewCell.swift */,
7DF96889284DF2EB00CE077E /* MainTableViewHeader.swift */,
7DF9688B284E019A00CE077E /* MainCalendarView.swift */,
);
path = SubViews;
sourceTree = "<group>";
};
7DAA861C284B962B00F21E35 /* Domain */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -407,6 +443,7 @@
7DC166B72837157500F1A8F1 /* Utils */ = {
isa = PBXGroup;
children = (
7DA4AB79285871E0009E91FB /* UIButton+setImageInset.swift */,
7DF8B7AB2836250400B224CA /* UIColor+hex.swift */,
F33C6EAD28535021005B493A /* UIVIewController+extension.swift */,
F354C3E9283E6946008929FD /* NSMutableAttributedString+extension.swift */,
Expand Down Expand Up @@ -539,20 +576,13 @@
F392A1C2284F508600512A42 /* Category */ = {
isa = PBXGroup;
children = (
F392A1C5284F50A100512A42 /* ViewModel */,
7DA4AB6F28586608009E91FB /* Coordinator */,
7DA4AB6E28586602009E91FB /* ViewModel */,
F392A1C4284F509C00512A42 /* View */,
F392A1C3284F509300512A42 /* Coordinator */,
);
path = Category;
sourceTree = "<group>";
};
F392A1C3284F509300512A42 /* Coordinator */ = {
isa = PBXGroup;
children = (
);
path = Coordinator;
sourceTree = "<group>";
};
F392A1C4284F509C00512A42 /* View */ = {
isa = PBXGroup;
children = (
Expand All @@ -564,13 +594,6 @@
path = View;
sourceTree = "<group>";
};
F392A1C5284F50A100512A42 /* ViewModel */ = {
isa = PBXGroup;
children = (
);
path = ViewModel;
sourceTree = "<group>";
};
F3DD0216284660D200AD9240 /* Coordinator */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -759,7 +782,9 @@
7DC166A92837140000F1A8F1 /* SignUpViewController.swift in Sources */,
F32F72642854EC890056B189 /* InformationCollectionViewCell.swift in Sources */,
7DC166B12837145200F1A8F1 /* SignUpViewModel.swift in Sources */,
7DA4AB7628586F97009E91FB /* CategoryDetailViewModel.swift in Sources */,
F354C3DF283CECF5008929FD /* WTextLabel.swift in Sources */,
7DA4AB7A285871E0009E91FB /* UIButton+setImageInset.swift in Sources */,
7DC166BC28371B0C00F1A8F1 /* ColorSet.swift in Sources */,
F391B42D2837D4D1004E7B06 /* Preview.swift in Sources */,
7DB5E13C284B4DA400DBB7EA /* MainCoordinator.swift in Sources */,
Expand All @@ -778,6 +803,7 @@
7DAA861F284B968000F21E35 /* ScehduleMain.swift in Sources */,
7DC166BE28371C4E00F1A8F1 /* WDefaultButton.swift in Sources */,
F3DD022E2846815300AD9240 /* ViewModelType.swift in Sources */,
7DA4AB7128586615009E91FB /* CategoryListViewModel.swift in Sources */,
F32F72522853B0930056B189 /* CategoryDetailTableViewCell.swift in Sources */,
F354C3E3283D3615008929FD /* SignUpAddInfomationViewController.swift in Sources */,
7DF9688C284E019A00CE077E /* MainCalendarView.swift in Sources */,
Expand All @@ -789,9 +815,11 @@
7DF9688A284DF2EB00CE077E /* MainTableViewHeader.swift in Sources */,
7DEA177A2845E7C500F6B990 /* WEmojiView.swift in Sources */,
F378684F285619F000BEEC81 /* Category.swift in Sources */,
7DA4AB7828586FA7009E91FB /* CategoryEditViewModel.swift in Sources */,
7DC166B42837148000F1A8F1 /* SignInViewModel.swift in Sources */,
7D3B1F54283630A50037504A /* WTextField.swift in Sources */,
F3DD0218284661F900AD9240 /* WelcomeCoordinator.swift in Sources */,
7DA4AB7328586641009E91FB /* CategoryCoordinator.swift in Sources */,
F392A1EF28531FC600512A42 /* CategoryListHeaderView.swift in Sources */,
7DF949C8283B6F1F007F84C5 /* CommonShape.swift in Sources */,
7DEA177C2846006A00F6B990 /* WSquareImageView.swift in Sources */,
Expand Down
2 changes: 1 addition & 1 deletion Weekand/Weekand/Application/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
window?.rootViewController = navigationController
window?.makeKeyAndVisible()

self.coordinator = AppCoordinator(navigationController: navigationController)
self.coordinator = CategoryCoordinator(navigationController: navigationController)
self.coordinator?.start()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ enum CoordinatorType {
case signIn
case signUp
case main
case category
}
4 changes: 2 additions & 2 deletions Weekand/Weekand/Presentation/Common/View/WCheckBox.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import UIKit

class WCheckBox: UIButton {

let checkedImage = UIImage(named: "CheckBox")!.withTintColor(.gray300)
let uncheckedImage = UIImage(named: "CheckBox")!.withTintColor(.mainColor)
let checkedImage = UIImage(named: "checkmark.fill")!.withTintColor(.gray300)
let uncheckedImage = UIImage(named: "checkmark.fill")!.withTintColor(.mainColor)

var isChecked: Bool = false {
didSet {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class WFilterButton: UIButton {
mutableAttributedString.append(attributedTitle)

let imageAttachment = NSTextAttachment()
imageAttachment.image = UIImage(named: "DownArrow")
imageAttachment.image = UIImage(named: "arrow.down")
imageAttachment.bounds = CGRect(x: 1, y: -6, width: 20, height: 20)
let attachmentString = NSAttributedString(attachment: imageAttachment)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
//
// CategoryListCoordinator.swift
// Weekand
//
// Created by Daegeon Choi on 2022/06/14.
//

import UIKit

class CategoryCoordinator: Coordinator {

weak var finishDelegate: CoordinatorDidFinishDelegate?
var navigationController: UINavigationController
var childCoordinators: [Coordinator] = []
var type: CoordinatorType = .category
var categoryListViewController: CategoryListViewController

required init(navigationController: UINavigationController) {
self.navigationController = navigationController
self.navigationController.setNavigationBarHidden(true, animated: false)
self.categoryListViewController = CategoryListViewController()
}

func start() {
self.categoryListViewController.viewModel = CategoryListViewModel(coordinator: self)
self.navigationController.pushViewController(categoryListViewController, animated: true)
self.pushCategoryDetailViewController()
}

func pushCategoryDetailViewController() {
let categoryDetailViewController = CategoryDetailViewController()
categoryDetailViewController.viewModel = CategoryDetailViewModel(coordinator: self)
self.navigationController.pushViewController(categoryDetailViewController, animated: true)
}

func pushCategoryEditViewController() {
let categoryEditViewController = CategoryEditViewController()
categoryEditViewController.viewModel = CategoryEditViewModel(coordinator: self)
self.navigationController.pushViewController(categoryEditViewController, animated: true) }

func finish() {
self.finishDelegate?.childDidFinish(self)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class CategoryDetailViewController: UIViewController {
ScehduleMain(scheduleId: 0, color: "red", name: "일정 제목7", dateStart: Date(), dataEnd: Date(), stickerCount: 13, stickerNameList: [])
]

var viewModel: CategoryDetailViewModel?
var dataSource: UITableViewDiffableDataSource<Section, ScehduleMain>!

let tableView = UITableView()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import UIKit
import Then

class CategoryEditViewController: BaseViewController {

var viewModel: CategoryEditViewModel?

let categoryTextFieldStackView = WTextFieldStackView(fieldPlaceholder: "카테고리명", nameText: "카테고리")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class CategoryListViewController: UIViewController {
Category(color: "red", name: "to do", openType: .allOpen)
]

var viewModel: CategoryListViewModel?
var dataSource: UITableViewDiffableDataSource<Section, Category>!

let tableView = UITableView()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class CategoryDetailFooterView: UITableViewHeaderFooterView {
lazy var updateCategoryButton = UIButton().then {
$0.backgroundColor = .subColor
$0.layer.cornerRadius = 8
let buttonImage = UIImage(named: "updateCategory")
let buttonImage = UIImage(named: "category.update")?.withTintColor(.mainColor)
$0.setImage(buttonImage, for: .normal)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ class CategoryListHeaderView: UITableViewHeaderFooterView {
lazy var addCategoryButton = UIButton().then {
$0.backgroundColor = .subColor
$0.layer.cornerRadius = 8
let buttonImage = UIImage(named: "addCategory")
let buttonImage = UIImage(named: "folder.plus")?.withTintColor(.mainColor)
$0.setImage(buttonImage, for: .normal)
$0.imageView?.contentMode = .scaleAspectFit
}

lazy var filterButton = WFilterButton().then {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// CategoryDetailViewModel.swift
// Weekand
//
// Created by Daegeon Choi on 2022/06/14.
//

import Foundation

class CategoryDetailViewModel {

weak var coordinator: CategoryCoordinator?

init(coordinator: CategoryCoordinator) {

self.coordinator = coordinator
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// CategoryEditViewModel.swift
// Weekand
//
// Created by Daegeon Choi on 2022/06/14.
//

import Foundation

class CategoryEditViewModel {

weak var coordinator: CategoryCoordinator?

init(coordinator: CategoryCoordinator) {

self.coordinator = coordinator
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// CategoryListViewModel.swift
// Weekand
//
// Created by Daegeon Choi on 2022/06/14.
//

import Foundation

class CategoryListViewModel {

weak var coordinator: CategoryCoordinator?

init(coordinator: CategoryCoordinator) {

self.coordinator = coordinator
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class WCategoryTitleLabel: WIconLabel {
}

private func setupView() {
self.icon.layer.cornerRadius = 5
self.icon.layer.cornerRadius = 3
self.label.font = WFont.body1()
self.label.textColor = .gray900

Expand Down Expand Up @@ -51,17 +51,3 @@ extension WCategoryTitleLabel {
self.label.text = title
}
}



#if canImport(SwiftUI) && DEBUG
import SwiftUI

struct WCategoryTitleLabelPreview: PreviewProvider {
static var previews: some View {
UIViewPreview {
return WCategoryTitleLabel(color: .blue, title: "blahblahblah")
}.previewLayout(.sizeThatFits)
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,19 @@ class WIconLabel: UIView {

lazy var icon = UIImageView().then {
$0.setContentHuggingPriority(.required, for: .vertical)
$0.contentMode = .scaleAspectFit
}
lazy var label = UILabel().then {
$0.textAlignment = .left
$0.setContentHuggingPriority(.required, for: .vertical)
}
lazy var stack = UIStackView().then {

$0.addArrangedSubview(icon)
$0.addArrangedSubview(label)

icon.snp.makeConstraints { make in
make.height.lessThanOrEqualToSuperview()
make.height.lessThanOrEqualTo(label.snp.height)
make.width.equalTo(icon.snp.height)
}

Expand Down Expand Up @@ -53,18 +55,3 @@ class WIconLabel: UIView {
}

}

#if canImport(SwiftUI) && DEBUG
import SwiftUI

struct WIconLabelPreview: PreviewProvider {
static var previews: some View {
UIViewPreview {
let label = WIconLabel()
label.label.text = "This is Sample"
label.icon.image = UIImage(systemName: "checkmark")
return label
}.previewLayout(.sizeThatFits)
}
}
#endif
Loading