From e7205048559e839f4b428f732bde6c056a572fb1 Mon Sep 17 00:00:00 2001 From: John Estropia Date: Sat, 20 Jun 2020 17:37:12 +0900 Subject: [PATCH] Update README.md --- README.md | 156 +++++++++++++++++++++++++++--------------------------- 1 file changed, 78 insertions(+), 78 deletions(-) diff --git a/README.md b/README.md index 522918c4..af133f04 100644 --- a/README.md +++ b/README.md @@ -88,18 +88,18 @@ CoreStore was (and is) heavily shaped by real-world needs of developing data-dep - [Logging and error reporting](#logging-and-error-reporting) - [Observing changes and notifications](#observing-changes-and-notifications) - [Observe a single property](#observe-a-single-property) - - 🆕[Observe a single object's updates](#observe-a-single-objects-updates) + - [Observe a single object's updates](#observe-a-single-objects-updates) - [Observe a single object's per-property updates](#observe-a-single-objects-per-property-updates) - - 🆕[Observe a diffable list](#observe-a-diffable-list) + - [Observe a diffable list](#observe-a-diffable-list) - [Observe detailed list changes](#observe-detailed-list-changes) - [Objective-C support](#objective-c-support) - [Type-safe `CoreStoreObject`s](#type-safe-corestoreobjects) - - [New `@Field` Property Wrapper syntax](#new-field-property-wrapper-syntax) - - [`@Field.Stored` ](#fieldstored) - - [`@Field.Virtual` ](#fieldvirtual) - - [`@Field.Coded` ](#fieldcoded) - - [`@Field.Relationship` ](#fieldrelationship) - - [`@Field` usage notes](#field-usage-notes) + - 🆕[New `@Field` Property Wrapper syntax](#new-field-property-wrapper-syntax) + - 🆕[`@Field.Stored` ](#fieldstored) + - 🆕[`@Field.Virtual` ](#fieldvirtual) + - 🆕[`@Field.Coded` ](#fieldcoded) + - 🆕[`@Field.Relationship` ](#fieldrelationship) + - 🆕[`@Field` usage notes](#field-usage-notes) - [`VersionLock`s](#versionlocks) - [Roadmap](#roadmap) - [Installation](#installation) @@ -1817,21 +1817,21 @@ The `@Field.Stored` property wrapper is used for persisted value types. This is Before`@Field.Stored`
-    class Person: CoreStoreObject {
-
-        let title = Value.Required("title", initial: "Mr.")
-        let nickname = Value.Optional("nickname")
-    }
+class Person: CoreStoreObject {
+    
+ let title = Value.Required("title", initial: "Mr.") + let nickname = Value.Optional("nickname") +}
-    class Person: CoreStoreObject {
-
-        @Field.Stored("title")
-        var title: String = "Mr."
-
-        @Field.Stored("nickname")
-        var nickname: String?
-    }
+class Person: CoreStoreObject {
+    
+ @Field.Stored("title") + var title: String = "Mr." +
+ @Field.Stored("nickname") + var nickname: String? +}
@@ -1848,36 +1848,36 @@ The `@Field.Virtual` property wrapper is used for unsaved, computed value types. Before`@Field.Virtual`
-    class Animal: CoreStoreObject {
-
-        let speciesPlural = Value.Required(
-            "speciesPlural",
-            transient: true,
-            customGetter: Animal.getSpeciesPlural(_:)
-        )
-        
-        let species = Value.Required("species", initial: "")
-        
-        static func getSpeciesPlural(_ partialObject: PartialObject) -> String? {
-            let species = partialObject.value(for: { $0.species })
-            return species + "s"
-        }
+class Animal: CoreStoreObject {
+    
+ let speciesPlural = Value.Required( + "speciesPlural", + transient: true, + customGetter: Animal.getSpeciesPlural(_:) + ) +
+ let species = Value.Required("species", initial: "") +
+ static func getSpeciesPlural(_ partialObject: PartialObject) -> String? { + let species = partialObject.value(for: { $0.species }) + return species + "s" } +}
-    class Animal: CoreStoreObject {
-
-        @Field.Virtual(
-            "speciesPlural",
-            customGetter: { (object, field) in
-                return object.$species.value + "s"
-            }
-        )
-        var speciesPlural: String
-
-        @Field.Stored("species")
-        var species: String = ""
-    }
+class Animal: CoreStoreObject {
+    
+ @Field.Virtual( + "speciesPlural", + customGetter: { (object, field) in + return object.$species.value + "s" + } + ) + var speciesPlural: String +
+ @Field.Stored("species") + var species: String = "" +}
@@ -1896,17 +1896,17 @@ The `@Field.Coded` property wrapper is used for binary-codable values. This is t Before`@Field.Coded`
-    class Vehicle: CoreStoreObject {
-
-        let color = Transformable.Optional("color", initial: .white)
-    }
+class Vehicle: CoreStoreObject {
+    
+ let color = Transformable.Optional("color", initial: .white) +}
-    class Vehicle: CoreStoreObject {
-
-        @Field.Coded("color", coder: FieldCoders.NSCoding.self)
-        var color: UIColor? = .white
-    }
+class Vehicle: CoreStoreObject {
+    
+ @Field.Coded("color", coder: FieldCoders.NSCoding.self) + var color: UIColor? = .white +}
@@ -1914,14 +1914,14 @@ The `@Field.Coded` property wrapper is used for binary-codable values. This is t Built-in encoders such as `FieldCoders.NSCoding`, `FieldCoders.Json`, and `FieldCoders.Plist` are available, and custom encoding/decoding is also supported: ```swift class Person: CoreStoreObject { - +
struct CustomInfo: Codable { // ... } - +
@Field.Coded("otherInfo", coder: FieldCoders.Json.self) var otherInfo: CustomInfo? - +
@Field.Coded( "photo", coder: { @@ -1949,26 +1949,26 @@ The type of relationship is determined by the `@Field.Relationship` generic typ Before`@Field.Stored`
-    class Pet: CoreStoreObject {
-
-        let master = Relationship.ToOne("master")
-    }
-    class Person: CoreStoreObject {
-
-        let pets: Relationship.ToManyUnordered("pets", inverse: \.$master)
-    }
+class Pet: CoreStoreObject {
+    
+ let master = Relationship.ToOne("master") +} +class Person: CoreStoreObject { +
+ let pets: Relationship.ToManyUnordered("pets", inverse: \.$master) +}
-    class Pet: CoreStoreObject {
-
-        @Field.Relationship("master")
-        var master: Person?
-    }
-    class Person: CoreStoreObject {
-
-        @Field.Relationship("pets", inverse: \.$master)
-        var pets: Set
-    }
+class Pet: CoreStoreObject {
+    
+ @Field.Relationship("master") + var master: Person? +} +class Person: CoreStoreObject { +
+ @Field.Relationship("pets", inverse: \.$master) + var pets: Set +}