0

I want to create the AVAudioInputNode in watchOS 3.

If I click on JumpToDefinition for AVAudioInputNode, I see that:

open class AVAudioInputNode : AVAudioIONode, AVAudioMixing {
}

Why I can't create a custom class with the same style ?

My class is:

open class xy : AVAudioIONode, AVAudioMixing {
}

The error is

Type xy does not conform to protocol "AvAudioMixing" and "AVAudioStereoMixing"

Cœur
  • 37,241
  • 25
  • 195
  • 267
Osman
  • 1,496
  • 18
  • 22

2 Answers2

0

That means you need to conform to those 2 protocols, that means you need to apply specific functions or properties that those protocols requiere.

For Example, for table views on a UIViewController Class you use 2 protocols: UITablewViewDelegate, UITableViewDataSource. And to conform those protocols you need to use this functions.

func tableView(_ tableView: UITableView, numberOfRowsInSection: Int) -> int {
return 1 
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  let cell = tablewView.dequehueReusableCell(withIdentifier: "weatherCell", for: indexPath)
  return cell
}

And also assign its delegate and Data source:

tableView.delegate = self
tableView.dataSource = self

In the specific case of those 2 protocols AVAudioIONode, AVAudioMixing you should search which are the required functions you need to conform.

Mago Nicolas Palacios
  • 2,501
  • 1
  • 15
  • 27
0

Consider:

class XY : AVAudioIONode, AVAudioMixing { ... }

That means that that

  • you're subclassing AVAudioIONode, but also that

  • that you're going to conform to the AVAudioMixing protocol (i.e. that you'll implement the necessary AVAudioMixing methods/properties), as well as any protocols that AVAudioMixing inherits (e.g. AVAudioStereoMixing).

So, your error is telling you that while you've declared that your class will conform to AVAudioMixing (and therefore AVAudioStereoMixing, too), you haven't yet implemented the necessary methods and properties. The compiler is just warning you that you haven't finished implementing XY in order to successfully conform to those protocols.

Rob
  • 415,655
  • 72
  • 787
  • 1,044