Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
In this video we're going to explore the native iOS side of the code. So we're going to actually look at the C# and figure out how all this code is working on the iOS side. So the iOS-native library is actually inside of your exercise files. It's under the STARTING here and Vibration, and then you'll see that there is the VibrationiOSlibrary right here. And you'll see your Xcode project called VibrationExtension, and you can just open this up. I'm opening this up in Xcode, for those of you don't have Xcode, you can just open it up in any text editor that you like. And you could see that this iOS native library is of course implemented in Objective-C, and it uses the native extension C API.
The native library action contains examples of these native extensions C APIs. Now to actually build this inside of Xcode, you're going to need a copy of the Flash runtime extension.h from the AIR SDK, and that's in the include directory, and it's called flash runtime extension.h, and you're going to need to copy this to the directory VibrationiOSlibrary from your AIR SDK. So let's take a quick look at this code. And you can see the extension has both an initializer and a finalizer and it utilizes the signatures of the FRE object, the FRE initializer and the FRE finalizer, if you look right down here.
So you see it utilizes those. And you can also see that again the native functions use the signature of the FRE function, and there's a native function here called isSupported, and you can see of course we utilize that in the first walkthrough to determine if this extension is supported, and you can also see there is another method in here called InitNativeCode. Okay, and this is of course all in Objective-C. And then if you scroll up here, you'll also see that there's another extension called vibrate device, and you can see all of that and you could see that they're all utilizing the FREObject. And you'll see that the code in here is commented, so if you want to go ahead and just provide this to your Objective-C developers, they can get a good idea of how this is implemented in Objective-C.
So again, in our case what we're doing here is we have an Android extension, we have an Objective-C native extension, and now in the next video we're going to actually package this up into a SWC file so we can actually generate our native extensions. Very, very exciting.
Get unlimited access to all courses for just $25/month.Become a member
61 Video lessons · 99304 Viewers
56 Video lessons · 112568 Viewers
71 Video lessons · 81388 Viewers
131 Video lessons · 39073 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.