Migrating AudioKit from version 2 to version 4 - ios

I'm working on updating this project:
https://github.com/elslooo/guitar-tuner
The author wrote on Swift 3 and uses AudioKit 2.2. I have already moved to Swift 4 and would like to migrate to AudioKit latest version 4.2. I look at the AudioKit migration guide, but there it's mentioned only that's a complete rewrite from version 2.
The major compiler errors I'm getting now are:
Use of undeclared type 'AKAudioAnalyzer'
Use of undeclared type 'AKAudioPlot'
Use of unresolved identifier 'AKManager'
Value of type 'AudioPlot' has no member .... (several properties)
Use of unresolved identifier 'AKOrchestra'
Could you please point me to some AudioKit documents or references where I can find the new equivalent classes?

AudioKit 3 was a complete rewrite and there is no real upgrade path, but:
AKAudioAnalyzer -> AKFrequencyTracker
AKAudioPlot -> AKNodeOutputPlot
AKMananger -> AudioKit
AKOrchestra -> Unused
I suggest you use one of these projects for a starting point for the internals anyway:
https://github.com/comyar/TuningFork
https://github.com/swiftingio/SingTest
They are at least based in AudioKit 3 and should be easier to upgrade to AK4.
We'd love to highlight your rewrite here:
https://audiokitpro.com/project-ideas/

Related

FFMpeg error in Xcode 9 - Definition of type 'AVMediaType' conflicts with typedef of the same name

I am trying to stream a live video(rtsp) using ffmpeg library
in avutil.h
How to resolve this issue.
It's happened in Xcode9 ,so you can change AVMediaType to FF_AVMediaType in list files: avcodec.h avfilter.h avformat.h avutil.h

NSAttributedStringKey.attachment versus NSAttachmentAttributeName

I'm having problems with NSAttributedStringKey.attachment versus NSAttachmentAttributeName. Here's the relevant code:
var key: Any?
if #available(iOS 11, *) {
key = NSAttributedStringKey.attachment
}
else {
key = NSAttachmentAttributeName
}
One of two things are happening. In the actual place where I'm trying to use this code (a Cococapod of my own design, with a deployment target of iOS 8 and now building with Xcode 9), I get an error:
Type 'NSAttributedStringKey' (aka 'NSString') has no member 'attachment'
Or, if I just make a new example project and set the deployment target at iOS 8, I get:
'NSAttachmentAttributeName' has been renamed to 'NSAttributedStringKey.attachment'
This is not the behavior I'd expect with #available. Thoughts?
This String vs struct difference is between Swift 3 (uses Strings such as NSAttachmentAttributeName) and Swift 4 (uses struct static attributes such as NSAttributedStringKey.attachment), not between iOS <11 and iOS >=11. For instance, you can use NSAttributedStringKey.attachment and similar in any supporting version of iOS (e.g. .attachment is available since iOS 7) within a Swift 4 project. #available doesn't apply because it's a Swift language version difference rather than an OS version difference.
Ensure your pod is set to the correct Swift version and it should then work as expected. You can tell CocoaPods that by adding a .swift-version file at the top of your project:
$ echo 4.0 >.swift-version
This magical version file is mentioned in passing in a CocoaPods blog post from last year: http://blog.cocoapods.org/CocoaPods-1.1.0/

Strange errors after converting SceneKit sample code to Swift 3

I downloaded Apple's SceneKit sample code (fox.swift) and opened it up on Xcode 8 beta 6.
It asked me to convert the code to Swift 3, which I did.
When I try to run the code on my phone I receive the errors:
Value of type ‘SCNNode’ has no member ‘run’
Value of type ‘SCNNode’ has no member ‘add’
Sample lines where the error occurs:
cameraYHandle.run(actionY)
self.cameraYHandle.add(cameraYAnimation, forKey: nil)
This leads me to three questions:
1) Are the functions 'run' and 'add' gone on SCNNode for Swift 3?
2) If so, what should I replace them with?
3) If so, if so, why didn't Xcode's converter handled them already?
Thank you for your time :)
PS.: It runned well for Mac using Xcode 7.3.
As dan commented, these translations resulted in a code without errors:
run => runAction
add => addAnimation
play => playAudio
so,
cameraYHandle.run(actionY) becomes cameraYHandle.runAction(actionY)
and so on.
Thank you, Dan.

Swift App Extension: instance method count is unavailable

I just create my first app extension using XCode 7.1. One code file containing the code below is shared with both targets:
var str = "";
var l = str.count; //Compile error for extension target App: count is unavailable: There is no ...
The reason for this compile error seams to be that App extension compiles with swift 1.2 while the container target compiles with swift 2.0.
One solution would be importing the content App into the extension App doesn't appear to be a good solution from what i read about it. Sharing the code between targets can be difficult if both are not compiled using the same compiler.
I just run through all target settings and didn't find nothing that could be changed.
Can't find any post about this problem, witch is not so uncommon, so it is must likely i am interpreting something in a wrong way.
The only solution i can think of is using NSString instead of String but that is just an workaround for one class type. More problems of this kind will emerge in the future.
In Swift 2 it's
str.characters.count
Use str.characters.count to get String length in Swift 2

Cannot find protocol declaration for CCTargetTouchDelegate/CCStandardTouchDelegate

I have upgraded my project to the latest beta of cocos2d 2.1 and I am now receiving the errors,
Cannot find protocol declaration for CCTargetTouchDelegate
and
Cannot find protocol declaration for CCStandardTouchDelegate
How do I fix this?
As of cocos2d 2.1 beta 3 the following changes have been made to the touch delegates.
CCTargetedTouchDelegate -> CCTouchOneByOneDelegate
CCStandardTouchDelegate -> CCTouchAllAtOnceDelegate
Simply change the name of the protocol in your class declaration and the error will be fixed.
Reference: CHANGELOG

Resources