Skip to content

Instantly share code, notes, and snippets.

@mterekhov
Created September 17, 2024 15:15
Show Gist options
  • Save mterekhov/54f9afe3ed02472a0285be900308623c to your computer and use it in GitHub Desktop.
Save mterekhov/54f9afe3ed02472a0285be900308623c to your computer and use it in GitHub Desktop.
var headphonesAreActive = false
loop: for currentOutput in audioSession.currentRoute.outputs {
switch currentOutput.portType {
case .headphones, .bluetoothA2DP, .bluetoothHFP:
headphonesAreActive = true
hasHeadphones = true
hasBluetoothHeadphones = [.bluetoothA2DP, .bluetoothHFP].contains(currentOutput.portType)
activeOutput = .headphones
break loop
default:
break
}
}
@mterekhov
Copy link
Author

вот туточки break loop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment