Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add module stability by enabling library evolution support #230

Closed
wants to merge 2 commits into from

Conversation

divaproduct
Copy link

Hi,

If you try to use SWXMLHash as a dependency in a Swift 5.1 based framework you will get the warning:

Module 'SWXMLHash' was not compiled with library evolution support; using it means binary compatibility for 'MyFramework' can't be guaranteed

To be able to use SWXMLHash using Swift >= 5.1 it need to be built with the flag BUILD_LIBRARY_FOR_DISTRIBUTION = YES.
This PR enable it on both the xcodeproj and on the podspec.
This is because otherwise during the pod install phase it will be ignored by cocoapods (see #9232)

For more information check this: ABI Stability and More and this: Binary Frameworks in Swift

Tested using Swift 5.1.3 and XCode 11.3 targetting an iOS project

Regards,
R.

@drmohundro
Copy link
Owner

Hi @divaproduct, thanks for the PR - I'm commenting to 1) let you know I did see this and 2) to let you know I'm sitting on this for a bit... I read a few other comments on this (like Alamofire/Alamofire#2990) where they're holding off on it because of the "the rather extreme restrictions it places on the library's evolution"... I'm admittedly not as familiar with what those extreme restrictions are, but I'd like to understand them prior to enabling this setting. Can you (or anyone else) elaborate on the pros and cons of the setting? Also, it looks like the CocoaPods issue referenced mentions that they might handle this with a future version out of the box?

@divaproduct
Copy link
Author

I am not sure what are the "rather extreme limitations" of enabling this flag. They way I see it is that if you enable it you can keep distributing the lib as source code while also making it easier to create and manage pre-built binaries (without forking). Am I missing something ?

@drmohundro
Copy link
Owner

FYI, see this post on Swift.org - https://swift.org/blog/library-evolution/

From that post, it says (emphasis mine):

Frameworks that are always built and distributed together, such as Swift Package Manager packages or binary frameworks that are internal to your app, should not be built with library evolution support.

and...

Library evolution support should only be used when a framework is going to be built and updated separately from its clients.

Even though many consume this library via CocoaPods or Carthage, I suspect the future direction for pure Swift libraries is via the Swift Package Manager meaning that their recommendations are to not enable this feature. In addition, I wouldn't expect any consumers of SWXMLHash to want to receive a new version of it without also updating both other dependencies and their app, too.

The reasons to not enable this are also mentioned on that post. See the paragraph beginning with:

Enabling library evolution support changes your framework’s performance characteristics...

I hope this helps! I appreciate your interest and contribution regardless. Thanks again!

@drmohundro drmohundro closed this Jun 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants