Link error with OpenCV from Swift on M1 Mac building for iOS simulator

I am using OpenCV through and Objective-C++ bridge vending a Swift API. I am linking the latest released iOS package of OpenCV 4.7.0.

It works great for devices (building using both Intel and Apple Silicon Mac), it works for simulators if I build on an Intel Mac.

However, if I build for the simulator on an Apple Silicon Mac (M1 Max), I get the following linker error:

ld: in /[redacted path]/opencv2.framework/opencv2(opencl_kernels_calib3d.o), building for iOS Simulator, but linking in object file built for iOS, file ‘/[redacted path]/opencv2.framework/opencv2’ for architecture arm64

Any ideas on how to resolve this? Any pointers greatly appreciated.

Thank you.

Someone pointed out in the Swift Forum that I need to build XCFramework to support the slices I want.

Looks like this is supported so what I am going to try soon.