mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-09 06:43:25 +01:00
- Multiple fixes and CI setup
This commit is contained in:
40
AltStoreCore/Model/Patreon/ManagedPatron.swift
Normal file
40
AltStoreCore/Model/Patreon/ManagedPatron.swift
Normal file
@@ -0,0 +1,40 @@
|
||||
//
|
||||
// ManagedPatron.swift
|
||||
// AltStoreCore
|
||||
//
|
||||
// Created by Riley Testut on 4/18/22.
|
||||
// Copyright © 2022 Riley Testut. All rights reserved.
|
||||
//
|
||||
|
||||
import CoreData
|
||||
|
||||
@objc(ManagedPatron)
|
||||
public class ManagedPatron: BaseEntity
|
||||
{
|
||||
@NSManaged public var name: String
|
||||
@NSManaged public var identifier: String
|
||||
|
||||
private override init(entity: NSEntityDescription, insertInto context: NSManagedObjectContext?)
|
||||
{
|
||||
super.init(entity: entity, insertInto: context)
|
||||
}
|
||||
|
||||
public init?(patron: PatreonAPI.Patron, context: NSManagedObjectContext)
|
||||
{
|
||||
// Only cache Patrons with non-nil names.
|
||||
guard let name = patron.name else { return nil }
|
||||
|
||||
super.init(entity: ManagedPatron.entity(), insertInto: context)
|
||||
|
||||
self.name = name
|
||||
self.identifier = patron.identifier
|
||||
}
|
||||
}
|
||||
|
||||
public extension ManagedPatron
|
||||
{
|
||||
@nonobjc class func fetchRequest() -> NSFetchRequest<ManagedPatron>
|
||||
{
|
||||
return NSFetchRequest<ManagedPatron>(entityName: "Patron")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user