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

Can't have NSString and NSNumber as values in an NSDictionary #306

Closed
mwcampbell opened this issue Dec 20, 2022 · 2 comments · Fixed by #505
Closed

Can't have NSString and NSNumber as values in an NSDictionary #306

mwcampbell opened this issue Dec 20, 2022 · 2 comments · Fixed by #505
Labels
A-framework Affects the framework crates and the translator for them bug Something isn't working
Milestone

Comments

@mwcampbell
Copy link

I don't see a way to create an NSDictionary with an NSString and an NSNumber as values, because the public Rust API for NSDictionary requires values to be Owned references, and this isn't possible for NSString and NSNumber. This blocks me from posting announcement notifications in the AccessKit macOS adapter, unless I use an unsafe workaround.

@madsmtm madsmtm added bug Something isn't working A-framework Affects the framework crates and the translator for them labels Dec 21, 2022
@madsmtm
Copy link
Owner

madsmtm commented Dec 21, 2022

Indeed, this is an issue.

In #264 I'm experimenting with adding ownership parameters to NSDictionary as well (so having NSDictionary<Key, Value, KeyOwnership = Shared, ValueOwnership = Shared>, which should solve this.

@madsmtm
Copy link
Owner

madsmtm commented Jan 7, 2023

This is partially fixed now, since NSMutableDictionary::setObject_forKey is now available regardless of the dictionary's key and value ownership.

Though I haven't updated the helper implementations, so e.g. NSMutableDictionary::insert is currently unsound.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-framework Affects the framework crates and the translator for them bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants