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

[SR-2414] Should Swift help NSValue-wrappables across the bridge? #45019

Closed
mattneub opened this issue Aug 19, 2016 · 4 comments
Closed

[SR-2414] Should Swift help NSValue-wrappables across the bridge? #45019

mattneub opened this issue Aug 19, 2016 · 4 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@mattneub
Copy link

Previous ID SR-2414
Radar None
Original Reporter @mattneub
Type Bug
Status Resolved
Resolution Done
Environment

Xcode Version 8.0 beta 6 (8S201h)

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee @mattneub
Priority Medium

md5: b0ee95fad7e9d3a766f343c3895dac26

Issue Description:

This used to be illegal, where `anim` is a CABasicAnimation:

anim.toValue = CGPoint.zero

It was illegal because toValue was an id and CGPoint was not an AnyObject. Now toValue is an Any and everything is boxable, so it's legal. But it's also ineffective; the user is going to be caught flatfooted when the animation doesn't work. Perhaps we could help by doing what the user should have done, i.e. wrap in an NSValue?

@mattneub
Copy link
Author

Please note that I'm referring here only to the limited situation where (1) an object is expected and (2) there's a standard NSValue initializer for this kind of value.

Also we'd need to cover both e.g. CGPoint (map it to NSValue wrapping CGPoint) and array of CGPoint (map it to array of NSValues wrapping CGPoints), and so on.

@belkadan
Copy link
Contributor

cc @jckarter

@jckarter
Copy link
Member

The core team accepted SE-0139, which should make this case work properly by bridging CGPoints to NSValues as expected by CoreAnimation. This has been implemented in #4922 and should be available in future 3.x seeds.

@mattneub
Copy link
Author

Thanks so much @jckarter for ferrying this through the proposal process. It's wonderful to see it spring to life in Xcode 8.1 / Swift 3.0.1.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

3 participants