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

@@ -27,46 +27,21 @@ import CoreData
import Foundation
// MARK: - DynamicObject
// MARK: - Deprecated
extension DynamicObject where Self: CoreStoreObject {
/**
The containing type for relationships. `Relationship`s can be any `CoreStoreObject` subclass.
```
class Dog: CoreStoreObject {
let master = Relationship.ToOne<Person>("master")
}
class Person: CoreStoreObject {
let pets = Relationship.ToManyUnordered<Dog>("pets", inverse: { $0.master })
}
```
- Important: `Relationship` properties are required to be stored properties. Computed properties will be ignored, including `lazy` and `weak` properties.
*/
@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
""")
public typealias Relationship = RelationshipContainer<Self>
}
// MARK: - RelationshipContainer
/**
The containing type for relationships. Use the `DynamicObject.Relationship` typealias instead for shorter syntax.
```
class Dog: CoreStoreObject {
let master = Relationship.ToOne<Person>("master")
}
class Person: CoreStoreObject {
let pets = Relationship.ToManyUnordered<Dog>("pets", inverse: { $0.master })
}
```
*/
@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
""")
public enum RelationshipContainer<O: CoreStoreObject> {
// MARK: - DeleteRule
/**
These constants define what happens to relationships when an object is deleted.
*/
public enum DeleteRule {
// MARK: Public