Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can enabling static_framework in podspec break existing apps?

I'm maintaining a library written in Swift and distributed via CocoaPods. Since version 1.4.0 cocoapods introduced the static_framework=true setting the podspec file. Recently, a user of the library asked me if I could add static_framework=true setting to the podspec file of the library.

Naturally, I'm worried that if I do that it may introduce problems for existing library users. Can anything go wrong with enabling static_framework=true? Are there any possible negative side effect for my library users?

like image 509
Evgenii Avatar asked Feb 11 '18 04:02

Evgenii


People also ask

What is Podspec in Cocoapods?

A Podspec, or Spec, describes a version of a Pod library. One Pod, over the course of time, will have many Specs. It includes details about where the source should be fetched from, what files to use, the build settings to apply, and other general metadata such as its name, version, and description.

What is Podspec file?

A Podspec file, or Spec, describes a version of a Pod library. It includes details about where the source files are located, which files to use, the build settings to apply, dependencies, frameworks used and other general metadata such as the name, version and description for the Pod.

How do I add files to Podspec?

To create a Podspec, navigate to your project file in the Terminal. Run the following command to create the file: touch FantasticView. podspec . Now open the file using an editor.

Does Cocoapods support XCFramework?

Cocoapods too supports the distribution and consumption of XCFramework.


1 Answers

Here are two downsides of using static_framework:

  • Any CocoaPods that depend upon a static_framework CocoaPod will also need to be static frameworks.
  • Static Frameworks won't be shared across extensions leading to possible code bloat. See here.

And two upsides of using static_framework:

  • Allow static library and binary static vendored_framework dependencies.
  • Libraries get linked at build time instead of load time.
like image 129
Paul Beusterien Avatar answered Sep 24 '22 13:09

Paul Beusterien