From 53611518c429ada860395a8c269c435850badee9 Mon Sep 17 00:00:00 2001 From: Jinsujin Date: Sat, 10 Dec 2022 23:13:19 +0900 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20#33=20Add=20cleanedUpDay=20Attribut?= =?UTF-8?q?e=20in=20CoreData?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 통계에서 필요한 날짜인 실제로 청소가 된 날짜 추가 - 리스트 화면에서 물건을 비웠을때 오늘 날짜로 업데이트 --- ThrowAway/ThrowAway/Product+CoreDataProperties.swift | 3 ++- .../ThrowAway/SwiftUI/StaticsView/View/StatisticsView.swift | 1 - .../ThrowAway.xcdatamodeld/ThrowAway.xcdatamodel/contents | 3 ++- .../ThrowAway/View Controllers/ProductListViewController.swift | 1 + 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ThrowAway/ThrowAway/Product+CoreDataProperties.swift b/ThrowAway/ThrowAway/Product+CoreDataProperties.swift index 68fa23a..7c933ec 100644 --- a/ThrowAway/ThrowAway/Product+CoreDataProperties.swift +++ b/ThrowAway/ThrowAway/Product+CoreDataProperties.swift @@ -14,12 +14,13 @@ extension Product { @nonobjc public class func fetchRequest() -> NSFetchRequest { return NSFetchRequest(entityName: "Product") } - + @NSManaged public var cleaningDay: Date? @NSManaged public var title: String? @NSManaged public var photo: Data? @NSManaged public var memo: String? @NSManaged public var isCleanedUp: Bool + @NSManaged public var cleanedUpDay: Date? } extension Product: Identifiable { diff --git a/ThrowAway/ThrowAway/SwiftUI/StaticsView/View/StatisticsView.swift b/ThrowAway/ThrowAway/SwiftUI/StaticsView/View/StatisticsView.swift index ed39244..03b0546 100644 --- a/ThrowAway/ThrowAway/SwiftUI/StaticsView/View/StatisticsView.swift +++ b/ThrowAway/ThrowAway/SwiftUI/StaticsView/View/StatisticsView.swift @@ -16,7 +16,6 @@ struct StatisticsView: View { @EnvironmentObject var dateHolder: DateHolder var body: some View { - VStack { VStack { DateScrollView() diff --git a/ThrowAway/ThrowAway/ThrowAway.xcdatamodeld/ThrowAway.xcdatamodel/contents b/ThrowAway/ThrowAway/ThrowAway.xcdatamodeld/ThrowAway.xcdatamodel/contents index 8539352..45969fc 100644 --- a/ThrowAway/ThrowAway/ThrowAway.xcdatamodeld/ThrowAway.xcdatamodel/contents +++ b/ThrowAway/ThrowAway/ThrowAway.xcdatamodeld/ThrowAway.xcdatamodel/contents @@ -1,6 +1,7 @@ + @@ -8,6 +9,6 @@ - + \ No newline at end of file diff --git a/ThrowAway/ThrowAway/View Controllers/ProductListViewController.swift b/ThrowAway/ThrowAway/View Controllers/ProductListViewController.swift index 8253fac..9a8cf9b 100644 --- a/ThrowAway/ThrowAway/View Controllers/ProductListViewController.swift +++ b/ThrowAway/ThrowAway/View Controllers/ProductListViewController.swift @@ -97,6 +97,7 @@ class ProductListViewController: UIViewController { } let updatedItem = productList[index] updatedItem.isCleanedUp = true + updatedItem.cleanedUpDay = Date() completion() do { try viewContext.save()