Enabling C++ interop breaks existing swift code

I'm running into an issue when enabling C++ interop. I've check this in both an app enabling C++ interop as well as a swift package.

Code that was previously compilable I'm noticing is getting a number of errors. Below are a few examples.

Foundation
Issue 1 - CGSize

var viewportSize: CGSize = CGSize()

This compiles without issue with interop disabled but gives the following message with interop enabled.
Missing argument for parameter 'from' in call

Issue 2 - Notification Center Notification.Name

NotificationCenter.default.removeObserver(self, name: .AVCaptureDeviceWasDisconnected, object: nil)
NotificationCenter.default.removeObserver(self, name: .AVCaptureDeviceWasConnected, object: nil)

It seems that .AVCaptureDeviceWasDisconnected and .AVCaptureDeviceWasDisconnected are no longer available when interop is enabled.

I've seen a few more. Is this a known issue, or are some of these implementations changed when I enable interop?

Thank you

2 Likes

Did you figure out a solution to the issue 2?

1 Like

yes this is very annoying

1 Like

Sorry that you didn't get a response. It's certainly always possible for changing language modes to cause problems, but these seem unexpected, and they're definitely worth reporting as bugs with the Apple feedback assistant.

2 Likes

I'm facing the same issues. Is there any progress on this?

In my case, my project's using C / Objective-C. Due to a new SDK integration, I need to switch to using C++ / Objective-C++, then these issues occur.

I also just ran into a case that breaks Swift code. I've posted a description in a github issue.

1 Like