mergesort mergesort - 5 months ago 30
iOS Question

How to compare Obj C enum in Swift?

I am using FreeStreamer in Swift and am trying to set the


audioStream.onStateChange = { (state) in
if state == kFsAudioStreamBuffering {

I am getting this error:

Binary operator '==' cannot be applied to operands of type '(FSAudioStreamState)' and 'FSAudioStreamState'

Edit: Still the same error without the parentheses around state in the block params

EDIT: As a temporary fix,
state.value == kFsAudioStreamBuffering.value


try putting a dot (.) before kFsAudioStreamBuffering something like this:

if state == .kFsAudioStreamBuffering {

UPDATE: Try this instead

audioStream.onStateChange = { state in
    if state.value == kFsAudioStreamBuffering.value {