定义枚举:
typedef NS_ENUM(NSUInteger, HardType) {
CellFunction,
Memory,
CPU,
};
我是在通知中进行传递的
[[NSNotificationCenter defaultCenter] postNotificationName:@"HardwareUINotification" object:nil userInfo:@{@"type": @(hardType)}];
在通知的selector中取值
@objc func repeatDetectionOfUI(notification: Notification) {
let typeNumber = notification.userInfo!["type"] as! NSNumber
let hardType = typeNumber.uintValue
switch hardType {
case HardType.Vibrator.rawValue:
default:
print("hi")
}
}