-
Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 8 replies
-
Hello @kentaroi, It was removed when We could reintroduce May I ask if you have considered some alternatives?
On the last bullet, I'm constantly using struct Player { ... }
// Updates the database if and only if `player` was modified:
var player: Player = ...
player.updateChanges(db) {
$0.score = 1000
}
print(player.score) // 1000 This method alone has completely removed my own needs for self-comparing records. |
Beta Was this translation helpful? Give feedback.
-
Thank you very much for your quick response, @groue!! I’ve implemented some records both ways, with However, as you know, when structs are complicated, they can be cumbersome. struct A {
var name: String = “A” {
didSet {
print(“A.name is updated”)
}
}
}
struct B {
var a: A = A() {
didSet {
print(“B.a is updated”)
}
}
}
struct C {
var b: B = B() {
print(“C.b is updated”)
}
}
var c = C()
c.b.a.name = “a” If you execute the above code, you will see the following output:
instead of Therefore, I think I don't think structs and protocols of GRDB have any problems, but sometimes I'd like to use classes for some purposes in Swift in general especially when handling hierarchical objects. Is it possible to make |
Beta Was this translation helpful? Give feedback.
Ouch. I can't tell when the next version of GRDB will ship that will provide
copy
or any other API that fulfill your needs.So, here are a few possible recommendations that will unblock you:
resetDatabaseChanges()
public, and wait for the next release. 🤓