From 543417744b7b5e16342be205479ce7311020411b Mon Sep 17 00:00:00 2001 From: Javier Cicchelli Date: Wed, 12 Apr 2023 14:48:27 +0200 Subject: [PATCH] Turned off the Location entity automatic code generation from the Model core data model in the Persistence library. --- .../Entities/Location+CoreDataClass.swift | 21 +++++++++++ .../Location+CoreDataProperties.swift | 36 +++++++++++++++++++ .../Locations.xcdatamodel/contents | 2 +- 3 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 Apps/Locations/Libraries/Sources/Persistence/Entities/Location+CoreDataClass.swift create mode 100644 Apps/Locations/Libraries/Sources/Persistence/Entities/Location+CoreDataProperties.swift diff --git a/Apps/Locations/Libraries/Sources/Persistence/Entities/Location+CoreDataClass.swift b/Apps/Locations/Libraries/Sources/Persistence/Entities/Location+CoreDataClass.swift new file mode 100644 index 0000000..2478f9e --- /dev/null +++ b/Apps/Locations/Libraries/Sources/Persistence/Entities/Location+CoreDataClass.swift @@ -0,0 +1,21 @@ +// +// Location+CoreDataClass.swift +// Locations +// +// Created by Javier Cicchelli on 12/04/2023. +// Copyright © 2023 Röck+Cöde. All rights reserved. +// +// + +import Foundation +import CoreData + +@objc(Location) +public class Location: NSManagedObject { + convenience init(context: NSManagedObjectContext) { + self.init( + entity: .entity(forEntityName: "Location", in: context)!, + insertInto: context + ) + } +} diff --git a/Apps/Locations/Libraries/Sources/Persistence/Entities/Location+CoreDataProperties.swift b/Apps/Locations/Libraries/Sources/Persistence/Entities/Location+CoreDataProperties.swift new file mode 100644 index 0000000..e7776ee --- /dev/null +++ b/Apps/Locations/Libraries/Sources/Persistence/Entities/Location+CoreDataProperties.swift @@ -0,0 +1,36 @@ +// +// Location+CoreDataProperties.swift +// Locations +// +// Created by Javier Cicchelli on 12/04/2023. +// Copyright © 2023 Röck+Cöde. All rights reserved. +// +// + +import Foundation +import CoreData + +extension Location { + + @nonobjc public class func fetchRequest() -> NSFetchRequest { + return NSFetchRequest(entityName: "Location") + } + + @NSManaged public var createdAt: Date + @NSManaged public var latitude: Float + @NSManaged public var longitude: Float + @NSManaged public var name: String? + @NSManaged public var source: LocationSource + +} + +// MARK: - Identifiable + +extension Location: Identifiable {} + +// MARK: - Enumerations + +@objc public enum LocationSource: Int16 { + case remote = 0 + case local +} diff --git a/Apps/Locations/Libraries/Sources/Persistence/Model.xcdatamodeld/Locations.xcdatamodel/contents b/Apps/Locations/Libraries/Sources/Persistence/Model.xcdatamodeld/Locations.xcdatamodel/contents index bd27564..cae680f 100644 --- a/Apps/Locations/Libraries/Sources/Persistence/Model.xcdatamodeld/Locations.xcdatamodel/contents +++ b/Apps/Locations/Libraries/Sources/Persistence/Model.xcdatamodeld/Locations.xcdatamodel/contents @@ -1,6 +1,6 @@ - +