-
Notifications
You must be signed in to change notification settings - Fork 504
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Swift] Strong typing for PTUSBHub notification user info dictionaries
In ObjC, clients were hardcoding `@"DeviceID"` et al when pulling values out of the device attach and detach notifications. Now they can use `PTUSBHubNotificationKeyDeviceID` etc. In Swift, instead of hardcoding `"DeviceID"` we can now do this: ``` @objc func onAttach(notification: Notification) { guard let userInfo = notification.userInfo as? [PTUSBHubNotificationKey: Any], let deviceID = userInfo[.deviceID] as? Int else { return } ... } ```
- Loading branch information
1 parent
6b6f123
commit d589b1e
Showing
3 changed files
with
21 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters