The following code which compiled so far in standard Xcode versions now fails in Xcode 26 beta 2. Has anything changed in the new Swift compiler or was this an issue in my code:
func makeAudioTapProcessor() -> MTAudioProcessingTap? {
var callbacks = MTAudioProcessingTapCallbacks(
version: kMTAudioProcessingTapCallbacksVersion_0,
clientInfo: UnsafeMutableRawPointer(Unmanaged.passRetained(self).toOpaque()),
init: tapInit,
finalize: tapFinalize,
prepare: tapPrepare,
unprepare: tapUnprepare,
process: tapProcess)
var tap: Unmanaged<MTAudioProcessingTap>?
let status =
MTAudioProcessingTapCreate(kCFAllocatorDefault, &callbacks, kMTAudioProcessingTapCreationFlag_PreEffects,
&tap)
if status != noErr {
print("Failed to create audio processing tap")
}
return tap?.takeRetainedValue()
}
Error is in MTAudioProcessingTapCreate function where the function rejects argument of type Unmanaged<MTAudioProcessingTap>? for &tap
Cannot convert value of type 'UnsafeMutablePointer<Unmanaged?>' to expected argument type 'UnsafeMutablePointer<MTAudioProcessingTap?>'
Unmanaged.CM_RETURNS_RETAINED_PARAMETERmacro. Swift probably recognises this and understands that it is a retained value, so there is no need forUnmanaged.CM_RETURNS_RETAINED_PARAMETER? I still see this in the documentation in XCode@available(iOS 6.0, *) public func MTAudioProcessingTapCreate(_ allocator: CFAllocator?, _ callbacks: UnsafePointer<MTAudioProcessingTapCallbacks>, _ flags: MTAudioProcessingTapCreationFlags, _ tapOut: UnsafeMutablePointer<MTAudioProcessingTap?>) -> OSStatusMTAudioProcessingTapCreate, then command click on it to go to the header.