Audiokit: Swift 5 support

Created on 25 Mar 2019  路  29Comments  路  Source: AudioKit/AudioKit

I'm sure you're all working on this, just making the issue to add some visibility for others who are wondering as well.

Xcode 10.2 with Swift 5 support was just released today. Hoping Swift 5 support is coming soon to AudioKit!

Most helpful comment

4.7 is released

All 29 comments

It wasn't too hard to perform the changes need to get it to compile:

https://github.com/AudioKit/AudioKit/tree/swift5

Are you looking for a release and a CocoaPod?

Ideally, yes. Not in any rush for it. We have a couple of libraries that have it setup as a pod dependency, so that would be the easiest.

Are the other CocoaPods you're depending on already Swift5 ready?

Not yet. It's been awhile since we added AudioKit as a dependency, but we were having issues getting things to compile when it was a vendored framework dependency. I'll have a look again and see if I can get it going.

Hi Guys.

Now I'm having trouble with this new release of Xcode. I've just updated it and it gives

Module compiled with Swift 4.2.1 cannot be imported by the Swift 5.0 compiler: $(MY_APP_ROOT)/AudioKit.framework/Modules/AudioKit.swiftmodule/arm64.swiftmodule

I've already set the Swift Language Version as Swift 4 but it keeps happening. Is there anybody who solved this problem?

I'm getting something similar to that error on the playgrounds now, where I don't actually think I have control over the Swift version like you do. Its going to be a painful couple of weeks.

Has anyone found a solution to this?

This is not happening on the AudioKit examples so you may want to look at those to see why those are still working? I will too.

It wasn't too hard to perform the changes need to get it to compile:

https://github.com/AudioKit/AudioKit/tree/swift5

Are you looking for a release and a CocoaPod?

I test the branch锛宐ut the generated AudioKit-Swift.h will make objective-c can't see some Property.
like: 'gain' cannot be found in forward class object 'AKBooster'

Actually the playgrounds inside AudioKit work fine (I was looking at the standalone repo which works off of CocoaPods)

Gain is clearly marked to be accessible to objective-c. AKBooster is available but gain is not?

@objc open dynamic var gain: Double = 1 {

Not wanting to seem dismissive, but a good clean and build and making sure you are pointing to the versions of AudioKit built with Xcode 10.2.

My AudioKit-swift.h does have the proper gain property:

SWIFT_CLASS("_TtC8AudioKit9AKBooster")
@interface AKBooster : AKNode <AKToggleable>
/// Ramp Duration represents the speed at which parameters are allowed to change
@property (nonatomic) double rampDuration;
@property (nonatomic) enum RampType rampType;
/// Amplification Factor
@property (nonatomic) double gain;
/// Left Channel Amplification Factor

When does the newly compiled pod update is expected?
this thing is a blocker for an upload in my case, please help

Is there a tested work-around in the meanwhile?

for anyone including @GabiGVeesto i went to swift.org and downloaded the 4.2 Toolchain swift toolchains I installed it. Then i went to Xcode> Toolchains > swift 4.2 and it all compiles. I had no success yet with with the swift5 branch.
Hopefully this saves someone else time.
You can't submit to App Store but you can get by till it's fixed.

Hope we can get AudioKit working with latest Xcode and app store soon.

We now have a pre-release pod built with Swift 5 available for those that need it right away. The version number you need to use is 4.6.4.b1. Instructions for setting up your project are here:

https://github.com/AudioKit/Specs

You are all amazing. Thank you so much!

It wasn't too hard to perform the changes need to get it to compile:

https://github.com/AudioKit/AudioKit/tree/swift5

Are you looking for a release and a CocoaPod?

I get [!] Unable to find a specification for 'AudioKit'. in terminal when try to install the branch into the proyect :(

@IvanQuintanaF have you added the AudioKit pod source outlined in https://github.com/AudioKit/Specs?

@colinhumber, this is my pod file
Screen Shot 2019-03-28 at 10 33 12 AM,

pod are installed correctly but the problem still exist: Module compiled with Swift 4.2 cannot be imported by the Swift 5.0

Have you tried pointing the AudioKit version to 4.6.4 ?

@sieren yes, same error :(

@IvanQuintanaF I just created a fresh project with the follow Podfile and was able to compile for Swift 5 using 4.6.4.b1 on Xcode 10.2. I'm using Cocoapods 1.6.1.

source 'https://github.com/AudioKit/Specs.git'
source 'https://github.com/CocoaPods/Specs.git'

# Uncomment the next line to define a global platform for your project
platform :ios, '11.0'

target 'test' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for test
  pod 'AudioKit', '=4.6.4.b1'
end

@IvanQuintanaF you might wanna delete the Pods folder and install from fresh if you havent done so already... (also pod update etc.)

It needs to be explicitly 4.6.4.b1 specified in there as that is the only Swift 5 binary available so far. The just released 4.6.4 is still Swift 4.

@colinhumber & @sieren, thanks for your help, I'll try like this :)

Thank you AudioKit team for the swift (sorry :P) transition to Swift 5. The separate Swift 5 repo pod worked perfectly for me.

4.7 is released

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  8Comments

minayko picture minayko  路  4Comments

gm3197 picture gm3197  路  10Comments

trevor-sonic picture trevor-sonic  路  6Comments

mlostekk picture mlostekk  路  4Comments