Notification.Name
Objective-C. NotificationName
Objective-C NSString
. Swift Objective-C, Swift (, Notification
String
).
, , :
Notification.Name
, ; ,- Objective-C (,
NSString
, , NSNotification
).
1) Objective-C- Swift:
public extension NSNotification {
public static let blahblahblah: NSString = "blahblahblah"
}
: Swift 4 Objective-C. :
@objc public extension NSNotification {
public static var blahblahblah: NSString {
return "blahblahblah"
}
}
var
computed: , let
.
2) Objective C Xcode Swift ( ):
#import "YourProjectName-Swift.h"
: YourProjectName
. , "CoolGameApp", Swift "CoolGameApp-Swift.h". , "Cool Game App", : "Cool-Game-App-Swift.h"
3) .
Objective-C:
[[NSNotificationCenter defaultCenter] postNotificationName:NSNotification.blahblahblah object:self];