Azure/azure-sdk-for-ios

[FEATURE REQ] Swift Package Manager (SPM) support for AzureCommunicationCalling

Svantulden opened this issue · 5 comments

Is your feature request related to a problem? Please describe.
We are using Swift Package Manager for our dependency management and would like to use AzureCommunicationCalling like this as well. This would help us avoid CocoaPods bloat and make it simple to add the library to our project. Swift Package Manager is also the new leading standard in including libraries on iOS.

I incorrectly assumed that SPM is already supported for this library, due to it being mentioned on this page.

Describe the solution you'd like
Adding the AzureCommunicationCalling library to an iOS project via Swift Package Manager.

Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • Description Added
  • Expected solution specified

Hi @Svantulden we are already tracking SPM support for Calling here: #828

@raosanat is there a reason the link provided claims SPM support?
https://azure.github.io/azure-sdk/releases/latest/ios.html

Thanks for linking that issue @tjprescott, I had searched the issues for 'SPM' and 'Swift Package', but not 'SwiftPM'.

It seems like the library won't support SPM for some time, due to the issues with linking Objective-C (binary) & Swift dependencies for the package. So it's dependent on transitioning the Calling library to Swift or new insights/features in the Swift package system.

To prevent having to use CocoaPods for the library, we also tried using the direct approach as a workaround and include the release as .xcframework in our project (from the link that is in the binary CocoaPods podspec) and linking the Common library via SPM.

However this has two issues:

  • The XCFramework provided doesn't seem to have Module Stability so I'm getting a Failed to build module 'AzureCommunicationCalling'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51)', while this compiler is 'Apple Swift version 5.9 (swiftlang-5.9.0.128.108 clang-1500.0.40.1)'). Please select a toolchain which matches the SDK. error
  • Probably the same issue will occur here as in getting SPM support implemented, where the Objective-C headers for the SwiftPM Common library won't be found

Do you have any ideas for a short(er) term solution?

Hi @Svantulden,

Unfortunately using calling as .xcframework and installing common using SPM is not going to work AzureCommunicationCalling because it is an Objective-C framework and Swift Package Manager deliberately do not support Swift ObjC interface headers by design(see more here) which means is not possible to work together because AzureCommunicationCommon would not emit objc files required for calling to interop with AzureCommunicationCalling if installed using Swift Package Manager.

So common would have to be installed using another dependency manager either Pods or another approach.
That is a bit of a hack but since AzureCommunicationCommon is open source but it doesn't distribute a .xcframework, to make it work would be possible to build an xcframework from source and import both AzureCommunicationCalling and AzureCommunicationCommon as .xcframework.