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

Allow static library usage from Cocoapods #74

Open
bridger opened this issue Feb 10, 2018 · 5 comments
Open

Allow static library usage from Cocoapods #74

bridger opened this issue Feb 10, 2018 · 5 comments

Comments

@bridger
Copy link

bridger commented Feb 10, 2018

Version 1.4.0 of Cocoapods allows a pod to be used as a static library, even in a Swift app. It requires the library's podspec to contain s.static_framework = true.

I believe this will help apps launch faster. Here's a blog post that explains why too many dynamic frameworks slows down launch: https://blog.automatic.com/how-we-cut-our-ios-apps-launch-time-in-half-with-this-one-cool-trick-7aca2011e2ea

@evgenyneu
Copy link
Owner

Hi @bridger, thanks for the update. If we add s.static_framework = true to the podspec file, what will happen to people who want to continue using our library the old way? Will it break things?

@bridger
Copy link
Author

bridger commented Feb 11, 2018

Honestly, I'm not sure... I guess the dynamic framework is nice if you don't want to repeat the binary size in each extension, like an Apple Watch binary that also uses Keychain?

For keychain-swift I'd imagine that binary size concern would be tiny. If people still needed to, they could make their own dynamic framework target which depends on keychain-swift then make their app and watch extension depend on that framework.

@evgenyneu
Copy link
Owner

That's good to know, thanks. I will do some Googling to see if there are any side effects that can affect our current users. In addition, I wonder if there is a way do switch to static framework on the client side, in Podfile instead of doing it for everyone in the podspec of the library?

@evgenyneu
Copy link
Owner

evgenyneu commented Feb 11, 2018

For the referece, I've asked about the side effects of static_framework=true on stackoverflow.

I can see two potential problems:

  1. One possible issue for us would be other dynamic frameworks that depend on keychain-swift. We may break those frameworks if we add static_framework = true, since dynamic frameworks can not depend on static ones (they say).

  2. If we add static_framework = true to the podspec, we will impose this for all users. But some users may not want that. I wonder if there is a way for the user to decide if they want the library to be static or dynamic?

@bridger
Copy link
Author

bridger commented Feb 12, 2018

Thanks for digging into this! Sorry it is more complicated than I thought it would be.

It would be awesome if CocoaPods allowed the app to choose whether it is imported statically or dynamically, but that option doesn't exist. I think Carthage allows the user of the library to choose. Let's see if the CocoaPods peeps will comment on what to do.

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

No branches or pull requests

2 participants