Skip to content

Commit

Permalink
De-deprecate inits
Browse files Browse the repository at this point in the history
...
  • Loading branch information
helje5 committed Oct 7, 2023
1 parent 8ad436c commit 28b65a0
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ extension ModelMacro {
/// - Parameters:
// - entity: An `NSEntityDescription` describing the object.
// - context: An `NSManagedObjectContext` the object should be inserted into.
@available(*, deprecated, renamed: "init(context:)",
message: "Use `init(context:)` or `init()` instead.")
\(raw: access)override init(entity: CoreData.NSEntityDescription, insertInto context: NSManagedObjectContext?)
{
super.init(entity: entity, insertInto: context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ public extension NSManagedObjectModel {
// - encodingVersion
// - version

@available(*, deprecated, renamed: "model(for:)", message:
"""
Entities can only be used in one NSManagedObjectModel, use the `model(for:)`
static function to get access to s ahred, cached model.
"""
)
@inlinable
convenience init(_ entities: NSEntityDescription...,
version: Schema.Version = Version(1, 0, 0))
Expand All @@ -25,25 +19,13 @@ public extension NSManagedObjectModel {
self.entities = entities
}

@available(*, deprecated, renamed: "model(for:)", message:
"""
Entities can only be used in one NSManagedObjectModel, use the `model(for:)`
static function to get access to s ahred, cached model.
"""
)
convenience init(_ types: [ any PersistentModel.Type ],
version: Schema.Version = Version(1, 0, 0))
{
self.init()
self.entities = SchemaBuilder.shared.lookupAllEntities(for: types)
}

@available(*, deprecated, renamed: "model(for:)", message:
"""
Entities can only be used in one NSManagedObjectModel, use the `model(for:)`
static function to get access to s ahred, cached model.
"""
)
@inlinable
convenience init(versionedSchema: any VersionedSchema.Type) {
self.init(versionedSchema.models,
Expand All @@ -59,6 +41,7 @@ private var map = [ Set<ObjectIdentifier> : NSManagedObjectModel ]()

public extension NSManagedObjectModel {

/// A cached version of the initializer.
static func model(for versionedSchema: VersionedSchema.Type)
-> NSManagedObjectModel
{
Expand Down

0 comments on commit 28b65a0

Please sign in to comment.