WIP: docs

This commit is contained in:
John Estropia
2020-03-25 14:21:49 +09:00
parent 231e138ab0
commit 0d9299f900
3 changed files with 27 additions and 13 deletions

View File

@@ -34,7 +34,6 @@ extension FieldContainer {
// MARK: - Relationship
@propertyWrapper
// @dynamicMemberLookup
public struct Relationship<V: FieldRelationshipType>: RelationshipKeyPathStringConvertible, FieldRelationshipProtocol {
/**

View File

@@ -40,11 +40,8 @@ extension FieldContainer {
@Field.Stored("species")
var species = ""
@Field.Virtual("pluralName", customGetter: Animal.pluralName(_:))
var pluralName: String = ""
@Field.Coded("color", coder: FieldCoders.Plist.self)
var color: UIColor?
@Field.Stored("nickname")
var nickname: String?
}
```
- Important: `Field` properties are required to be used as `@propertyWrapper`s. Any other declaration not using the `@Field.Stored(...) var` syntax will be ignored.

View File

@@ -32,9 +32,9 @@ import Foundation
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")
var species = ""
@@ -42,10 +42,19 @@ extension DynamicObject where Self: CoreStoreObject {
var nickname: String?
@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>
}
@@ -54,9 +63,9 @@ extension DynamicObject where Self: CoreStoreObject {
// 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")
var species = ""
@@ -64,7 +73,16 @@ extension DynamicObject where Self: CoreStoreObject {
var nickname: String?
@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>
}
```
*/