Skip to main content
周戈35_2
Inspiring
Jan 11, 2017 3:12 PM UTC
Answered

Is Adobe planning on support writing ANE with Swift?

Dear Adobe,

AIR is an awesome cross platform solution, I have already published a multi platform product using AIR technology, my product website is https://verylab.com/

Nowadays the hardwares of mobile devices are fairly high spec, even the cheap price devices can handle AIR applications pretty well, it's safe to say that the performance issue of AIR on modern mobile devices is no longer the case, which is great!

The way I see it, the only thing that holds me back is not able to write ANE with Swift. I googled the internet and found the problem is: Swift is a dynamic framework, and AIR ANE only supports static frameworks, so we have to write ANE with Objective-C.

The language grammar between Swift and ActionScript has many commons, which is easy for ActionScript developers to learn and write Swift codes. It's a HUGE let down that AIR ANE does not support Swift : (

Is there any way or any workaround for AIR ANE to support Swift?

If there is a way, is Adobe planning on support it?

Regards,

Ge Zhou

2017-01-11

This topic is closed to new replies. Start a new post to keep the conversation going.
el111Correct answer
Legend
Mar 5, 2017 10:13 PM UTC

Updated repo with latest code.

Now allows calls to FRE functions from Swift

The project contains a translation of FlashRuntimeExtensions to Swift. It is comprised of 2 parts.

  1. A static library which exposes methods to AIR and a thin ObjectiveC API layer to the Swift code.
  2. A dynamic Swift Framework which contains the main logic of the ANE.

To allow FRE functions to be called from within Swift, a protocol acting as a bridge back to Objective C was used.   

Example - Converting a FREObject into a String

var swiftString: String = ""

var len: UInt32 = 0

let status: FREResult = FREGetObjectAsUTF8(object: object, length: &len, value: &swiftString)

var airString: FREObject? = nil

let status: FREResult = FRENewObjectFromUTF8(length: UInt32(string.utf8.count), value: ret, object: &freObject)

Example - Converting a FREObject into a String the easy way, using ANEHelper.swift

let swiftString: String = aneHelper.getString(object: object)

let airString: FREObject? = aneHelper.getFREObject(string: swiftString)

trace(value: swiftString)

GitHub - tuarua/SwiftIOSANE: Example Air Native Extension written in Swift 3 for iOS 10

11 replies

周戈35_2
Inspiring
Feb 20, 2017 5:59 PM UTC

has found a way to support Swift in ANE, below are the related links:

Re: Swift iOS ANE Framework​​

GitHub - tuarua/SwiftIOSANE: Example Air Native Extension written in Swift 3 for iOS 10​

Translate
Legend
Feb 25, 2017 2:42 PM UTC

Updated GitHub with a tool written in AIR to package app, deploy and debug on device

Translate
el111Correct answer
Legend
Mar 5, 2017 10:13 PM UTC

Updated repo with latest code.

Now allows calls to FRE functions from Swift

The project contains a translation of FlashRuntimeExtensions to Swift. It is comprised of 2 parts.

  1. A static library which exposes methods to AIR and a thin ObjectiveC API layer to the Swift code.
  2. A dynamic Swift Framework which contains the main logic of the ANE.

To allow FRE functions to be called from within Swift, a protocol acting as a bridge back to Objective C was used.   

Example - Converting a FREObject into a String

var swiftString: String = ""

var len: UInt32 = 0

let status: FREResult = FREGetObjectAsUTF8(object: object, length: &len, value: &swiftString)

var airString: FREObject? = nil

let status: FREResult = FRENewObjectFromUTF8(length: UInt32(string.utf8.count), value: ret, object: &freObject)

Example - Converting a FREObject into a String the easy way, using ANEHelper.swift

let swiftString: String = aneHelper.getString(object: object)

let airString: FREObject? = aneHelper.getFREObject(string: swiftString)

trace(value: swiftString)

GitHub - tuarua/SwiftIOSANE: Example Air Native Extension written in Swift 3 for iOS 10

Translate
Participant
Feb 15, 2017 2:16 AM UTC

hope

Translate
Participant
Feb 15, 2017 2:14 AM UTC

Yes. That's great!!

Translate
yakilery4470593
Participant
Jan 17, 2017 6:55 AM UTC

hope

Translate
Inspiring
Jan 13, 2017 10:00 AM UTC

I simple hate Objetive-C. Swift on the other hand it's nice and easy for a AS3 developer.

Translate
周戈35_2
Inspiring
Feb 10, 2017 8:08 AM UTC

Yes, totally agreed!

Support writing ANE with Swift is a huge feature, we're sincerely hoping Adobe could take it into consideration.

Translate
vini1024
Participating Frequently
Jan 12, 2017 2:34 AM UTC

hope

Translate
Legend
Jan 13, 2017 12:42 AM UTC

Yes. This would be great. I've written a couple for OSX (where it is supported) and Swift is a lot nicer to use

Translate