Knowledge of developing AIR ANE
Knowledge of developing dynamic frameworks in Xcode
|Required Adobe Products
Adobe Flash Builder (Download)
Adobe AIR Runtime (Download)
|Required third-party products
Xcode (latest version) (Download)
Starting AIR 28, developers can use Swift based ANE for iOS/tvOS. Developers can also use iOS/tvOS based dynamic frameworks while packaging the application for respective iOS/tvOS platforms. Dynamic frameworks signing will be done while packaging the application.
Swift based ANE Support in AIR (iOS/tvOS)
There are some important modules which are necessary to create Swift based ANE. Below is the detailed description on how to create them individually.
Swift based dynamic framework (.framework)
This is a Swift module where AS developers write their own Swift based code for ANE as per the required functionalities. To create Swift based dynamic framework, follow the steps below:
1. Launch Xcode. Create new "Cocoa Touch Framework" project from "Framework & Library" section.
2. Enter Project Name. Select language as Swift/Objective-C as appropriate.
Click Next to create the project.
3. Write native swift code as per requirement. To Build your project, click "Product -> Build".
This will create a dynamic framework file on your disk.
4. Right click the created .framework file and click "Show in Finder" to locate your created dynamic framework file.
5. You will find the below structure on your disk, after the dynamic framework file is successfully created.
6. Verify that the created dynamic framework executable is not signed. You can execute the below mentioned codesign command to verify the same.
codesign -d -v <dynamic_framework_executable_file>
<dynamic_framework_executable_file>: code object is not signed at all
Static library file (.a file)
This module creates Objective-C static library (.a) file to be used while ANE creation. Developers need to refer dynamic framework symbols to call dynamic framework functions inside static library.
1. Launch Xcode. Create new "Cocoa Touch Static Library" project from "Framework & Library" section.
2. Include the necessary header files e.g. FlashRuntimeExtension.h, SimpleNativeCAPISwift-Swift.h to be used in your static library project.
You can find framework header files in "Headers" folder inside .framework file.
For FlashRuntime header file, you can find in <AIR_SDK/include/FlashRuntimeExtensions.h>
3. Write Objective-C based code (This is same as previously developers used to write static libraries for ANE creation).
Build your project from "Product -> Build".
4. Right click on the created static library file and click "Show In Finder" to locate your static library file.
Package Swift based ANE (.ane)
This module creates Swift based ANE, that developers use in their ActionScript library project (iOS Only). To package Swift based ANE from the above created resources, follow the steps below:
1. Along with the existing necessary resources for ANE creation, AS developers need to include dynamic frameworks (relevant .framework files) during ANE creation command. The platform.xml needs to mention the dynamic frameworks as shown below.
<?xml version="1.0" encoding="utf-8" ?>
AS developers need to mention relative path of their dynamic frameworks under <linker options>tag. This rpath (relative path) will be used during app packaging. It is also required to mention dynamic frameworks (relevant .framework files) under <packagedDependencies> tag. These dependencies will be used during ANE packaging.
2. Sample ANE packaging command with folder structure:
adt -package -target ane <ane_file> <extensionxml_file> -swc <swc_file> -platform iPhone-ARM -platformoptions <platformxml_file> -C iPhone-ARM/ . -platform appleTV-ARM -platformoptions <tvOS_platformxml_file> -C appleTV-ARM/ .
iPhone-ARM folder contains dynamic_swift_framework_file as mentioned in package dependencies in platform_xml, Objective C Static library (.a) built for iOS and library.swf file.
appleTV-ARM folder contains dynamic_swift_framework_file for tvOS as mentioned in package dependencies in tvOS_platform_xml, Objective C Static library (.a) built for tvOS and library.swf file.
3. Sample IPA Packaging command and folder structure:
adt -package -target <target> -provisioning-profile <path-to-profile> -storetype pkcs12 -keystore <path-to-certificate> -storepass <password> <ipa_file> <appxml_path> <swf_path> Frameworks -extdir extensions
Where the <dynamic_frameworks_and_Swift_Dependencies_path> folder, or subfolders inside it contain Swift frameworks and its dependencies as mentioned below. These Swift dylibs can be found at
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos for iOS and /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/appletvos for tvOS
For Xcode 9 and Swift 4 support, AS Developers need to add three more swift dependencies as below from iphoneos folder from Xcode.