mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-04-10 19:26:51 +02:00
cleanup
This commit is contained in:
@@ -290,19 +290,6 @@ class DynamicModelTests: BaseTestDataTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// #if swift(>=5.1)
|
|
||||||
//
|
|
||||||
// let dogKeyPathBuilder = Dog.keyPathBuilder()
|
|
||||||
// XCTAssertEqual(dogKeyPathBuilder.species.keyPathString, "SELF.species")
|
|
||||||
// XCTAssertEqual(dogKeyPathBuilder.master.title.keyPathString, "SELF.master.title")
|
|
||||||
// let a = dogKeyPathBuilder.master
|
|
||||||
// let b = dogKeyPathBuilder.master.spouse
|
|
||||||
// let c = dogKeyPathBuilder.master.spouse.pets
|
|
||||||
// let d = dogKeyPathBuilder.master.spouse.pets.color
|
|
||||||
// XCTAssertEqual(dogKeyPathBuilder.master.spouse.pets.color.keyPathString, "SELF.master.spouse.pets.color")
|
|
||||||
//
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
let didSetObserver = dog.observe(\.$species, options: [.new, .old]) { (object, change) in
|
let didSetObserver = dog.observe(\.$species, options: [.new, .old]) { (object, change) in
|
||||||
|
|
||||||
XCTAssertEqual(object, dog)
|
XCTAssertEqual(object, dog)
|
||||||
|
|||||||
@@ -77,17 +77,10 @@ final class WhereTests: XCTestCase {
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
|
|
||||||
// let keyPathBuilder = TestEntity1.keyPathBuilder()
|
|
||||||
|
|
||||||
// let kp = \TestEntity1.testToOne
|
|
||||||
// print(keyPathBuilder.testString)
|
|
||||||
// print(keyPathBuilder.testToOne)
|
|
||||||
// print(keyPathBuilder.testToOne.testEntityID)
|
|
||||||
XCTAssertAllEqual(
|
XCTAssertAllEqual(
|
||||||
#keyPath(TestEntity1.testToOne.testEntityID),
|
#keyPath(TestEntity1.testToOne.testEntityID),
|
||||||
(\TestEntity1.testToOne ~ \.testEntityID).description,
|
(\TestEntity1.testToOne ~ \.testEntityID).description,
|
||||||
String(keyPath: \TestEntity1.testToOne ~ \.testEntityID)
|
String(keyPath: \TestEntity1.testToOne ~ \.testEntityID)
|
||||||
// keyPathBuilder.testToOne.testEntityID.keyPathString
|
|
||||||
)
|
)
|
||||||
XCTAssertAllEqual(
|
XCTAssertAllEqual(
|
||||||
#keyPath(TestEntity1.testToOne.testToOne.testToManyUnordered),
|
#keyPath(TestEntity1.testToOne.testToOne.testToManyUnordered),
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
import CoreStore
|
import CoreStore
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
|
|
||||||
// MARK: - Modern.ColorsDemo.SwiftUI
|
// MARK: - Modern.ColorsDemo.SwiftUI
|
||||||
|
|
||||||
extension Modern.ColorsDemo.SwiftUI {
|
extension Modern.ColorsDemo.SwiftUI {
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ extension EnvironmentValues {
|
|||||||
var dataStack: DataStack
|
var dataStack: DataStack
|
||||||
```
|
```
|
||||||
*/
|
*/
|
||||||
@available(*, unavailable, message: "Removed due to being prone to mis-initialization. Please pass your DataStack instance directly, or inject using a method with more deterministic timing.")
|
|
||||||
public var dataStack: DataStack {
|
public var dataStack: DataStack {
|
||||||
|
|
||||||
get {
|
get {
|
||||||
|
|||||||
@@ -449,20 +449,18 @@ extension ObjectPublisher where O: NSManagedObject {
|
|||||||
/**
|
/**
|
||||||
Returns the value for the property identified by a given key.
|
Returns the value for the property identified by a given key.
|
||||||
*/
|
*/
|
||||||
@available(*, unavailable, message: "KeyPaths accessed from @dynamicMemberLookup types can't generate KVC keys yet (https://bugs.swift.org/browse/SR-11351)")
|
public subscript<V: AllowedObjectiveCKeyPathValue>(dynamicMember member: KeyPath<O, V>) -> V! {
|
||||||
public subscript<V: AllowedObjectiveCKeyPathValue>(dynamicMember member: KeyPath<O, V>) -> V {
|
|
||||||
|
|
||||||
fatalError()
|
return self.snapshot?[dynamicMember: member]
|
||||||
// return self.snapshot[dynamicMember: member]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
Returns the value for the property identified by a given key.
|
// MARK: Deprecated
|
||||||
*/
|
|
||||||
|
@available(*, deprecated, message: "Accessing the property directly now works")
|
||||||
public func value<V: AllowedObjectiveCKeyPathValue>(forKeyPath keyPath: KeyPath<O, V>) -> V! {
|
public func value<V: AllowedObjectiveCKeyPathValue>(forKeyPath keyPath: KeyPath<O, V>) -> V! {
|
||||||
|
|
||||||
let key = String(keyPath: keyPath)
|
return self[dynamicMember: keyPath]
|
||||||
return self.snapshot?.dictionaryForValues()[key] as! V?
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -144,29 +144,33 @@ extension ObjectSnapshot where O: NSManagedObject {
|
|||||||
/**
|
/**
|
||||||
Returns the value for the property identified by a given key.
|
Returns the value for the property identified by a given key.
|
||||||
*/
|
*/
|
||||||
@available(*, unavailable, message: "KeyPaths accessed from @dynamicMemberLookup types can't generate KVC keys yet (https://bugs.swift.org/browse/SR-11351)")
|
public subscript<V: AllowedObjectiveCKeyPathValue>(dynamicMember member: KeyPath<O, V>) -> V! {
|
||||||
public subscript<V: AllowedObjectiveCKeyPathValue>(dynamicMember member: KeyPath<O, V>) -> V {
|
|
||||||
|
|
||||||
let key = String(keyPath: member)
|
get {
|
||||||
return self.values[key] as! V
|
|
||||||
|
let key = String(keyPath: member)
|
||||||
|
return self.values[key] as! V?
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
|
||||||
|
let key = String(keyPath: member)
|
||||||
|
self.values[key] = newValue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
Returns the value for the property identified by a given key.
|
// MARK: Deprecated
|
||||||
*/
|
|
||||||
|
@available(*, deprecated, message: "Accessing the property directly now works")
|
||||||
public func value<V: AllowedObjectiveCKeyPathValue>(forKeyPath keyPath: KeyPath<O, V>) -> V! {
|
public func value<V: AllowedObjectiveCKeyPathValue>(forKeyPath keyPath: KeyPath<O, V>) -> V! {
|
||||||
|
|
||||||
let key = String(keyPath: keyPath)
|
return self[dynamicMember: keyPath]
|
||||||
return self.values[key] as! V?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@available(*, deprecated, message: "Mutating the property directly now works")
|
||||||
Mutates the value for the property identified by a given key.
|
|
||||||
*/
|
|
||||||
public mutating func setValue<V: AllowedObjectiveCKeyPathValue>(_ value: V!, forKeyPath keyPath: KeyPath<O, V>) {
|
public mutating func setValue<V: AllowedObjectiveCKeyPathValue>(_ value: V!, forKeyPath keyPath: KeyPath<O, V>) {
|
||||||
|
|
||||||
let key = String(keyPath: keyPath)
|
self[dynamicMember: keyPath] = value
|
||||||
self.values[key] = value
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user