-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix custom to fully support Codable protocol when using SwiftData #5
base: main
Are you sure you want to change the base?
Conversation
Fixes certain crashes when using NaiveDate/Time with SwiftData.
Hi @kean and @liamnichols! Any chance of getting this merged in? This fixes some intermittent crashes we encountered when persisting NaiveDate objects with SwiftData. 🙏 |
} | ||
|
||
public func encode(to encoder: Encoder) throws { | ||
try _encode(self, to: encoder) | ||
if String(describing: encoder) == "SwiftData.CompositeEncoder" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to implement it without hardcoding "SwiftData.CompositeEncoder"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question, I didn't have a time to find a way just yet
Hey, sure, let me look into it. Do you what's the root cause of the crash? |
Is this really needed? Wouldn’t it make more sense to make the NaiveDate |
Fixes certain crashes when using NaiveDate/Time with SwiftData.