Hacker News new | comments | show | ask | jobs | submit login

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




That's not correct. You can define it with @asmname.


Thanks, 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-fro...) I've included your helpful info. Thanks!




Applications are open for YC Winter 2019

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: