You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Calling -[User init] fails with the following exception: "No properties are defined for 'User'. Did you remember to mark them with '@objc' in your model?".
This happens both when using the legacy @objc syntax, as well as with the new @Persisted property wrappers.
IMO this should work, since there is a property here (the LinkingObjects, which apparently gets ignored by the "are there properties" check?)
class Note: Object {
@Persisted var user: User?
}
class User: Object {
@Persisted(originProperty: "user") var notes: LinkingObjects<Note>
}
I generally consider LinkingObjects as a 'computed property' that doesn't exist until called so it 'makes sense' why it's not seen as an actual property. However, it should still work without throwing an error.
That is correct - linking objects properties are computed and as such not part of the schema. That being said, having objects with no schema is supported by Realm and only prevented by the Swift SDK. While it'd be trivial to remove the check, I'm thinking it was probably added as a safeguard since it may have been a common mistake not to annotate your properties correctly and wonder why the data is not being persisted. I'll talk to the team and see what the best course of action is here.
How frequently does the bug occur?
Always
Description
Consider the following model:
Calling
-[User init]
fails with the following exception: "No properties are defined for 'User'. Did you remember to mark them with '@objc' in your model?".This happens both when using the legacy
@objc
syntax, as well as with the new@Persisted
property wrappers.IMO this should work, since there is a property here (the
LinkingObjects
, which apparently gets ignored by the "are there properties" check?)Stacktrace & log output
No response
Can you reproduce the bug?
Always
Reproduction Steps
No response
Version
10.44.0
What Atlas Services are you using?
Local Database only
Are you using encryption?
No
Platform OS and version(s)
macOS 13.4.1 (22F82)
Build environment
Xcode version: 15.0.1
Dependency manager and version: SPM, shipped w/ Xcode
The text was updated successfully, but these errors were encountered: