You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
JustOneThing/Model/PersistentThingExtension.swift

23 lines
510 B

//
// PersistentThingExtension.swift
// JustOneThing
//
// Created by Alan Francis on 15/07/2023.
//
import CoreData
extension PersistentThing {
var asThing: Thing {
get {
Thing(text: self.text ?? "[no text]",
createdAt: self.createdAt ?? Date.distantPast)
}
}
static var request: NSFetchRequest<PersistentThing> {
get {
return NSFetchRequest<PersistentThing>(entityName: PersistentThing.entity().name!)
}
}
}