Skip to content
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

When ignoredProperties is overridden on Swift, the schema ends up invalid #678

Merged
merged 1 commit into from Jul 30, 2014

Conversation

Reflejo
Copy link
Contributor

@Reflejo Reflejo commented Jul 25, 2014

When overridden ignoredProperties on an RLMObject subclass (Swift), the entire schema gets invalid (it ends up with 0 properties). The reason why this is happening is, to say at least, tricky:

I'm unclear if this is a Swift bug or just an intended language "feature". But when the conditional includes an unwrapping and a method call, only the unwrapping gets evaluated. Meaning that when you do:

ignoredPropertiesForClass?.containsObject(propertyName)

If ignoredPropertiesForClass is not nil, it doesn't matter what the containsObject method returns, that conditional is always going to be true. Note that I only tested this on Xcode Beta4.

@alazier
Copy link
Contributor

alazier commented Jul 30, 2014

Thanks for the fix. If you have a test for this it would be great to include it as well. Otherwise I can add one after merging.

alazier added a commit that referenced this pull request Jul 30, 2014
When ignoredProperties is overridden on Swift, the schema ends up invalid
@alazier alazier merged commit de54324 into realm:master Jul 30, 2014
@alazier
Copy link
Contributor

alazier commented Jul 30, 2014

I ended up writing a test for this. Feel free to contribute yours as well if you have them.

@Reflejo Reflejo deleted the swift-ignoredporperties-fix branch July 30, 2014 06:20
@Reflejo
Copy link
Contributor Author

Reflejo commented Jul 30, 2014

About to create a new pull request with my tests for this

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants