CocoaPods pod-linkage plugin. In SwiftKey, we have a dynamic framework that we use to share code between the app and the keyboard extension, and all the pods are linked statically except for some of them that are linked dynamically because they are linked to the app and keyboard extension too.
~> (the optimistic operator) is used when you want to specify a version 'up to next major | minor | patch'. For example: ~> 0.1.2 will get you a version up to 0.2 (but not including 0.2 and higher)
The use_modular_headers option generates module maps for Swift and Objective-C pods instead of generating frameworks. See http://blog.cocoapods.org/CocoaPods-1.5.0/ Attached is an example project (AppCode 2018.1, Xcode 9.3, Swift 4.1)
:search_paths The target inherits the search paths of the parent only.
use_frameworks!
tells CocoaPods that you want to use Frameworks instead of Static Libraries. Since Swift does not support Static Libraries you have to use frameworks.
In another answer, I explained the differences between Static Libraries and Frameworks:
Cocoa Touch Frameworks
They are always open-source and will be built just like your app. (So Xcode will sometimes compile it, when you run your app and always after you cleaned the project.) Frameworks only support iOS 8 and newer, but you can use Swift and Objective-C in the framework.
Cocoa Touch Static Libraries
As the name says, they are static. So they are already compiled, when you import them to your project. You can share them with others without showing them your code. Note that Static Libraries currently don't support Swift. You will have to use Objective-C within the library. The app itself can still be written in Swift.
Sources: My other answer | AddThis.com Blog
use_frameworks!
tells cocoa pods to use dynamic libraries, and was very prevalent at one point due in particular to swift not supporting static libraries, meaning there was no choice - however you often don't need use_frameworks!
anymore.
As of Xcode 9 beta 4, and CocoaPods 1.5.0, swift static libraries are now supported. The main advantage is faster app startup times, particularly if you have a lot of pods - iOS 10 and 11 are not the fastest when you have many dylibs.
CocoaPods 1.5.0 was released in early April 2018, so you may need to upgrade to get it: sudo gem install cocoapods
.
I've found several pods that don't work correctly with static libraries yet though, so your mileage may vary.
use_frameworks!
declares that you want to use dynamic frameworks, instead of static libraries.
With Xcode 9.0 and CocoaPods 1.5.0 released, you could use static libraries with swift if you do not use use_frameworks!
.
One problem with use_frameworks!
is that all your framework in Pods/Products are frameworks.
Here is a related article: Basic overview of static and dynamic frameworks on ios
Cocoapod's[About] use_frameworks!
is responsible for the type of binary:
use_frameworks!
is present - dynamic framework
use_frameworks!
is not present - static library
use_frameworks!
has a reflection in Mach-O Type
[About] in a corresponding target of Pods
project.
Timeline:
use_frameworks!
which you had to use for Swift pod[Vocabulary]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With