mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-03-27 03:41:29 +01:00
WIP: docs
This commit is contained in:
@@ -34,7 +34,6 @@ extension FieldContainer {
|
|||||||
// MARK: - Relationship
|
// MARK: - Relationship
|
||||||
|
|
||||||
@propertyWrapper
|
@propertyWrapper
|
||||||
// @dynamicMemberLookup
|
|
||||||
public struct Relationship<V: FieldRelationshipType>: RelationshipKeyPathStringConvertible, FieldRelationshipProtocol {
|
public struct Relationship<V: FieldRelationshipType>: RelationshipKeyPathStringConvertible, FieldRelationshipProtocol {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -40,11 +40,8 @@ extension FieldContainer {
|
|||||||
@Field.Stored("species")
|
@Field.Stored("species")
|
||||||
var species = ""
|
var species = ""
|
||||||
|
|
||||||
@Field.Virtual("pluralName", customGetter: Animal.pluralName(_:))
|
@Field.Stored("nickname")
|
||||||
var pluralName: String = ""
|
var nickname: String?
|
||||||
|
|
||||||
@Field.Coded("color", coder: FieldCoders.Plist.self)
|
|
||||||
var color: UIColor?
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
- Important: `Field` properties are required to be used as `@propertyWrapper`s. Any other declaration not using the `@Field.Stored(...) var` syntax will be ignored.
|
- Important: `Field` properties are required to be used as `@propertyWrapper`s. Any other declaration not using the `@Field.Stored(...) var` syntax will be ignored.
|
||||||
|
|||||||
@@ -32,9 +32,9 @@ import Foundation
|
|||||||
extension DynamicObject where Self: CoreStoreObject {
|
extension DynamicObject where Self: CoreStoreObject {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The containing type for value propertiess. `Field` properties support any type that conforms to `ImportableAttributeType`.
|
The containing type for value propertiess.
|
||||||
```
|
```
|
||||||
class Animal: CoreStoreObject {
|
class Pet: CoreStoreObject {
|
||||||
@Field.Stored("species")
|
@Field.Stored("species")
|
||||||
var species = ""
|
var species = ""
|
||||||
|
|
||||||
@@ -42,10 +42,19 @@ extension DynamicObject where Self: CoreStoreObject {
|
|||||||
var nickname: String?
|
var nickname: String?
|
||||||
|
|
||||||
@Field.Coded("color", coder: FieldCoders.Plist.self)
|
@Field.Coded("color", coder: FieldCoders.Plist.self)
|
||||||
var color: UIColor?
|
var eyeColor: UIColor?
|
||||||
|
|
||||||
|
@Field.Relationship("owner", inverse: \.$pets)
|
||||||
|
var owner: Person?
|
||||||
|
|
||||||
|
@Field.Relationship("children")
|
||||||
|
var children: Array<Pet>
|
||||||
|
|
||||||
|
@Field.Relationship("parents", inverse: \.$children)
|
||||||
|
var parents: Set<Pet>
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
- Important: `Field` properties are required to be used as `@propertyWrapper`s. Any other declaration not using the `@Field.*(...) var` syntax will be ignored.
|
- Important: `Field` properties are required to be used as `@propertyWrapper`s. Any other declaration not using the `@Field.*(...) var` syntax will result in undefined behavior.
|
||||||
*/
|
*/
|
||||||
public typealias Field = FieldContainer<Self>
|
public typealias Field = FieldContainer<Self>
|
||||||
}
|
}
|
||||||
@@ -54,9 +63,9 @@ extension DynamicObject where Self: CoreStoreObject {
|
|||||||
// MARK: - FieldContainer
|
// MARK: - FieldContainer
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The containing type for value properties. Use the `DynamicObject.Field` typealias instead for shorter syntax.
|
The containing type for value properties. Use the `Field` typealias instead for shorter syntax.
|
||||||
```
|
```
|
||||||
class Animal: CoreStoreObject {
|
class Pet: CoreStoreObject {
|
||||||
@Field.Stored("species")
|
@Field.Stored("species")
|
||||||
var species = ""
|
var species = ""
|
||||||
|
|
||||||
@@ -64,7 +73,16 @@ extension DynamicObject where Self: CoreStoreObject {
|
|||||||
var nickname: String?
|
var nickname: String?
|
||||||
|
|
||||||
@Field.Coded("color", coder: FieldCoders.Plist.self)
|
@Field.Coded("color", coder: FieldCoders.Plist.self)
|
||||||
var color: UIColor?
|
var eyeColor: UIColor?
|
||||||
|
|
||||||
|
@Field.Relationship("owner", inverse: \.$pets)
|
||||||
|
var owner: Person?
|
||||||
|
|
||||||
|
@Field.Relationship("children")
|
||||||
|
var children: Array<Pet>
|
||||||
|
|
||||||
|
@Field.Relationship("parents", inverse: \.$children)
|
||||||
|
var parents: Set<Pet>
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user