objective c - Where are identifiers like NSControlKeyMask defined -
where identifiers nscontrolkeymask
, nsalternatekeymask
, nsshiftkeymask
defined? need compile swift project using objective-c library named ddhotkey contains following code:
if (modifiers & nscontrolkeymask) { [final appendstring:[charactermap objectforkey:@(kvk_control)]]; } if (modifiers & nsalternatekeymask) { [final appendstring:[charactermap objectforkey:@(kvk_option)]]; } if (modifiers & nsshiftkeymask) { [final appendstring:[charactermap objectforkey:@(kvk_shift)]]; }
this code gives me following errors:
use of undeclared identifier 'nscontrolkeymask'
use of undeclared identifier 'nsalternatekeymask'
use of undeclared identifier 'nsshiftkeymask'
why? doing wrong? how can fix it?
thanks in advance.
the "ddhotkey" sample project uses precompiled header file "ddhotkey_prefix.pch" contents
#ifdef __objc__ #import <cocoa/cocoa.h> #endif
so <cocoa/cocoa.h>
automatically included objective-c sources. in turn includes foundation , appkit framework headers.
new xcode projects not create precompiled headers files anymore. if copied sources files sample project new project, error occur.
you add precompiled header file project, seems sufficient add
#import <appkit/appkit.h>
in "ddhotkeyutilities.m".
Comments
Post a Comment