Skip to content

[Foundation] Scale back struct Notification's userInfo to be in-line … #3977

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

Merged
merged 1 commit into from
Aug 5, 2016

Conversation

phausler
Copy link
Contributor

@phausler phausler commented Aug 3, 2016

What's in this pull request?

This simplifies the bridging story for Notifications to their objc counterparts since the id -> Any and AnyHashable changes have now been applied (which makes the previous boxing strategy no longer needed). Previous consumers of Notification that were using String keys should still work, however any explicit dictionary types should migrate from Swift 2.2 -> Swift 3 from userInfo as [NSObject:AnyObject] to [AnyHashable:Any]. The condition of distributed notifications (in non sandboxed apps) requiring plist types still applies and will fail at runtime if incorrect types are passed into the objective-c layer, and in the case of sandboxed apps userInfo still is forbidden (this change is a non functional change in the respect to those behaviors).

Resolved bug number: (SR-)

rdar://problem/27426757
rdar://problem/27561621
rdar://problem/27259984

…with NSNotification

This simplifies the bridging story for Notifications to their objc counterparts since the id -> Any and AnyHashable changes have now been applied (which makes the previous boxing strategy no longer needed). Previous consumers of Notification that were using String keys should still work, however any explicit dictionary types should migrate from Swift 2.2 -> Swift 3 from userInfo as [NSObject:AnyObject] to [AnyHashable:Any]. The condition of distributed notifications (in non sandboxed apps) requiring plist types still applies and will fail at runtime if incorrect types are passed into the objective-c layer, and in the case of sandboxed apps userInfo still is forbidden (this change is a non functional change in the respect to those behaviors).

Resolves the following issues:
<rdar://problem/27426757>
<rdar://problem/27561621>
<rdar://problem/27259984>
@phausler
Copy link
Contributor Author

phausler commented Aug 3, 2016

@swift-ci Please test OS X platform

]

let note1 = Notification(name: notifName, userInfo: info1)
let note2 = Notification(name: notifName, userInfo: info1)
expectNotEqual(note1, note2)
expectEqual(note1, note2)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

notifications created with the same name and same userInfo should be equal

@michael-lehew
Copy link
Contributor

changes look good to me :)

@lattner
Copy link
Contributor

lattner commented Aug 4, 2016

@phausler and @michael-lehew : FYI, @rjmccall is working on resolving the missing implicit conversion to AnyHashable issue, for Swift 3.

@lattner
Copy link
Contributor

lattner commented Aug 4, 2016

This is the right thing to do in the meantime though.

@tkremenek tkremenek merged commit 2bea707 into swiftlang:master Aug 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants