Post

Replies

Boosts

Views

Activity

Comment on Decoding JSON coming from MySQL via PHP to a complex Struct in SwiftUI
Hi @OOPer, thanks for your answer and explanation. I've tried it and it seems to be better, but now I get a similar error on the amount member: JSON-Error: typeMismatch(Swift.Double, Swift.DecodingError.Context(codingPath: [_JSONKey(stringValue: "Index 0", intValue: 0), CodingKeys(stringValue: "datapoints", intValue: nil), _JSONKey(stringValue: "Index 0", intValue: 0), CodingKeys(stringValue: "amount", intValue: nil)], debugDescription: "Expected to decode Double but found a string/data instead.", underlyingError: nil))
Jan ’22
Comment on Freshly inserted data through REST-request only displayed after reopening the view
Thanks for your very fast reply. I use the DataService as @StateObject which gets/puts data via REST and also sets observed objects like sortedDatapoints and so on. So in my thinking the data should be ready and synced and the view should be refreshed due to the meanwhile reassigned variables inside the @StateObject of DataService, but it doesn't seem to be the case... I don't really get all these different data dependencies, as this is my first project, so I use it as I understand.
Nov ’22
Comment on Freshly inserted data through REST-request only displayed after reopening the view
I watched the video. If I didn‘t misunderstand, the way I built everything should conform to the way it‘s meant to be; I have DataService at a pretty high-level in the hierarchy which is an ObservableObject (source of truth), having properties that are Published. On the respective views I reference DataService as a whole as StateObject (only referencing the SOT, not creating a view-local copy of it). Could you confirm my understanding comparing my code, or do I miss something?
Nov ’22