Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Project 'Pods' - Turn on Whole Module Optimization

Tags:

In Xcode 9 I'm getting the following suggestion for a cocoa pods project: suggestion

What does it do? And, shall I turn it on, or it will break things up?

like image 488
Jonathan Solorzano Avatar asked Oct 13 '17 03:10

Jonathan Solorzano


People also ask

What is whole module optimization?

Swift version: 5.6. Whole module optimization is a compiler pass that can add significant performance gains, and so it's always worth enabling when doing a release build of your app for the App Store.

What does POD Deintegrate do?

GitHub - CocoaPods/cocoapods-deintegrate: A CocoaPods plugin to remove and de-integrate CocoaPods from your project. A CocoaPods plugin to remove and de-integrate CocoaPods from your project.


1 Answers

You can have this automatically enabled each time you run pods install by adding the below post_install script to the end of your Podfile.

post_install do |installer|    installer.pods_project.build_configurations.each do |config|     if config.name == 'Release'       config.build_settings['SWIFT_COMPILATION_MODE'] = 'wholemodule'     end       end end 

In older versions of Xcode you will need:

post_install do |installer|    installer.pods_project.build_configurations.each do |config|     if config.name == 'Release'       config.build_settings['SWIFT_OPTIMIZATION_LEVEL'] = '-Owholemodule'     else       config.build_settings['SWIFT_OPTIMIZATION_LEVEL'] = '-Onone'     end       end end 
like image 180
Mike Vosseller Avatar answered Dec 03 '22 02:12

Mike Vosseller