fix comments

This commit is contained in:
John Estropia
2020-04-15 16:49:45 +09:00
parent 4049e1944a
commit a7568eebdb
4 changed files with 33 additions and 12 deletions

View File

@@ -40,6 +40,15 @@ extension FieldContainer {
@Field.Coded("eyeColor", coder: FieldCoders.NSCoding.self)
var eyeColor: UIColor = .black
@Field.Coded(
"bloodType",
coder: {
encode: { $0.toData() },
decode: { BloodType(fromData: $0) }
}
)
var bloodType: BloodType = .unknown
}
```
- Important: `Field` properties are required to be used as `@propertyWrapper`s. Any other declaration not using the `@Field.Stored(...) var` syntax will be ignored.
@@ -94,8 +103,14 @@ extension FieldContainer {
```
class Person: CoreStoreObject {
@Field.Coded("eyeColor", coder: FieldCoders.NSCoding.self)
var eyeColor: UIColor = .black
@Field.Coded(
"bloodType",
coder: {
encode: { $0.toData() },
decode: { BloodType(fromData: $0) }
}
)
var bloodType: BloodType = .unknown
}
```
- parameter initial: the initial value for the property when the object is first created.
@@ -416,8 +431,14 @@ extension FieldContainer.Coded where V: FieldOptionalType {
```
class Person: CoreStoreObject {
@Field.Coded("eyeColor", coder: FieldCoders.NSCoding.self)
var eyeColor: UIColor? = nil
@Field.Coded(
"bloodType",
coder: {
encode: { $0.toData() },
decode: { BloodType(fromData: $0) }
}
)
var bloodType: BloodType?
}
```
- parameter initial: the initial value for the property when the object is first created.

View File

@@ -36,7 +36,7 @@ extension FieldContainer {
/**
The containing type for stored property values. Any type that conforms to `FieldStorableType` are supported.
```
class Animal: CoreStoreObject {
class Person: CoreStoreObject {
@Field.Stored("title")
var title: String = "Mr."