phrase / ios-sdk

Phrase Over the Air iOS SDK
https://phrase.com
Other
14 stars 3 forks source link

Support for Swift Package Manager #24

Closed cheif closed 3 years ago

cheif commented 3 years ago

Now when there's support for binary dependencies in SPM, it would be great if we could use SPM for the phrase-sdk as well.

Here's some info about how it's done. https://developer.apple.com/documentation/swift_packages/distributing_binary_frameworks_as_swift_packages

If I understand it correctly this would require a .xcframework instead of the current .framework, then it should just be a matter of writing a small Package.swift

winkelsdorf commented 3 years ago

Hello @cheif,

Thanks for the good suggestion for improvement! That's right, since the release of Xcode 12/Swift 5.3 last month, the Swift Package Manager finally supports binary frameworks (using the mentioned .xcframework with its platform slices). We will check this internally as soon as possible and discuss the necessary changes and adjustments to our release process.

I'll leave this ticket open and get back to you as soon as we have any updates on this.

Best regards, Frederik

tonnihyldgaard commented 3 years ago

Hi @winkelsdorf, We are working a prototype for one of our apps, and would like to hear if there's been any updates to when the Xcode 12 / Swift 5.3 with/without SPM support hits GitHub? :) Thank you 🙏

winkelsdorf commented 3 years ago

@tonnihyldgaard The SDK is already Swift 5.3 / Xcode 12 ready since v2.0.0 (which enables Module Stability), just without SPM package. Feel free to use CocoaPods or Carthage in the meantime :)

srdanrasic commented 3 years ago

Hey @winkelsdorf. What is the reason SPM is not supported already?

winkelsdorf commented 3 years ago

Hello @srdanrasic,

Gladly I try to give some more insight.

So far we use a framework which contains different architectures as fat binary, which are splitted automatically (CocoaPods) or manually (see Phrase SDK Support pages) during the integrating build process.

The Swift Package Manager did not have support for binary frameworks prior to Swift 5.3, which was released about 7 weeks ago. The Swift Package Manager now relies on Universal Frameworks (xcframework). We still support older Xcode and iOS versions but xcframework require Xcode version 11.0+.

We try to adapt the release process while maintaining support for different older iOS and Xcode versions.

For Carthage and CocoaPods there are still known problems with xcframeworks: 1) https://github.com/Carthage/Carthage/pull/2881 2) https://github.com/CocoaPods/CocoaPods/issues?q=is%3Aissue+is%3Aopen+xcframeworks

We want to refrain from supporting different frameworks (Fat Binary and xcframework). This is the reason why there has not been a release with support for the Swift Package Manager in the last weeks, yet.

I hope this brings some clarity. Support for SPM will of course still be provided as soon as possible. Sorry for the inconvenience caused by the delay.

srdanrasic commented 3 years ago

Thanks for the detailed answer @winkelsdorf.

With the announcement of new ARM based Macs, I think that support for xcframeworks might be needed sooner than later in order to support multiple ARM slices in a single binary framework.

I've already built a number of xcframeworks, so feel free to reach out if you stumble upon any issues when you decide to do the same.

winkelsdorf commented 3 years ago

@srdanrasic Absolutely right, we're aware of the current (major) changes Apple's Platform is undergoing. I forwarded this to our team for discussion. Keeping you updated as soon as there are any news.

tonnihyldgaard commented 3 years ago

Hey @winkelsdorf is there any update on expected deadline for SPM support? :)

winkelsdorf commented 3 years ago

@tonnihyldgaard et all: Expected very soon, within the next week. All tests currently look very promising. Keeping you updated here.

Screen Shot 2021-01-21 at 13 42 58
winkelsdorf commented 3 years ago

@all New version is live. Looking forward to your feedback.

Use the git url in Xcode to add the package: https://github.com/phrase/ios-sdk.