Why are we using use_frameworks in CocoaPods?

I have used use_frameworks

CocoaPods Podfile

many times. I'm just wondering why are we using it? I couldn't get a straight answer.

Example:

platform :ios, '8.0'
use_frameworks!

target "CityWhether" do
    pod 'Alamofire'
    pod 'SwiftyJSON'
end

      

+68


source to share


6 answers


use_frameworks

tells CocoaPods that you want to use Frameworks instead of static libraries. Since Swift does not support Static Libraries, you must use frameworks.


In another answer, I explained the differences between Static Libraries and Framework:



Cocoa Touch Frames

They are always open source and will be built just like your application. (This is how Xcode compiles it sometimes when you run the app and always after cleaning the project.) The framework only supports iOS 8 and but you can use Swift and Objective-C within the framework.

Cocoa Click Static Libraries

As the name says, they are static. Therefore, they are already assembled when you import them into your project. You can share them with others without showing them your code. Please note that static libraries do not currently support Swift. You will need to use Objective-C within the library. The application itself can still be written in Swift.

Sources: My other answer | AddThis.com Blog

+87


source


You don't need "use_frameworks!" more.

Fast static libraries are now supported in Xcode 9 beta 4 and CocoaPods 1.5.0. The main benefit is faster app launch times, especially if you have a lot of modules - iOS 10 and 11 aren't the fastest when you have a lot of multilingual users.



CocoaPods 1.5.0 was released at the beginning of April 2018 , so you may need to upgrade to get him sudo gem install cocoapods

.

I have found several containers that do not work correctly with static libraries, but nevertheless my mileage changes.

+53


source


Adding

use_frameworks!

The subfile means that we want the listed frameworks to be installed dynamically, not static.

+1


source


use_frameworks๏ผ

declared that you want to use dynamic frameworks and not static libraries .

With the release of Xcode 9.0 and CocoaPods 1.5.0. you can use static libraries with swift if you are not using use_frameworks

.

One use_frameworks

is that all of your frameworks in Pods / Products are frameworks.

Here is a related article: Basic overview of static and dynamic frameworks on ios

+1


source


By default Cocoapods builds Static Library

, if you need Static Framework

you can specify use_frameworks!

in your Podfile.

Until Xcode 9, there was no support for embedding Swift in static libraries, and the use of dynamic structures was required. This was a violation of convention for some developers, especially those worried about the performance impact of running linked dynamic binaries.

With CocoaPods 1.5.0, developers are no longer limited to specifying 'use_frameworks! in their Podfile in order to install modules that use Swift. Interacting with Objective-C should just work. However, if your Swift module depends on Objective-C, it must include the "module headers" (see below) for that Objective-C module.

read more here and here

0


source


use_frameworks!

The podfile demonstrates that it will be supported by iOS 8.0 and later. It doesn't support iOS 7.0 for all cocoapods libraries.

If you want the project to support iOS 7.0 and later, you must uninstall it.

So change is a blow

platform :ios, '7.0' target "CityWhether" do end

-27


source







All Articles