Ali Uzunoğlu
Ali Uzunoğlu

Reputation: 55

No type or protocol named AKNode/AKToggleable

I'm trying to extend AKNode and AKToggelable and this error appears on Project-Swift.h file

What is the way to do this?

My class is

class AKCustom: AKNode, AKToggleable, AKComponent, AKInput {
public typealias AKAudioUnitType = AKBalancerDeplikeAudioUnit

public static let ComponentDescription = AudioComponentDescription(mixer: "dpba")

private var internalAU: AKAudioUnitType?


open dynamic var isStarted: Bool {
    return internalAU?.isPlaying() ?? false
}

public init( _ input: AKNode? = nil) {
    _Self.register()
    super.init()
    AVAudioUnit._instantiate(with: _Self.ComponentDescription) { [weak self] avAudioUnit in

        self?.avAudioNode = avAudioUnit
        self?.internalAU = avAudioUnit.auAudioUnit as? AKAudioUnitType

        input?.connect(to: self!)
    }
}

open func start() {
    internalAU?.start()
}

open func stop() {
    internalAU?.stop()
}
}

And error messages in Project-Swift.h file:

Cannot find interface declaration for 'AKNode', superclass of 'AKCustom'

No type or protocol named 'AKToggleable'

Upvotes: 5

Views: 352

Answers (2)

mavixce
mavixce

Reputation: 338

add #import "AudioKit/AudioKit-Swift.h" to PROJECT-Bridging-Header.h. Then AKNode will be accessible at Project-Swift.h.

Upvotes: 1

Aurelius Prochazka
Aurelius Prochazka

Reputation: 4573

Inside the AudioKit folder is a "Developer" folder that has examples for "Extending AudioKit" on both iOS and Mac. That's probably the best place to start. Make sure you're including the source as a framework properly - the examples in this folder show you how to do it either with source directly or the precompiled framework.

Upvotes: 1

Related Questions