Deprecation of legacy ValueContainer and RelationshipContainer properties in favor of @Field propertyWrapper counterpart

This commit is contained in:
John Estropia
2024-01-28 22:11:21 +09:00
parent 4b6d9a54e7
commit 7c2129e38f
38 changed files with 936 additions and 2861 deletions

View File

@@ -296,12 +296,6 @@ public enum SelectTerm<O: DynamicObject>: ExpressibleByStringLiteral, Hashable {
case ._identity(let alias, _): return alias
}
}
// MARK: Deprecated
@available(*, deprecated, renamed: "O")
public typealias D = O
}
@@ -611,12 +605,6 @@ public struct Select<O: DynamicObject, T: SelectResultType>: SelectClause, Hasha
fetchRequest.propertiesToFetch = propertiesToFetch
}
// MARK: Deprecated
@available(*, deprecated, renamed: "O")
public typealias D = O
}
extension Select where T: NSManagedObjectID {
@@ -642,48 +630,6 @@ extension Select where O: NSManagedObject {
}
}
extension Select where O: CoreStoreObject, T: ImportableAttributeType {
/**
Initializes a `Select` that queries the value of an attribute pertained by a keyPath
- parameter keyPath: the keyPath for the attribute
*/
public init(_ keyPath: KeyPath<O, ValueContainer<O>.Required<T>>) {
self.init(.attribute(keyPath))
}
/**
Initializes a `Select` that queries the value of an attribute pertained by a keyPath
- parameter keyPath: the keyPath for the attribute
*/
public init(_ keyPath: KeyPath<O, ValueContainer<O>.Optional<T>>) {
self.init(.attribute(keyPath))
}
}
extension Select where O: CoreStoreObject, T: ImportableAttributeType & NSCoding & NSCopying {
/**
Initializes a `Select` that queries the value of an attribute pertained by a keyPath
- parameter keyPath: the keyPath for the attribute
*/
public init(_ keyPath: KeyPath<O, TransformableContainer<O>.Required<T>>) {
self.init(.attribute(keyPath))
}
/**
Initializes a `Select` that queries the value of an attribute pertained by a keyPath
- parameter keyPath: the keyPath for the attribute
*/
public init(_ keyPath: KeyPath<O, TransformableContainer<O>.Optional<T>>) {
self.init(.attribute(keyPath))
}
}
// MARK: - SelectClause
@@ -720,3 +666,38 @@ extension NSDictionary: SelectAttributesResultType {
return result as! [[String: Any]]
}
}
// MARK: - Deprecated
@available(*, deprecated, message: """
Legacy `Value.*`, `Transformable.*`, and `Relationship.*` declarations will soon be obsoleted. Please migrate your models and stores to new models that use `@Field.*` property wrappers. See: https://github.com/JohnEstropia/CoreStore?tab=readme-ov-file#new-field-property-wrapper-syntax
""")
extension Select where O: CoreStoreObject, T: ImportableAttributeType {
public init(_ keyPath: KeyPath<O, ValueContainer<O>.Required<T>>) {
self.init(.attribute(keyPath))
}
public init(_ keyPath: KeyPath<O, ValueContainer<O>.Optional<T>>) {
self.init(.attribute(keyPath))
}
}
@available(*, deprecated, message: """
Legacy `Value.*`, `Transformable.*`, and `Relationship.*` declarations will soon be obsoleted. Please migrate your models and stores to new models that use `@Field.*` property wrappers. See: https://github.com/JohnEstropia/CoreStore?tab=readme-ov-file#new-field-property-wrapper-syntax
""")
extension Select where O: CoreStoreObject, T: ImportableAttributeType & NSCoding & NSCopying {
public init(_ keyPath: KeyPath<O, TransformableContainer<O>.Required<T>>) {
self.init(.attribute(keyPath))
}
public init(_ keyPath: KeyPath<O, TransformableContainer<O>.Optional<T>>) {
self.init(.attribute(keyPath))
}
}