From d06f237e15c5279f369f19be1a611a29bfa5e851 Mon Sep 17 00:00:00 2001 From: JusBug Date: Sat, 23 Sep 2023 14:12:24 +0900 Subject: [PATCH 01/39] =?UTF-8?q?feat:=20=EC=8A=A4=ED=86=A0=EB=A6=AC?= =?UTF-8?q?=EB=B3=B4=EB=93=9C=20=EA=B0=80=EB=A1=9C=20=EC=A0=84=ED=99=98,?= =?UTF-8?q?=20CollectionView=20UI=20=EC=83=9D=EC=84=B1=20=EB=B0=8F=20?= =?UTF-8?q?=EC=97=B0=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProjectManager/AppDelegate.swift | 2 +- .../ProjectManager/Base.lproj/Main.storyboard | 90 +++++++++++++++++-- .../ProjectManager/SceneDelegate.swift | 2 +- .../ProjectManager/ViewController.swift | 6 +- 4 files changed, 92 insertions(+), 8 deletions(-) diff --git a/ProjectManager/ProjectManager/AppDelegate.swift b/ProjectManager/ProjectManager/AppDelegate.swift index 8df091a06..8d5a2ea75 100644 --- a/ProjectManager/ProjectManager/AppDelegate.swift +++ b/ProjectManager/ProjectManager/AppDelegate.swift @@ -1,6 +1,6 @@ // // ProjectManager - AppDelegate.swift -// Created by yagom. +// Created by Jusbug. // Copyright © yagom. All rights reserved. // diff --git a/ProjectManager/ProjectManager/Base.lproj/Main.storyboard b/ProjectManager/ProjectManager/Base.lproj/Main.storyboard index 25a763858..9fb19115f 100644 --- a/ProjectManager/ProjectManager/Base.lproj/Main.storyboard +++ b/ProjectManager/ProjectManager/Base.lproj/Main.storyboard @@ -1,24 +1,104 @@ - + + - + + + + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ProjectManager/ProjectManager/SceneDelegate.swift b/ProjectManager/ProjectManager/SceneDelegate.swift index 94f16adcd..38f950950 100644 --- a/ProjectManager/ProjectManager/SceneDelegate.swift +++ b/ProjectManager/ProjectManager/SceneDelegate.swift @@ -1,6 +1,6 @@ // // ProjectManager - SceneDelegate.swift -// Created by yagom. +// Created by Jusbug. // Copyright © yagom. All rights reserved. // diff --git a/ProjectManager/ProjectManager/ViewController.swift b/ProjectManager/ProjectManager/ViewController.swift index 3f450cec2..63c8a8164 100644 --- a/ProjectManager/ProjectManager/ViewController.swift +++ b/ProjectManager/ProjectManager/ViewController.swift @@ -1,6 +1,6 @@ // // ProjectManager - ViewController.swift -// Created by yagom. +// Created by Jusbug. // Copyright © yagom. All rights reserved. // @@ -8,6 +8,10 @@ import UIKit class ViewController: UIViewController { + @IBOutlet weak var todoCollectionView: UICollectionView! + @IBOutlet weak var doingCollectionView: UICollectionView! + @IBOutlet weak var doneCollectionView: UICollectionView! + override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. From c292142612acca4f47617475bd714e64af5f7c99 Mon Sep 17 00:00:00 2001 From: JusBug Date: Sat, 23 Sep 2023 14:19:28 +0900 Subject: [PATCH 02/39] =?UTF-8?q?feat:=20CollectionView=20=EC=BB=A4?= =?UTF-8?q?=EC=8A=A4=ED=85=80=EC=85=80=20=EC=83=9D=EC=84=B1=20=EB=B0=8F=20?= =?UTF-8?q?=EC=97=B0=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProjectManager.xcodeproj/project.pbxproj | 8 +++ .../ProjectManager/CollectionViewCell.swift | 21 +++++++ .../ProjectManager/CollectionViewCell.xib | 55 +++++++++++++++++++ 3 files changed, 84 insertions(+) create mode 100644 ProjectManager/ProjectManager/CollectionViewCell.swift create mode 100644 ProjectManager/ProjectManager/CollectionViewCell.xib diff --git a/ProjectManager/ProjectManager.xcodeproj/project.pbxproj b/ProjectManager/ProjectManager.xcodeproj/project.pbxproj index 5d3ff1c56..5da73b1e3 100644 --- a/ProjectManager/ProjectManager.xcodeproj/project.pbxproj +++ b/ProjectManager/ProjectManager.xcodeproj/project.pbxproj @@ -13,6 +13,8 @@ C7431F0D25F51E1D0094C4CF /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C7431F0B25F51E1D0094C4CF /* Main.storyboard */; }; C7431F0F25F51E1E0094C4CF /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C7431F0E25F51E1E0094C4CF /* Assets.xcassets */; }; C7431F1225F51E1E0094C4CF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C7431F1025F51E1E0094C4CF /* LaunchScreen.storyboard */; }; + D0CED7782ABEAB570081ABE2 /* CollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0CED7762ABEAB570081ABE2 /* CollectionViewCell.swift */; }; + D0CED7792ABEAB570081ABE2 /* CollectionViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = D0CED7772ABEAB570081ABE2 /* CollectionViewCell.xib */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -24,6 +26,8 @@ C7431F0E25F51E1E0094C4CF /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; C7431F1125F51E1E0094C4CF /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; C7431F1325F51E1E0094C4CF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + D0CED7762ABEAB570081ABE2 /* CollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CollectionViewCell.swift; sourceTree = ""; }; + D0CED7772ABEAB570081ABE2 /* CollectionViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = CollectionViewCell.xib; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -63,6 +67,8 @@ C7431F0E25F51E1E0094C4CF /* Assets.xcassets */, C7431F1025F51E1E0094C4CF /* LaunchScreen.storyboard */, C7431F1325F51E1E0094C4CF /* Info.plist */, + D0CED7762ABEAB570081ABE2 /* CollectionViewCell.swift */, + D0CED7772ABEAB570081ABE2 /* CollectionViewCell.xib */, ); path = ProjectManager; sourceTree = ""; @@ -126,6 +132,7 @@ files = ( C7431F1225F51E1E0094C4CF /* LaunchScreen.storyboard in Resources */, C7431F0F25F51E1E0094C4CF /* Assets.xcassets in Resources */, + D0CED7792ABEAB570081ABE2 /* CollectionViewCell.xib in Resources */, C7431F0D25F51E1D0094C4CF /* Main.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -139,6 +146,7 @@ files = ( C7431F0A25F51E1D0094C4CF /* ViewController.swift in Sources */, C7431F0625F51E1D0094C4CF /* AppDelegate.swift in Sources */, + D0CED7782ABEAB570081ABE2 /* CollectionViewCell.swift in Sources */, C7431F0825F51E1D0094C4CF /* SceneDelegate.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/ProjectManager/ProjectManager/CollectionViewCell.swift b/ProjectManager/ProjectManager/CollectionViewCell.swift new file mode 100644 index 000000000..7b2904279 --- /dev/null +++ b/ProjectManager/ProjectManager/CollectionViewCell.swift @@ -0,0 +1,21 @@ +// +// CollectionViewCell.swift +// ProjectManager +// +// Created by 박종화 on 2023/09/23. +// + +import UIKit + +class CollectionViewCell: UICollectionViewCell { + + @IBOutlet weak var titleLabel: UILabel! + @IBOutlet weak var descriptionLabel: UILabel! + @IBOutlet weak var durationLabel: UILabel! + + override func awakeFromNib() { + super.awakeFromNib() + // Initialization code + } + +} diff --git a/ProjectManager/ProjectManager/CollectionViewCell.xib b/ProjectManager/ProjectManager/CollectionViewCell.xib new file mode 100644 index 000000000..a3902488b --- /dev/null +++ b/ProjectManager/ProjectManager/CollectionViewCell.xib @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From dbe8e6f33040c6e5c41c33031ae4a29faafefc73 Mon Sep 17 00:00:00 2001 From: JusBug Date: Sat, 23 Sep 2023 14:30:50 +0900 Subject: [PATCH 03/39] =?UTF-8?q?style:=20=ED=8C=8C=EC=9D=BC=20=EC=A0=95?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProjectManager.xcodeproj/project.pbxproj | 64 ++++++++++++++++--- .../{ => Application}/AppDelegate.swift | 0 .../{ => Application}/SceneDelegate.swift | 0 .../{ => Controllers}/ViewController.swift | 0 .../AccentColor.colorset/Contents.json | 0 .../AppIcon.appiconset/Contents.json | 0 .../Assets.xcassets/Contents.json | 0 .../ProjectManager/{ => Resources}/Info.plist | 0 .../{ => ViewModels}/CollectionViewCell.swift | 0 .../Base.lproj/LaunchScreen.storyboard | 0 .../{ => Views}/Base.lproj/Main.storyboard | 0 .../{ => Views}/CollectionViewCell.xib | 0 12 files changed, 56 insertions(+), 8 deletions(-) rename ProjectManager/ProjectManager/{ => Application}/AppDelegate.swift (100%) rename ProjectManager/ProjectManager/{ => Application}/SceneDelegate.swift (100%) rename ProjectManager/ProjectManager/{ => Controllers}/ViewController.swift (100%) rename ProjectManager/ProjectManager/{ => Resources}/Assets.xcassets/AccentColor.colorset/Contents.json (100%) rename ProjectManager/ProjectManager/{ => Resources}/Assets.xcassets/AppIcon.appiconset/Contents.json (100%) rename ProjectManager/ProjectManager/{ => Resources}/Assets.xcassets/Contents.json (100%) rename ProjectManager/ProjectManager/{ => Resources}/Info.plist (100%) rename ProjectManager/ProjectManager/{ => ViewModels}/CollectionViewCell.swift (100%) rename ProjectManager/ProjectManager/{ => Views}/Base.lproj/LaunchScreen.storyboard (100%) rename ProjectManager/ProjectManager/{ => Views}/Base.lproj/Main.storyboard (100%) rename ProjectManager/ProjectManager/{ => Views}/CollectionViewCell.xib (100%) diff --git a/ProjectManager/ProjectManager.xcodeproj/project.pbxproj b/ProjectManager/ProjectManager.xcodeproj/project.pbxproj index 5da73b1e3..2cb65133c 100644 --- a/ProjectManager/ProjectManager.xcodeproj/project.pbxproj +++ b/ProjectManager/ProjectManager.xcodeproj/project.pbxproj @@ -58,19 +58,67 @@ sourceTree = ""; }; C7431F0425F51E1D0094C4CF /* ProjectManager */ = { + isa = PBXGroup; + children = ( + D0CED77F2ABEAEAC0081ABE2 /* Resources */, + D0CED77E2ABEAE800081ABE2 /* Application */, + D0CED77D2ABEAE600081ABE2 /* Controllers */, + D0CED77C2ABEAE520081ABE2 /* ViewModels */, + D0CED77B2ABEAE400081ABE2 /* Views */, + D0CED77A2ABEAE3A0081ABE2 /* Models */, + ); + path = ProjectManager; + sourceTree = ""; + }; + D0CED77A2ABEAE3A0081ABE2 /* Models */ = { + isa = PBXGroup; + children = ( + ); + path = Models; + sourceTree = ""; + }; + D0CED77B2ABEAE400081ABE2 /* Views */ = { + isa = PBXGroup; + children = ( + C7431F0B25F51E1D0094C4CF /* Main.storyboard */, + C7431F1025F51E1E0094C4CF /* LaunchScreen.storyboard */, + D0CED7772ABEAB570081ABE2 /* CollectionViewCell.xib */, + ); + path = Views; + sourceTree = ""; + }; + D0CED77C2ABEAE520081ABE2 /* ViewModels */ = { + isa = PBXGroup; + children = ( + D0CED7762ABEAB570081ABE2 /* CollectionViewCell.swift */, + ); + path = ViewModels; + sourceTree = ""; + }; + D0CED77D2ABEAE600081ABE2 /* Controllers */ = { + isa = PBXGroup; + children = ( + C7431F0925F51E1D0094C4CF /* ViewController.swift */, + ); + path = Controllers; + sourceTree = ""; + }; + D0CED77E2ABEAE800081ABE2 /* Application */ = { isa = PBXGroup; children = ( C7431F0525F51E1D0094C4CF /* AppDelegate.swift */, C7431F0725F51E1D0094C4CF /* SceneDelegate.swift */, - C7431F0925F51E1D0094C4CF /* ViewController.swift */, - C7431F0B25F51E1D0094C4CF /* Main.storyboard */, + ); + path = Application; + sourceTree = ""; + }; + D0CED77F2ABEAEAC0081ABE2 /* Resources */ = { + isa = PBXGroup; + children = ( C7431F0E25F51E1E0094C4CF /* Assets.xcassets */, - C7431F1025F51E1E0094C4CF /* LaunchScreen.storyboard */, C7431F1325F51E1E0094C4CF /* Info.plist */, - D0CED7762ABEAB570081ABE2 /* CollectionViewCell.swift */, - D0CED7772ABEAB570081ABE2 /* CollectionViewCell.xib */, ); - path = ProjectManager; + path = Resources; sourceTree = ""; }; /* End PBXGroup section */ @@ -295,7 +343,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - INFOPLIST_FILE = ProjectManager/Info.plist; + INFOPLIST_FILE = ProjectManager/Resources/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 14.1; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -314,7 +362,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - INFOPLIST_FILE = ProjectManager/Info.plist; + INFOPLIST_FILE = ProjectManager/Resources/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 14.1; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", diff --git a/ProjectManager/ProjectManager/AppDelegate.swift b/ProjectManager/ProjectManager/Application/AppDelegate.swift similarity index 100% rename from ProjectManager/ProjectManager/AppDelegate.swift rename to ProjectManager/ProjectManager/Application/AppDelegate.swift diff --git a/ProjectManager/ProjectManager/SceneDelegate.swift b/ProjectManager/ProjectManager/Application/SceneDelegate.swift similarity index 100% rename from ProjectManager/ProjectManager/SceneDelegate.swift rename to ProjectManager/ProjectManager/Application/SceneDelegate.swift diff --git a/ProjectManager/ProjectManager/ViewController.swift b/ProjectManager/ProjectManager/Controllers/ViewController.swift similarity index 100% rename from ProjectManager/ProjectManager/ViewController.swift rename to ProjectManager/ProjectManager/Controllers/ViewController.swift diff --git a/ProjectManager/ProjectManager/Assets.xcassets/AccentColor.colorset/Contents.json b/ProjectManager/ProjectManager/Resources/Assets.xcassets/AccentColor.colorset/Contents.json similarity index 100% rename from ProjectManager/ProjectManager/Assets.xcassets/AccentColor.colorset/Contents.json rename to ProjectManager/ProjectManager/Resources/Assets.xcassets/AccentColor.colorset/Contents.json diff --git a/ProjectManager/ProjectManager/Assets.xcassets/AppIcon.appiconset/Contents.json b/ProjectManager/ProjectManager/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from ProjectManager/ProjectManager/Assets.xcassets/AppIcon.appiconset/Contents.json rename to ProjectManager/ProjectManager/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/ProjectManager/ProjectManager/Assets.xcassets/Contents.json b/ProjectManager/ProjectManager/Resources/Assets.xcassets/Contents.json similarity index 100% rename from ProjectManager/ProjectManager/Assets.xcassets/Contents.json rename to ProjectManager/ProjectManager/Resources/Assets.xcassets/Contents.json diff --git a/ProjectManager/ProjectManager/Info.plist b/ProjectManager/ProjectManager/Resources/Info.plist similarity index 100% rename from ProjectManager/ProjectManager/Info.plist rename to ProjectManager/ProjectManager/Resources/Info.plist diff --git a/ProjectManager/ProjectManager/CollectionViewCell.swift b/ProjectManager/ProjectManager/ViewModels/CollectionViewCell.swift similarity index 100% rename from ProjectManager/ProjectManager/CollectionViewCell.swift rename to ProjectManager/ProjectManager/ViewModels/CollectionViewCell.swift diff --git a/ProjectManager/ProjectManager/Base.lproj/LaunchScreen.storyboard b/ProjectManager/ProjectManager/Views/Base.lproj/LaunchScreen.storyboard similarity index 100% rename from ProjectManager/ProjectManager/Base.lproj/LaunchScreen.storyboard rename to ProjectManager/ProjectManager/Views/Base.lproj/LaunchScreen.storyboard diff --git a/ProjectManager/ProjectManager/Base.lproj/Main.storyboard b/ProjectManager/ProjectManager/Views/Base.lproj/Main.storyboard similarity index 100% rename from ProjectManager/ProjectManager/Base.lproj/Main.storyboard rename to ProjectManager/ProjectManager/Views/Base.lproj/Main.storyboard diff --git a/ProjectManager/ProjectManager/CollectionViewCell.xib b/ProjectManager/ProjectManager/Views/CollectionViewCell.xib similarity index 100% rename from ProjectManager/ProjectManager/CollectionViewCell.xib rename to ProjectManager/ProjectManager/Views/CollectionViewCell.xib From d6ed629dbe047138fb0e9973f672a44fe6e846c6 Mon Sep 17 00:00:00 2001 From: JusBug Date: Sat, 23 Sep 2023 14:36:16 +0900 Subject: [PATCH 04/39] =?UTF-8?q?feat:=20VC=20Navigation=20=EB=93=B1?= =?UTF-8?q?=EB=A1=9D=20=EB=B0=8F=20=EC=A0=9C=EB=AA=A9=EC=9D=84=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=ED=95=98=EB=8A=94=20configureTitle()=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/ViewController.swift | 7 ++++--- .../Views/Base.lproj/Main.storyboard | 21 ++++++++++++++++++- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/ProjectManager/ProjectManager/Controllers/ViewController.swift b/ProjectManager/ProjectManager/Controllers/ViewController.swift index 63c8a8164..f060bd503 100644 --- a/ProjectManager/ProjectManager/Controllers/ViewController.swift +++ b/ProjectManager/ProjectManager/Controllers/ViewController.swift @@ -14,9 +14,10 @@ class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() - // Do any additional setup after loading the view. + configureTitle() } - + private func configureTitle() { + self.navigationItem.title = "Projcet Manager" + } } - diff --git a/ProjectManager/ProjectManager/Views/Base.lproj/Main.storyboard b/ProjectManager/ProjectManager/Views/Base.lproj/Main.storyboard index 9fb19115f..000806386 100644 --- a/ProjectManager/ProjectManager/Views/Base.lproj/Main.storyboard +++ b/ProjectManager/ProjectManager/Views/Base.lproj/Main.storyboard @@ -1,5 +1,5 @@ - + @@ -85,6 +85,7 @@ + @@ -93,6 +94,24 @@ + + + + + + + + + + + + + + + + + + From d163f0da5022410a2b82145270a13f0269a0547a Mon Sep 17 00:00:00 2001 From: JusBug Date: Mon, 25 Sep 2023 13:49:34 +0900 Subject: [PATCH 05/39] =?UTF-8?q?feat:=20SecondVC=EB=A1=9C=20popover=20?= =?UTF-8?q?=ED=95=98=EB=8A=94=20didTapAddButton()=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProjectManager.xcodeproj/project.pbxproj | 12 ++-- .../Controllers/MainViewController.swift | 39 ++++++++++++ .../Controllers/SecondViewController.swift | 19 ++++++ .../Controllers/ViewController.swift | 23 ------- .../Views/Base.lproj/Main.storyboard | 63 ++++++++++++++++++- 5 files changed, 126 insertions(+), 30 deletions(-) create mode 100644 ProjectManager/ProjectManager/Controllers/MainViewController.swift create mode 100644 ProjectManager/ProjectManager/Controllers/SecondViewController.swift delete mode 100644 ProjectManager/ProjectManager/Controllers/ViewController.swift diff --git a/ProjectManager/ProjectManager.xcodeproj/project.pbxproj b/ProjectManager/ProjectManager.xcodeproj/project.pbxproj index 2cb65133c..73763617b 100644 --- a/ProjectManager/ProjectManager.xcodeproj/project.pbxproj +++ b/ProjectManager/ProjectManager.xcodeproj/project.pbxproj @@ -9,25 +9,27 @@ /* Begin PBXBuildFile section */ C7431F0625F51E1D0094C4CF /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7431F0525F51E1D0094C4CF /* AppDelegate.swift */; }; C7431F0825F51E1D0094C4CF /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7431F0725F51E1D0094C4CF /* SceneDelegate.swift */; }; - C7431F0A25F51E1D0094C4CF /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7431F0925F51E1D0094C4CF /* ViewController.swift */; }; + C7431F0A25F51E1D0094C4CF /* MainViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7431F0925F51E1D0094C4CF /* MainViewController.swift */; }; C7431F0D25F51E1D0094C4CF /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C7431F0B25F51E1D0094C4CF /* Main.storyboard */; }; C7431F0F25F51E1E0094C4CF /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C7431F0E25F51E1E0094C4CF /* Assets.xcassets */; }; C7431F1225F51E1E0094C4CF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C7431F1025F51E1E0094C4CF /* LaunchScreen.storyboard */; }; D0CED7782ABEAB570081ABE2 /* CollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0CED7762ABEAB570081ABE2 /* CollectionViewCell.swift */; }; D0CED7792ABEAB570081ABE2 /* CollectionViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = D0CED7772ABEAB570081ABE2 /* CollectionViewCell.xib */; }; + D0CED7812ABEB18D0081ABE2 /* SecondViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0CED7802ABEB18D0081ABE2 /* SecondViewController.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ C7431F0225F51E1D0094C4CF /* ProjectManager.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ProjectManager.app; sourceTree = BUILT_PRODUCTS_DIR; }; C7431F0525F51E1D0094C4CF /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; C7431F0725F51E1D0094C4CF /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; - C7431F0925F51E1D0094C4CF /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + C7431F0925F51E1D0094C4CF /* MainViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainViewController.swift; sourceTree = ""; }; C7431F0C25F51E1D0094C4CF /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; C7431F0E25F51E1E0094C4CF /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; C7431F1125F51E1E0094C4CF /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; C7431F1325F51E1E0094C4CF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; D0CED7762ABEAB570081ABE2 /* CollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CollectionViewCell.swift; sourceTree = ""; }; D0CED7772ABEAB570081ABE2 /* CollectionViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = CollectionViewCell.xib; sourceTree = ""; }; + D0CED7802ABEB18D0081ABE2 /* SecondViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecondViewController.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -98,7 +100,8 @@ D0CED77D2ABEAE600081ABE2 /* Controllers */ = { isa = PBXGroup; children = ( - C7431F0925F51E1D0094C4CF /* ViewController.swift */, + C7431F0925F51E1D0094C4CF /* MainViewController.swift */, + D0CED7802ABEB18D0081ABE2 /* SecondViewController.swift */, ); path = Controllers; sourceTree = ""; @@ -192,9 +195,10 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - C7431F0A25F51E1D0094C4CF /* ViewController.swift in Sources */, + C7431F0A25F51E1D0094C4CF /* MainViewController.swift in Sources */, C7431F0625F51E1D0094C4CF /* AppDelegate.swift in Sources */, D0CED7782ABEAB570081ABE2 /* CollectionViewCell.swift in Sources */, + D0CED7812ABEB18D0081ABE2 /* SecondViewController.swift in Sources */, C7431F0825F51E1D0094C4CF /* SceneDelegate.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/ProjectManager/ProjectManager/Controllers/MainViewController.swift b/ProjectManager/ProjectManager/Controllers/MainViewController.swift new file mode 100644 index 000000000..056060874 --- /dev/null +++ b/ProjectManager/ProjectManager/Controllers/MainViewController.swift @@ -0,0 +1,39 @@ +// +// ProjectManager - ViewController.swift +// Created by Jusbug. +// Copyright © yagom. All rights reserved. +// + +import UIKit + +class MainViewController: UIViewController { + + @IBOutlet weak var todoCollectionView: UICollectionView! + @IBOutlet weak var doingCollectionView: UICollectionView! + @IBOutlet weak var doneCollectionView: UICollectionView! + + override func viewDidLoad() { + super.viewDidLoad() + configureTitle() + + } + + private func configureTitle() { + self.navigationItem.title = "Project Manager" + } + + @IBAction func didTapAddButton(_ sender: Any) { + guard let secondVC = self.storyboard?.instantiateViewController(withIdentifier: "secondViewController") else { return } + + secondVC.modalTransitionStyle = .coverVertical + secondVC.modalPresentationStyle = .popover + + if let popover = secondVC.popoverPresentationController { + popover.sourceView = self.view + popover.sourceRect = CGRect(x: self.view.bounds.midX, y: self.view.bounds.midY, width: 0, height: 0) + popover.permittedArrowDirections = [] + } + + self.present(secondVC, animated: true, completion: nil) + } +} diff --git a/ProjectManager/ProjectManager/Controllers/SecondViewController.swift b/ProjectManager/ProjectManager/Controllers/SecondViewController.swift new file mode 100644 index 000000000..94f253933 --- /dev/null +++ b/ProjectManager/ProjectManager/Controllers/SecondViewController.swift @@ -0,0 +1,19 @@ +// +// SecondViewController.swift +// ProjectManager +// +// Created by Jusbug on 2023/09/23. +// + +import UIKit + +class SecondViewController: UIViewController { + + override func viewDidLoad() { + configureTitle() + } + + private func configureTitle() { + self.navigationItem.title = "TODO" + } +} diff --git a/ProjectManager/ProjectManager/Controllers/ViewController.swift b/ProjectManager/ProjectManager/Controllers/ViewController.swift deleted file mode 100644 index f060bd503..000000000 --- a/ProjectManager/ProjectManager/Controllers/ViewController.swift +++ /dev/null @@ -1,23 +0,0 @@ -// -// ProjectManager - ViewController.swift -// Created by Jusbug. -// Copyright © yagom. All rights reserved. -// - -import UIKit - -class ViewController: UIViewController { - - @IBOutlet weak var todoCollectionView: UICollectionView! - @IBOutlet weak var doingCollectionView: UICollectionView! - @IBOutlet weak var doneCollectionView: UICollectionView! - - override func viewDidLoad() { - super.viewDidLoad() - configureTitle() - } - - private func configureTitle() { - self.navigationItem.title = "Projcet Manager" - } -} diff --git a/ProjectManager/ProjectManager/Views/Base.lproj/Main.storyboard b/ProjectManager/ProjectManager/Views/Base.lproj/Main.storyboard index 000806386..1a966c95f 100644 --- a/ProjectManager/ProjectManager/Views/Base.lproj/Main.storyboard +++ b/ProjectManager/ProjectManager/Views/Base.lproj/Main.storyboard @@ -10,10 +10,10 @@ - + - + @@ -85,7 +85,13 @@ - + + + + + + + @@ -96,6 +102,39 @@ + + + + + + + + + + + + + + + + + + + + + + + @@ -114,6 +153,24 @@ + + + + + + + + + + + + + + + + + + From 5387839ecb0613f792484887f2900e389a7b60c8 Mon Sep 17 00:00:00 2001 From: JusBug Date: Tue, 26 Sep 2023 03:24:59 +0900 Subject: [PATCH 06/39] =?UTF-8?q?feat:=20=EC=BB=A4=EC=8A=A4=ED=85=80=20?= =?UTF-8?q?=EC=85=80=EC=9D=84=20CollectionView=EC=97=90=20=EB=93=B1?= =?UTF-8?q?=EB=A1=9D=ED=95=98=EB=8A=94=20registerNib()=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/MainViewController.swift | 29 ++++++++++++++++++- .../Views/Base.lproj/Main.storyboard | 6 ++-- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/ProjectManager/ProjectManager/Controllers/MainViewController.swift b/ProjectManager/ProjectManager/Controllers/MainViewController.swift index 056060874..9c8f51be9 100644 --- a/ProjectManager/ProjectManager/Controllers/MainViewController.swift +++ b/ProjectManager/ProjectManager/Controllers/MainViewController.swift @@ -15,9 +15,24 @@ class MainViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() configureTitle() - + initDelegateAndDataSource() + registerNib() + } + + private func registerNib() { + todoCollectionView.register(UINib(nibName: "CollectionViewCell", bundle: nil), forCellWithReuseIdentifier: "cell") + doingCollectionView.register(UINib(nibName: "CollectionViewCell", bundle: nil), forCellWithReuseIdentifier: "cell") + doneCollectionView.register(UINib(nibName: "CollectionViewCell", bundle: nil), forCellWithReuseIdentifier: "cell") } + private func initDelegateAndDataSource() { + todoCollectionView.dataSource = self + todoCollectionView.delegate = self + doingCollectionView.dataSource = self + doingCollectionView.delegate = self + doneCollectionView.dataSource = self + doneCollectionView.delegate = self + } private func configureTitle() { self.navigationItem.title = "Project Manager" } @@ -37,3 +52,15 @@ class MainViewController: UIViewController { self.present(secondVC, animated: true, completion: nil) } } + +extension MainViewController: UICollectionViewDelegate, UICollectionViewDataSource { + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + return 10 + } + + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath) as? CollectionViewCell else { return UICollectionViewCell() } + + return cell + } +} diff --git a/ProjectManager/ProjectManager/Views/Base.lproj/Main.storyboard b/ProjectManager/ProjectManager/Views/Base.lproj/Main.storyboard index 1a966c95f..ffd0d964b 100644 --- a/ProjectManager/ProjectManager/Views/Base.lproj/Main.storyboard +++ b/ProjectManager/ProjectManager/Views/Base.lproj/Main.storyboard @@ -21,7 +21,7 @@ - + @@ -42,7 +42,7 @@ - + @@ -63,7 +63,7 @@ - + From 9ebebcf1074ad48bd60b27853f4b80dd272f753b Mon Sep 17 00:00:00 2001 From: JusBug Date: Tue, 26 Sep 2023 03:37:54 +0900 Subject: [PATCH 07/39] =?UTF-8?q?feat:=20UICollectionViewDelegateFlowLayou?= =?UTF-8?q?t=20=ED=94=84=EB=A1=9C=ED=86=A0=EC=BD=9C=20=EC=B1=84=ED=83=9D?= =?UTF-8?q?=ED=95=98=EC=97=AC,=20=EC=85=80=EC=9D=98=20=EB=84=88=EB=B9=84?= =?UTF-8?q?=EC=99=80=20=EB=86=92=EC=9D=B4=20=EA=B7=B8=EB=A6=AC=EA=B3=A0=20?= =?UTF-8?q?=EC=85=80=20=EA=B0=84=EA=B2=A9=EC=9D=84=20=EC=A0=95=EC=9D=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/MainViewController.swift | 11 ++++++++++- .../ViewModels/CollectionViewCell.swift | 8 +++++++- .../ProjectManager/Views/CollectionViewCell.xib | 7 +++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/ProjectManager/ProjectManager/Controllers/MainViewController.swift b/ProjectManager/ProjectManager/Controllers/MainViewController.swift index 9c8f51be9..9db0310c7 100644 --- a/ProjectManager/ProjectManager/Controllers/MainViewController.swift +++ b/ProjectManager/ProjectManager/Controllers/MainViewController.swift @@ -53,7 +53,7 @@ class MainViewController: UIViewController { } } -extension MainViewController: UICollectionViewDelegate, UICollectionViewDataSource { +extension MainViewController: UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout { func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { return 10 } @@ -63,4 +63,13 @@ extension MainViewController: UICollectionViewDelegate, UICollectionViewDataSour return cell } + + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { + return CGSize(width: collectionView.bounds.width - 10, height: 100) + } + + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat { + + return 10 + } } diff --git a/ProjectManager/ProjectManager/ViewModels/CollectionViewCell.swift b/ProjectManager/ProjectManager/ViewModels/CollectionViewCell.swift index 7b2904279..8cb97de51 100644 --- a/ProjectManager/ProjectManager/ViewModels/CollectionViewCell.swift +++ b/ProjectManager/ProjectManager/ViewModels/CollectionViewCell.swift @@ -15,7 +15,13 @@ class CollectionViewCell: UICollectionViewCell { override func awakeFromNib() { super.awakeFromNib() - // Initialization code + configureLabels() } + private func configureLabels() { + titleLabel.text = "Title" + descriptionLabel.text = "Description" + durationLabel.text = "Duration" + durationLabel.textColor = .red + } } diff --git a/ProjectManager/ProjectManager/Views/CollectionViewCell.xib b/ProjectManager/ProjectManager/Views/CollectionViewCell.xib index a3902488b..f4c1fe689 100644 --- a/ProjectManager/ProjectManager/Views/CollectionViewCell.xib +++ b/ProjectManager/ProjectManager/Views/CollectionViewCell.xib @@ -5,6 +5,7 @@ + @@ -43,6 +44,7 @@ + @@ -52,4 +54,9 @@ + + + + + From a1bd7de01957e78aa6e0005489fd18ed8c1228cd Mon Sep 17 00:00:00 2001 From: JusBug Date: Tue, 26 Sep 2023 04:30:19 +0900 Subject: [PATCH 08/39] =?UTF-8?q?feat:=20CollectionReusableView=EB=A5=BC?= =?UTF-8?q?=20=EC=BB=A4=EC=8A=A4=ED=85=80=20=EC=83=9D=EC=84=B1=ED=95=98?= =?UTF-8?q?=EC=97=AC=20CollectionView=20=ED=97=A4=EB=8D=94=EC=97=90=20?= =?UTF-8?q?=EC=9E=AC=EC=82=AC=EC=9A=A9=20=EB=90=98=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EB=93=B1=EB=A1=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProjectManager.xcodeproj/project.pbxproj | 8 ++++ .../Controllers/MainViewController.swift | 22 +++++++++++ .../ViewModels/CollectionReusableView.swift | 25 ++++++++++++ .../ViewModels/CollectionViewCell.swift | 4 +- .../Views/CollectionReusableView.xib | 39 +++++++++++++++++++ 5 files changed, 96 insertions(+), 2 deletions(-) create mode 100644 ProjectManager/ProjectManager/ViewModels/CollectionReusableView.swift create mode 100644 ProjectManager/ProjectManager/Views/CollectionReusableView.xib diff --git a/ProjectManager/ProjectManager.xcodeproj/project.pbxproj b/ProjectManager/ProjectManager.xcodeproj/project.pbxproj index 73763617b..c0171e09b 100644 --- a/ProjectManager/ProjectManager.xcodeproj/project.pbxproj +++ b/ProjectManager/ProjectManager.xcodeproj/project.pbxproj @@ -13,6 +13,8 @@ C7431F0D25F51E1D0094C4CF /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C7431F0B25F51E1D0094C4CF /* Main.storyboard */; }; C7431F0F25F51E1E0094C4CF /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C7431F0E25F51E1E0094C4CF /* Assets.xcassets */; }; C7431F1225F51E1E0094C4CF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C7431F1025F51E1E0094C4CF /* LaunchScreen.storyboard */; }; + D09389A92AC20FC5008A8304 /* CollectionReusableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D09389A72AC20FC5008A8304 /* CollectionReusableView.swift */; }; + D09389AA2AC20FC5008A8304 /* CollectionReusableView.xib in Resources */ = {isa = PBXBuildFile; fileRef = D09389A82AC20FC5008A8304 /* CollectionReusableView.xib */; }; D0CED7782ABEAB570081ABE2 /* CollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0CED7762ABEAB570081ABE2 /* CollectionViewCell.swift */; }; D0CED7792ABEAB570081ABE2 /* CollectionViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = D0CED7772ABEAB570081ABE2 /* CollectionViewCell.xib */; }; D0CED7812ABEB18D0081ABE2 /* SecondViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0CED7802ABEB18D0081ABE2 /* SecondViewController.swift */; }; @@ -27,6 +29,8 @@ C7431F0E25F51E1E0094C4CF /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; C7431F1125F51E1E0094C4CF /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; C7431F1325F51E1E0094C4CF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + D09389A72AC20FC5008A8304 /* CollectionReusableView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CollectionReusableView.swift; sourceTree = ""; }; + D09389A82AC20FC5008A8304 /* CollectionReusableView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = CollectionReusableView.xib; sourceTree = ""; }; D0CED7762ABEAB570081ABE2 /* CollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CollectionViewCell.swift; sourceTree = ""; }; D0CED7772ABEAB570081ABE2 /* CollectionViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = CollectionViewCell.xib; sourceTree = ""; }; D0CED7802ABEB18D0081ABE2 /* SecondViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecondViewController.swift; sourceTree = ""; }; @@ -85,6 +89,7 @@ C7431F0B25F51E1D0094C4CF /* Main.storyboard */, C7431F1025F51E1E0094C4CF /* LaunchScreen.storyboard */, D0CED7772ABEAB570081ABE2 /* CollectionViewCell.xib */, + D09389A82AC20FC5008A8304 /* CollectionReusableView.xib */, ); path = Views; sourceTree = ""; @@ -93,6 +98,7 @@ isa = PBXGroup; children = ( D0CED7762ABEAB570081ABE2 /* CollectionViewCell.swift */, + D09389A72AC20FC5008A8304 /* CollectionReusableView.swift */, ); path = ViewModels; sourceTree = ""; @@ -181,6 +187,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + D09389AA2AC20FC5008A8304 /* CollectionReusableView.xib in Resources */, C7431F1225F51E1E0094C4CF /* LaunchScreen.storyboard in Resources */, C7431F0F25F51E1E0094C4CF /* Assets.xcassets in Resources */, D0CED7792ABEAB570081ABE2 /* CollectionViewCell.xib in Resources */, @@ -198,6 +205,7 @@ C7431F0A25F51E1D0094C4CF /* MainViewController.swift in Sources */, C7431F0625F51E1D0094C4CF /* AppDelegate.swift in Sources */, D0CED7782ABEAB570081ABE2 /* CollectionViewCell.swift in Sources */, + D09389A92AC20FC5008A8304 /* CollectionReusableView.swift in Sources */, D0CED7812ABEB18D0081ABE2 /* SecondViewController.swift in Sources */, C7431F0825F51E1D0094C4CF /* SceneDelegate.swift in Sources */, ); diff --git a/ProjectManager/ProjectManager/Controllers/MainViewController.swift b/ProjectManager/ProjectManager/Controllers/MainViewController.swift index 9db0310c7..d04deff9b 100644 --- a/ProjectManager/ProjectManager/Controllers/MainViewController.swift +++ b/ProjectManager/ProjectManager/Controllers/MainViewController.swift @@ -23,6 +23,9 @@ class MainViewController: UIViewController { todoCollectionView.register(UINib(nibName: "CollectionViewCell", bundle: nil), forCellWithReuseIdentifier: "cell") doingCollectionView.register(UINib(nibName: "CollectionViewCell", bundle: nil), forCellWithReuseIdentifier: "cell") doneCollectionView.register(UINib(nibName: "CollectionViewCell", bundle: nil), forCellWithReuseIdentifier: "cell") + todoCollectionView.register(UINib(nibName: "CollectionReusableView", bundle: nil), forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: "header") + doingCollectionView.register(UINib(nibName: "CollectionReusableView", bundle: nil), forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: "header") + doneCollectionView.register(UINib(nibName: "CollectionReusableView", bundle: nil), forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: "header") } private func initDelegateAndDataSource() { @@ -61,6 +64,8 @@ extension MainViewController: UICollectionViewDelegate, UICollectionViewDataSour func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath) as? CollectionViewCell else { return UICollectionViewCell() } + cell.configureLabels() + return cell } @@ -72,4 +77,21 @@ extension MainViewController: UICollectionViewDelegate, UICollectionViewDataSour return 10 } + + func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView { + + if kind == UICollectionView.elementKindSectionHeader { + guard let headerView = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "header", for: indexPath) as? CollectionReusableView else { return UICollectionReusableView()} + + headerView.configureHeaderLabel() + + return headerView + } else { + return UICollectionReusableView() + } + } + + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize { + return CGSize(width: collectionView.frame.width - 10, height: 80) + } } diff --git a/ProjectManager/ProjectManager/ViewModels/CollectionReusableView.swift b/ProjectManager/ProjectManager/ViewModels/CollectionReusableView.swift new file mode 100644 index 000000000..ac071457d --- /dev/null +++ b/ProjectManager/ProjectManager/ViewModels/CollectionReusableView.swift @@ -0,0 +1,25 @@ +// +// CollectionReusableView.swift +// ProjectManager +// +// Created by 박종화 on 2023/09/26. +// + +import UIKit + +class CollectionReusableView: UICollectionReusableView { + + @IBOutlet weak var headerLabel: UILabel! + + override func awakeFromNib() { + super.awakeFromNib() + } + + func configureHeaderLabel() { + if let headerLabel = headerLabel { + headerLabel.text = "TODO" + } else { + // headerLabel이 nil인 경우에 대한 처리 + } + } +} diff --git a/ProjectManager/ProjectManager/ViewModels/CollectionViewCell.swift b/ProjectManager/ProjectManager/ViewModels/CollectionViewCell.swift index 8cb97de51..3505fd9fc 100644 --- a/ProjectManager/ProjectManager/ViewModels/CollectionViewCell.swift +++ b/ProjectManager/ProjectManager/ViewModels/CollectionViewCell.swift @@ -15,10 +15,10 @@ class CollectionViewCell: UICollectionViewCell { override func awakeFromNib() { super.awakeFromNib() - configureLabels() + } - private func configureLabels() { + func configureLabels() { titleLabel.text = "Title" descriptionLabel.text = "Description" durationLabel.text = "Duration" diff --git a/ProjectManager/ProjectManager/Views/CollectionReusableView.xib b/ProjectManager/ProjectManager/Views/CollectionReusableView.xib new file mode 100644 index 000000000..b6a91d54f --- /dev/null +++ b/ProjectManager/ProjectManager/Views/CollectionReusableView.xib @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 12bea3c054a94ea28ef4d53512137ccc722e8c0d Mon Sep 17 00:00:00 2001 From: JusBug Date: Tue, 26 Sep 2023 04:38:24 +0900 Subject: [PATCH 09/39] =?UTF-8?q?refactor:=20CollectionView=20AutoLayout?= =?UTF-8?q?=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Views/Base.lproj/Main.storyboard | 142 ++++++++++-------- 1 file changed, 78 insertions(+), 64 deletions(-) diff --git a/ProjectManager/ProjectManager/Views/Base.lproj/Main.storyboard b/ProjectManager/ProjectManager/Views/Base.lproj/Main.storyboard index ffd0d964b..6d86e3913 100644 --- a/ProjectManager/ProjectManager/Views/Base.lproj/Main.storyboard +++ b/ProjectManager/ProjectManager/Views/Base.lproj/Main.storyboard @@ -14,76 +14,90 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 8de0d3f57c0bfb6d1e0c70aa58f4bd2d49cf339a Mon Sep 17 00:00:00 2001 From: JusBug Date: Tue, 26 Sep 2023 09:41:49 +0900 Subject: [PATCH 10/39] =?UTF-8?q?refactor:=20=EC=98=A4=EB=A5=98=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Views/Base.lproj/Main.storyboard | 50 ++++--------------- 1 file changed, 11 insertions(+), 39 deletions(-) diff --git a/ProjectManager/ProjectManager/Views/Base.lproj/Main.storyboard b/ProjectManager/ProjectManager/Views/Base.lproj/Main.storyboard index 6d86e3913..d0bd7c375 100644 --- a/ProjectManager/ProjectManager/Views/Base.lproj/Main.storyboard +++ b/ProjectManager/ProjectManager/Views/Base.lproj/Main.storyboard @@ -6,7 +6,6 @@ - @@ -19,10 +18,10 @@ - + - + @@ -33,19 +32,10 @@ - - - - - - - - - - + - + @@ -53,19 +43,10 @@ - - - - - - - - - - + - + @@ -73,16 +54,7 @@ - - - - - - - - - - + @@ -100,7 +72,7 @@ - + @@ -127,7 +99,7 @@ - + + + + + + + + + + + + @@ -160,6 +192,9 @@ + + + From abaa70cca17ff6b0f43d66149b21dda3b8564a5a Mon Sep 17 00:00:00 2001 From: JusBug Date: Tue, 26 Sep 2023 11:04:09 +0900 Subject: [PATCH 13/39] =?UTF-8?q?feat:=20titleTextField=EC=9D=98=20placeHo?= =?UTF-8?q?lder=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/SecondViewController.swift | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ProjectManager/ProjectManager/Controllers/SecondViewController.swift b/ProjectManager/ProjectManager/Controllers/SecondViewController.swift index 701f58f1d..e70c51da8 100644 --- a/ProjectManager/ProjectManager/Controllers/SecondViewController.swift +++ b/ProjectManager/ProjectManager/Controllers/SecondViewController.swift @@ -15,13 +15,19 @@ class SecondViewController: UIViewController { override func viewDidLoad() { configureTitle() - + initPlaceHolderForTextField() } private func configureTitle() { self.navigationItem.title = "TODO" } + private func initPlaceHolderForTextField() { + titleTextField.delegate = self + titleTextField.text = "Title" + titleTextField.textColor = .gray + } + @IBAction func didTapEditButton(_ sender: Any) { } @@ -30,3 +36,10 @@ class SecondViewController: UIViewController { } } + +extension SecondViewController: UITextFieldDelegate { + func textFieldShouldReturn(_ textField: UITextField) -> Bool { + titleTextField.resignFirstResponder() + return true + } +} From 2eae03c2b6232d2fcbd758849203c705f4da547b Mon Sep 17 00:00:00 2001 From: JusBug Date: Tue, 26 Sep 2023 11:29:37 +0900 Subject: [PATCH 14/39] =?UTF-8?q?feat:=20descriptionTextView=EC=9D=98=20pl?= =?UTF-8?q?aceHolder=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/SecondViewController.swift | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/ProjectManager/ProjectManager/Controllers/SecondViewController.swift b/ProjectManager/ProjectManager/Controllers/SecondViewController.swift index e70c51da8..5db7e8ebe 100644 --- a/ProjectManager/ProjectManager/Controllers/SecondViewController.swift +++ b/ProjectManager/ProjectManager/Controllers/SecondViewController.swift @@ -12,20 +12,23 @@ class SecondViewController: UIViewController { @IBOutlet weak var titleTextField: UITextField! @IBOutlet weak var datePicker: UIDatePicker! @IBOutlet weak var descriptionTextView: UITextView! - + private let placeHolderForTextView = "This is where you type in what to do.\n1000 characters in the limit." override func viewDidLoad() { configureTitle() - initPlaceHolderForTextField() + initPlaceHolderForText() } private func configureTitle() { self.navigationItem.title = "TODO" } - private func initPlaceHolderForTextField() { + private func initPlaceHolderForText() { titleTextField.delegate = self titleTextField.text = "Title" titleTextField.textColor = .gray + descriptionTextView.delegate = self + descriptionTextView.text = placeHolderForTextView + descriptionTextView.textColor = .gray } @IBAction func didTapEditButton(_ sender: Any) { @@ -43,3 +46,19 @@ extension SecondViewController: UITextFieldDelegate { return true } } + +extension SecondViewController: UITextViewDelegate { + func textViewDidBeginEditing(_ textView: UITextView) { + if descriptionTextView.text == placeHolderForTextView { + descriptionTextView.text = nil + descriptionTextView.textColor = .black + } + } + + func textViewDidEndEditing(_ textView: UITextView) { + if descriptionTextView.text.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { + descriptionTextView.text = placeHolderForTextView + descriptionTextView.textColor = .gray + } + } +} From 849b576f17120597bc8cb06d3041ddbe0b158753 Mon Sep 17 00:00:00 2001 From: JusBug Date: Tue, 26 Sep 2023 13:51:45 +0900 Subject: [PATCH 15/39] =?UTF-8?q?feat:=20datePicker=20AutoLayout=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Views/Base.lproj/Main.storyboard | 38 ++++++++++++++----- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/ProjectManager/ProjectManager/Views/Base.lproj/Main.storyboard b/ProjectManager/ProjectManager/Views/Base.lproj/Main.storyboard index d9e75fc3f..757ad4ab4 100644 --- a/ProjectManager/ProjectManager/Views/Base.lproj/Main.storyboard +++ b/ProjectManager/ProjectManager/Views/Base.lproj/Main.storyboard @@ -97,28 +97,48 @@ - - - + + + + + + - - - + + + + + + Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda. - - - + + + + + + + + + + + + + + + + + From 58b53b00afb5ab97204c6709acfcd7e1157c79a2 Mon Sep 17 00:00:00 2001 From: JusBug Date: Tue, 26 Sep 2023 14:02:19 +0900 Subject: [PATCH 16/39] =?UTF-8?q?refactor:=20titleTextField=20placeHolder?= =?UTF-8?q?=20=EA=B8=B0=EB=8A=A5=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/SecondViewController.swift | 18 ++++++++++++++---- .../Views/Base.lproj/Main.storyboard | 2 +- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ProjectManager/ProjectManager/Controllers/SecondViewController.swift b/ProjectManager/ProjectManager/Controllers/SecondViewController.swift index 5db7e8ebe..895776d12 100644 --- a/ProjectManager/ProjectManager/Controllers/SecondViewController.swift +++ b/ProjectManager/ProjectManager/Controllers/SecondViewController.swift @@ -12,6 +12,7 @@ class SecondViewController: UIViewController { @IBOutlet weak var titleTextField: UITextField! @IBOutlet weak var datePicker: UIDatePicker! @IBOutlet weak var descriptionTextView: UITextView! + private let placeHolderForTextField = "Title" private let placeHolderForTextView = "This is where you type in what to do.\n1000 characters in the limit." override func viewDidLoad() { configureTitle() @@ -24,7 +25,7 @@ class SecondViewController: UIViewController { private func initPlaceHolderForText() { titleTextField.delegate = self - titleTextField.text = "Title" + titleTextField.text = placeHolderForTextField titleTextField.textColor = .gray descriptionTextView.delegate = self descriptionTextView.text = placeHolderForTextView @@ -41,9 +42,18 @@ class SecondViewController: UIViewController { } extension SecondViewController: UITextFieldDelegate { - func textFieldShouldReturn(_ textField: UITextField) -> Bool { - titleTextField.resignFirstResponder() - return true + func textFieldDidBeginEditing(_ textField: UITextField) { + if titleTextField.text == placeHolderForTextField { + titleTextField.text = nil + titleTextField.textColor = .black + } + } + + func textFieldDidEndEditing(_ textField: UITextField) { + if let title = titleTextField.text, title.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { + titleTextField.text = placeHolderForTextField + titleTextField.textColor = .gray + } } } diff --git a/ProjectManager/ProjectManager/Views/Base.lproj/Main.storyboard b/ProjectManager/ProjectManager/Views/Base.lproj/Main.storyboard index 757ad4ab4..4515fbedd 100644 --- a/ProjectManager/ProjectManager/Views/Base.lproj/Main.storyboard +++ b/ProjectManager/ProjectManager/Views/Base.lproj/Main.storyboard @@ -152,7 +152,7 @@ - + - - - - - - @@ -209,7 +209,7 @@ - + From 9d3908968a4bb1fda8598e9656a71d7e1ce585b6 Mon Sep 17 00:00:00 2001 From: JusBug Date: Mon, 2 Oct 2023 15:50:46 +0900 Subject: [PATCH 25/39] =?UTF-8?q?feat:=20delete=20AlertAction=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ProjectManager/CoreDataManager.swift | 11 ----------- .../Controllers/MainViewController.swift | 14 +++++++++++++- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/ProjectManager/CoreDataManager.swift b/ProjectManager/CoreDataManager.swift index 4b38d0806..9b193b877 100644 --- a/ProjectManager/CoreDataManager.swift +++ b/ProjectManager/CoreDataManager.swift @@ -52,15 +52,4 @@ final class CoreDataManager { saveToContext() } - - func moveItem(from sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath) { - // 선택한 아이템을 가져옴 - let itemToMove = entities.remove(at: sourceIndexPath.item) - - // 새로운 위치에 아이템을 삽입 - entities.insert(itemToMove, at: destinationIndexPath.item) - - // 변경 내용을 저장 - saveToContext() - } } diff --git a/ProjectManager/ProjectManager/Controllers/MainViewController.swift b/ProjectManager/ProjectManager/Controllers/MainViewController.swift index bb01a9875..c3a2e4900 100644 --- a/ProjectManager/ProjectManager/Controllers/MainViewController.swift +++ b/ProjectManager/ProjectManager/Controllers/MainViewController.swift @@ -107,13 +107,25 @@ extension MainViewController: UICollectionViewDataSource { let actionSheet = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet) let doing = UIAlertAction(title: "Move to Doing", style: .default) { [weak self] action in - + guard let self = self else { return } + + let entity = self.coreDataManager.entities[indexPath.row] + coreDataManager.deleteEntity(entity: entity) + updateTodoColletionView() + } let done = UIAlertAction(title: "Move to Done", style: .default) + let delete = UIAlertAction(title: "Delete", style: .destructive) { [weak self] action in + guard let self = self else { return } + let entity = self.coreDataManager.entities[indexPath.row] + coreDataManager.deleteEntity(entity: entity) + updateTodoColletionView() + } actionSheet.addAction(doing) actionSheet.addAction(done) + actionSheet.addAction(delete) if let cell = collectionView.cellForItem(at: indexPath) { actionSheet.popoverPresentationController?.sourceView = cell From f41e50439d885e9b87c321f5409841e522858f7c Mon Sep 17 00:00:00 2001 From: JusBug Date: Mon, 2 Oct 2023 18:42:07 +0900 Subject: [PATCH 26/39] =?UTF-8?q?feat:=20DateFormatManager=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=20=EB=B0=8F=20datePicker=20=EA=B0=92=EC=9D=84=20?= =?UTF-8?q?=EA=B0=80=EC=A0=B8=EC=99=80=20durationLabel=EC=97=90=20?= =?UTF-8?q?=EC=B6=9C=EB=A0=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ProjectManager/CoreDataManager.swift | 8 +++---- .../ProjectManager.xcodeproj/project.pbxproj | 4 ++++ .../Application/SceneDelegate.swift | 4 ++++ .../Controllers/SecondViewController.swift | 4 ++-- .../ViewModels/CollectionViewCell.swift | 5 +++- .../ViewModels/DateFormatManager.swift | 23 +++++++++++++++++++ 6 files changed, 41 insertions(+), 7 deletions(-) create mode 100644 ProjectManager/ProjectManager/ViewModels/DateFormatManager.swift diff --git a/ProjectManager/CoreDataManager.swift b/ProjectManager/CoreDataManager.swift index 9b193b877..c033c220d 100644 --- a/ProjectManager/CoreDataManager.swift +++ b/ProjectManager/CoreDataManager.swift @@ -21,11 +21,11 @@ final class CoreDataManager { } } - func createEntity(title: String, body: String) { + func createEntity(title: String, body: String, duration: Date) { let newEntity = Entity(context: context) newEntity.title = title newEntity.body = body - newEntity.duration = Date() + newEntity.duration = duration saveToContext() getAllEntity() @@ -39,10 +39,10 @@ final class CoreDataManager { } } - func updateEntity(entity: Entity, newTitle: String, newBody: String) { + func updateEntity(entity: Entity, newTitle: String, newBody: String, newDuration: Date) { entity.title = newTitle entity.body = newBody - entity.duration = Date() + entity.duration = newDuration saveToContext() } diff --git a/ProjectManager/ProjectManager.xcodeproj/project.pbxproj b/ProjectManager/ProjectManager.xcodeproj/project.pbxproj index 2afaf668a..8c8c86007 100644 --- a/ProjectManager/ProjectManager.xcodeproj/project.pbxproj +++ b/ProjectManager/ProjectManager.xcodeproj/project.pbxproj @@ -13,6 +13,7 @@ C7431F0D25F51E1D0094C4CF /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C7431F0B25F51E1D0094C4CF /* Main.storyboard */; }; C7431F0F25F51E1E0094C4CF /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C7431F0E25F51E1E0094C4CF /* Assets.xcassets */; }; C7431F1225F51E1E0094C4CF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C7431F1025F51E1E0094C4CF /* LaunchScreen.storyboard */; }; + D0293F532ACAB3CE00505749 /* DateFormatManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0293F522ACAB3CE00505749 /* DateFormatManager.swift */; }; D06DA8E52AC2BA9F00314499 /* Todo.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = D06DA8E32AC2BA9F00314499 /* Todo.xcdatamodeld */; }; D06DA8E82AC2BB0D00314499 /* Entity+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = D06DA8E62AC2BB0D00314499 /* Entity+CoreDataClass.swift */; }; D06DA8E92AC2BB0D00314499 /* Entity+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = D06DA8E72AC2BB0D00314499 /* Entity+CoreDataProperties.swift */; }; @@ -33,6 +34,7 @@ C7431F0E25F51E1E0094C4CF /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; C7431F1125F51E1E0094C4CF /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; C7431F1325F51E1E0094C4CF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + D0293F522ACAB3CE00505749 /* DateFormatManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DateFormatManager.swift; sourceTree = ""; }; D06DA8E42AC2BA9F00314499 /* Todo.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Todo.xcdatamodel; sourceTree = ""; }; D06DA8E62AC2BB0D00314499 /* Entity+CoreDataClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Entity+CoreDataClass.swift"; sourceTree = ""; }; D06DA8E72AC2BB0D00314499 /* Entity+CoreDataProperties.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Entity+CoreDataProperties.swift"; sourceTree = ""; }; @@ -110,6 +112,7 @@ children = ( D0CED7762ABEAB570081ABE2 /* CollectionViewCell.swift */, D09389A72AC20FC5008A8304 /* CollectionReusableView.swift */, + D0293F522ACAB3CE00505749 /* DateFormatManager.swift */, ); path = ViewModels; sourceTree = ""; @@ -219,6 +222,7 @@ C7431F0625F51E1D0094C4CF /* AppDelegate.swift in Sources */, D06DA8E92AC2BB0D00314499 /* Entity+CoreDataProperties.swift in Sources */, D0CED7782ABEAB570081ABE2 /* CollectionViewCell.swift in Sources */, + D0293F532ACAB3CE00505749 /* DateFormatManager.swift in Sources */, D09389A92AC20FC5008A8304 /* CollectionReusableView.swift in Sources */, D0CED7812ABEB18D0081ABE2 /* SecondViewController.swift in Sources */, D06DA8E82AC2BB0D00314499 /* Entity+CoreDataClass.swift in Sources */, diff --git a/ProjectManager/ProjectManager/Application/SceneDelegate.swift b/ProjectManager/ProjectManager/Application/SceneDelegate.swift index 38f950950..263f65686 100644 --- a/ProjectManager/ProjectManager/Application/SceneDelegate.swift +++ b/ProjectManager/ProjectManager/Application/SceneDelegate.swift @@ -16,6 +16,10 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). guard let _ = (scene as? UIWindowScene) else { return } + + if #available(iOS 13.0, *) { + window?.overrideUserInterfaceStyle = .light + } } func sceneDidDisconnect(_ scene: UIScene) { diff --git a/ProjectManager/ProjectManager/Controllers/SecondViewController.swift b/ProjectManager/ProjectManager/Controllers/SecondViewController.swift index acc7c5de1..e047eec65 100644 --- a/ProjectManager/ProjectManager/Controllers/SecondViewController.swift +++ b/ProjectManager/ProjectManager/Controllers/SecondViewController.swift @@ -34,10 +34,10 @@ class SecondViewController: UIViewController { return } - coreDataManager.createEntity(title: title, body: body) + let date = datePicker.date + coreDataManager.createEntity(title: title, body: body, duration: date) } - override func touchesBegan(_ touches: Set, with event: UIEvent?){ self.view.endEditing(true) } diff --git a/ProjectManager/ProjectManager/ViewModels/CollectionViewCell.swift b/ProjectManager/ProjectManager/ViewModels/CollectionViewCell.swift index e202ba16e..254127b3f 100644 --- a/ProjectManager/ProjectManager/ViewModels/CollectionViewCell.swift +++ b/ProjectManager/ProjectManager/ViewModels/CollectionViewCell.swift @@ -19,9 +19,12 @@ class CollectionViewCell: UICollectionViewCell { } func configureLabels(entity: Entity) { + guard let date = entity.duration else { return } + let formattedDate = DateFormatManager.formatDate(date: date) + titleLabel.text = entity.title bodyLabel.text = entity.body - durationLabel.text = "Duration" + durationLabel.text = formattedDate durationLabel.textColor = .red } } diff --git a/ProjectManager/ProjectManager/ViewModels/DateFormatManager.swift b/ProjectManager/ProjectManager/ViewModels/DateFormatManager.swift new file mode 100644 index 000000000..f7f24fc9a --- /dev/null +++ b/ProjectManager/ProjectManager/ViewModels/DateFormatManager.swift @@ -0,0 +1,23 @@ +// +// DateFormatter.swift +// ProjectManager +// +// Created by 박종화 on 2023/10/02. +// + +import Foundation + +struct DateFormatManager { + static let customDateFormatter: DateFormatter = { + let dateFormatter = DateFormatter() + dateFormatter.dateFormat = "YYYY. MM. dd." + + return dateFormatter + }() + + static func formatDate(date: Date) -> String { + let formattedDate = customDateFormatter.string(from: date) + + return formattedDate + } +} From 8ac0065f794b3bd9c2f93b228b27586916fb6591 Mon Sep 17 00:00:00 2001 From: JusBug Date: Mon, 2 Oct 2023 18:51:10 +0900 Subject: [PATCH 27/39] =?UTF-8?q?refactor:=20=EA=B0=81=20collectionView?= =?UTF-8?q?=EC=9D=98=20=ED=97=A4=EB=8D=94=20=ED=83=80=EC=9D=B4=ED=8B=80?= =?UTF-8?q?=EC=9D=84=20=EB=B6=84=EA=B8=B0=20=EC=B2=98=EB=A6=AC=ED=95=98?= =?UTF-8?q?=EC=97=AC=20=ED=91=9C=EC=8B=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProjectManager/Controllers/MainViewController.swift | 8 +++++++- .../ViewModels/CollectionReusableView.swift | 8 -------- .../ProjectManager/Views/CollectionReusableView.xib | 6 +++--- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/ProjectManager/ProjectManager/Controllers/MainViewController.swift b/ProjectManager/ProjectManager/Controllers/MainViewController.swift index c3a2e4900..5f3026c6c 100644 --- a/ProjectManager/ProjectManager/Controllers/MainViewController.swift +++ b/ProjectManager/ProjectManager/Controllers/MainViewController.swift @@ -152,7 +152,13 @@ extension MainViewController: UICollectionViewDelegateFlowLayout { if kind == UICollectionView.elementKindSectionHeader { guard let headerView = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "header", for: indexPath) as? CollectionReusableView else { return UICollectionReusableView()} - headerView.configureHeaderLabel() + if collectionView == todoCollectionView { + headerView.headerLabel.text = "TODO" + } else if collectionView == doingCollectionView { + headerView.headerLabel.text = "DOING" + } else if collectionView == doneCollectionView { + headerView.headerLabel.text = "DONE" + } return headerView } else { diff --git a/ProjectManager/ProjectManager/ViewModels/CollectionReusableView.swift b/ProjectManager/ProjectManager/ViewModels/CollectionReusableView.swift index ac071457d..534ab7444 100644 --- a/ProjectManager/ProjectManager/ViewModels/CollectionReusableView.swift +++ b/ProjectManager/ProjectManager/ViewModels/CollectionReusableView.swift @@ -14,12 +14,4 @@ class CollectionReusableView: UICollectionReusableView { override func awakeFromNib() { super.awakeFromNib() } - - func configureHeaderLabel() { - if let headerLabel = headerLabel { - headerLabel.text = "TODO" - } else { - // headerLabel이 nil인 경우에 대한 처리 - } - } } diff --git a/ProjectManager/ProjectManager/Views/CollectionReusableView.xib b/ProjectManager/ProjectManager/Views/CollectionReusableView.xib index b6a91d54f..8974d2ace 100644 --- a/ProjectManager/ProjectManager/Views/CollectionReusableView.xib +++ b/ProjectManager/ProjectManager/Views/CollectionReusableView.xib @@ -1,9 +1,9 @@ - + - + @@ -16,7 +16,7 @@