Tusker/Tusker/CoreData/SavedInstance.swift

35 lines
842 B
Swift

//
// SavedInstance.swift
// Tusker
//
// Created by Shadowfacts on 5/8/22.
// Copyright © 2022 Shadowfacts. All rights reserved.
//
import Foundation
import CoreData
@objc(SavedInstance)
public final class SavedInstance: NSManagedObject {
@nonobjc public class func fetchRequest() -> NSFetchRequest<SavedInstance> {
return NSFetchRequest<SavedInstance>(entityName: "SavedInstance")
}
@nonobjc public class func fetchRequest(url: URL) -> NSFetchRequest<SavedInstance> {
let req = fetchRequest()
req.predicate = NSPredicate(format: "url = %@", url as NSURL)
return req
}
@NSManaged public var url: URL
}
extension SavedInstance {
convenience init(url: URL, context: NSManagedObjectContext) {
self.init(context: context)
self.url = url
}
}