2 ms·
Theoretically just: let u = MGCopyAnswer("HardwarePlatform") However, the problem is that MGCopyAnswer is a private method, and thus you have to define an int
by terhechte 11y ago
Theoretically just:
let u = MGCopyAnswer("HardwarePlatform")
However, the problem is that MGCopyAnswer is a private method, and thus you have to define an interface for it. You can't do that in Swift, however you can do it by creating a bridging header for Swift.
So you'd need to add a bridging-header.h to the project, then set the compile target up to use the bridging header, and finally add this to the bridging header:
#include <CoreFoundation/CoreFoundation.h>
#if __cplusplus
extern "C" {
#endif
CFPropertyListRef MGCopyAnswer(CFStringRef property);
#if __cplusplus
}
#endif
- xenadu02 11y agoThat's not correct. You can define it with @asmname.
- terhechte 11y agoThanks, I didn't know about that. I've since written a blog post to explain how to do it in Swift (also because I wanted to try it out) here (http://appventure.me/2015/09/30/getting-iphone6s-foundry-from-swift/ http://appventure.me/2015/09/30/getting-iphone6s-foundry-fro...) I've included your helpful info. Thanks!