- Forums
- »
- Programming with Haxe
- »
- What Native Extensions Exist For NME?
|
Viewing 1 to 9 (9 Total) What Native Extensions Exist For NME? |
|
|---|---|
Silvercaster893Total Posts: 104
Joined: January 05, 2012
|
Hi everyone! I'm working on a non-game app for iOS that I'd like to make using NME if possible, in case we want an Android version in the future, but I'm not sure if it's possible, as we want a lot of native iOS functionality that I'm not sure exists in NME. The following are features that we need:
Tags:
Posted on June 28, 2012 at 11:07 AM
|
crayfellowTotal Posts: 204
Joined: November 28, 2011
|
Re: What Native Extensions Exist For NME?I have a bunch of native extensions but they don't cover your exact cases. So far my stuff is specific to interacting with the filesystem, showing native UI elements overlaid, and utilities such as checking network connectivity.
Posted on June 28, 2012 at 5:10 PM
|
Silvercaster893Total Posts: 104
Joined: January 05, 2012
|
Re: What Native Extensions Exist For NME?Possibly. If there's a way that I can hook native iOS code up to my NME codebase that would get the job done. I know all the tasks I outlined are possible in native code so that should work, if there's a way for me to do that. Ideally it would be like, a set of functions or something I could call from NME and then simply implement in Objective C. Is that kind of thing possible? (I've never worked with native extensions or anything of the sort before so forgive my ignorance ^^; )
Posted on June 29, 2012 at 9:55 AM
|
crayfellowTotal Posts: 204
Joined: November 28, 2011
|
Re: What Native Extensions Exist For NME?Yup, once you get a basic system in place it's easy using the CFFI (an interface to call C++ functions directly from Haxe). The only part that can get complex is making sure the data is formatted as it goes between.
Posted on June 29, 2012 at 10:00 AM
|
Silvercaster893Total Posts: 104
Joined: January 05, 2012
|
Re: What Native Extensions Exist For NME?Awesome! Can native iOS code be done in C++ though? I've only ever done it in Objective C...
Posted on June 29, 2012 at 10:11 AM
|
singmajestyTotal Posts: 2140
Joined: August 25, 2011
|
Re: What Native Extensions Exist For NME?You can call Objective-C methods from C++ when you are compiling for iOS or OS X.
Posted on June 29, 2012 at 10:34 AM
|
crayfellowTotal Posts: 204
Joined: November 28, 2011
|
Re: What Native Extensions Exist For NME?The .mm extension essentially means "Objective-C++" where C++ and Objective-C can coexist, this is the happy medium in my opinion. As you will see in Joshua's example, the C++/Objective-C++ classes can share a common header file to define a portable interface that is then implemented per target. You could do the same thing so you could use your extension for other platforms when/if that becomes useful.
Posted on June 29, 2012 at 10:58 AM
|
Silvercaster893Total Posts: 104
Joined: January 05, 2012
|
Re: What Native Extensions Exist For NME?Cool! Yeah, crayfellow, if you could post your examples that would be great! Thank you guys!
Posted on June 29, 2012 at 1:47 PM
|
Silvercaster893Total Posts: 104
Joined: January 05, 2012
|
Re: What Native Extensions Exist For NME?As an update, I've managed to hook a couple native extensions for iOS into my project (the MailSender and LocationManager ones) and I think I get the idea about how to use those. However, I'm still rather lost on how I might go about making my own, if the functionality I was looking for in my initial post in this topic isn't available elsewhere. crayfellow, did you ever end up posting your examples anywhere?
Posted on July 30, 2012 at 2:55 PM
|
