0

This code:

guard let node = audioEngine.inputNode else { return }

Results in the following error:

Initializer for conditional binding must have Optional type, not 'AVAudioInputNode'

What should I change to make it work?

Tried to delete guard but it doesn't help.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
testikovy
  • 11
  • 3

1 Answers1

1

Doing the guard let node = audioEngine.inputNode ... is trying to unwrap an optional value. However, audioEngine.inputNode does not return an optional value.

If you just do let node = audioEngine.inputNode (without the guard let return), it will work.

AdamPro13
  • 7,232
  • 2
  • 30
  • 28