Skip to content

Commit

Permalink
#33 Add cleanedUpDay Attribute in CoreData
Browse files Browse the repository at this point in the history
- 통계에서 필요한 날짜인 실제로 청소가 된 날짜 추가
- 리스트 화면에서 물건을 비웠을때 오늘 날짜로 업데이트
  • Loading branch information
Jinsujin committed Dec 10, 2022
1 parent d1a4ebb commit 5361151
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion ThrowAway/ThrowAway/Product+CoreDataProperties.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ extension Product {
@nonobjc public class func fetchRequest() -> NSFetchRequest<Product> {
return NSFetchRequest<Product>(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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ struct StatisticsView: View {
@EnvironmentObject var dateHolder: DateHolder

var body: some View {

VStack {
VStack {
DateScrollView()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="20086" systemVersion="21C52" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
<entity name="Product" representedClassName="Product" syncable="YES">
<attribute name="cleanedUpDay" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
<attribute name="cleaningDay" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
<attribute name="isCleanedUp" optional="YES" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
<attribute name="memo" optional="YES" attributeType="String"/>
<attribute name="photo" optional="YES" attributeType="Binary"/>
<attribute name="title" optional="YES" attributeType="String"/>
</entity>
<elements>
<element name="Product" positionX="-63" positionY="-18" width="128" height="104"/>
<element name="Product" positionX="-63" positionY="-18" width="128" height="119"/>
</elements>
</model>
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class ProductListViewController: UIViewController {
}
let updatedItem = productList[index]
updatedItem.isCleanedUp = true
updatedItem.cleanedUpDay = Date()
completion()
do {
try viewContext.save()
Expand Down

0 comments on commit 5361151

Please sign in to comment.