-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
creates a record for the current date when a task is completed
- Loading branch information
Showing
3 changed files
with
45 additions
and
3 deletions.
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
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,28 @@ | ||
// | ||
// CoreDataRecords.swift | ||
// DLPrototype | ||
// | ||
// Created by Ryan Priebe on 2023-01-13. | ||
// Copyright © 2023 YegCollective. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import SwiftUI | ||
|
||
public class CoreDataRecords { | ||
public var moc: NSManagedObjectContext? | ||
|
||
public init(moc: NSManagedObjectContext?) { | ||
self.moc = moc | ||
} | ||
|
||
public func createWithJob(job: Job, date: Date, text: String) -> Void { | ||
let record = LogRecord(context: moc!) | ||
record.timestamp = date | ||
record.message = text | ||
record.id = UUID() | ||
record.job = job | ||
|
||
PersistenceController.shared.save() | ||
} | ||
} |
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