-
Notifications
You must be signed in to change notification settings - Fork 7
Can we support Swift arrays ([]
) for toMany properties?
#2
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
Comments
The thing is done by SwiftData, it actually does map the array to setPrimitive(Set(newValue), forKey: xyz) Yes, The sole advantage is that it looks a little nicer and it can be initialised w/ a literal. This should be fixable by me w/o any hacks using the accessor info from you! |
I would love to hear reasoning for that from SwiftData members. If the property is an array and internally it's set then they likely do
BTW — I stopped using NSSet and add/remove methods that Xcode generates to manage that set sometime in 2018. I always use the above and treat it as any mutable set in Swift: call |
I think SwiftData currently doesn't even allow For the array I think they just wanted to allow this syntax to make it look nice, say:
But yes, it is very confusing and peopled trapped over that already. |
Works in 0.6.0 |
This would be nice to have:
Related to issue #1.
Maybe there is some hackish solution which swizzles NSArray to react like a set (override isKindOfClass and implement NSSet methods to please CoreData).
The text was updated successfully, but these errors were encountered: