Skip to content

Commit e5ac29e

Browse files
committed
Add info about WMO for CocoaPods
1 parent 3b7319b commit e5ac29e

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,26 @@ Note that incremental builds with minimal changes seem to be a bit slower under
137137
- [Developear - Speeding Up Compile Times of Swift Projects](http://developear.com/blog/2016/12/30/Speed-Swift-Compilation.html)
138138
- [Slava Pestov on Twitter: “@iamkevb It runs one compiler job with all source files in a module instead of one job per source file”](https://twitter.com/slava_pestov/status/911747257103302656)
139139

140+
## Whole Module Optimization for CocoaPods
141+
142+
If you use CocoaPods, you should also consider enabling WMO without optimization in your `Pods` project.
143+
To do that, you have to add the following `post_install` hook to your `Podfile`:
144+
145+
```ruby
146+
post_install do |installer|
147+
installer.pods_project.targets.each do |target|
148+
target.build_configurations.each do |config|
149+
if config.name == 'Debug'
150+
config.build_settings['OTHER_SWIFT_FLAGS'] = '-Onone'
151+
config.build_settings['SWIFT_OPTIMIZATION_LEVEL'] = '-Owholemodule'
152+
end
153+
end
154+
end
155+
end
156+
```
157+
158+
and then run `$ pod install`. Make sure to compare build times before and after this change to confirm there's an improvement.
159+
140160
# Third-party dependencies
141161

142162
There are two ways you can embed third-party dependencies in your projects:
@@ -205,7 +225,7 @@ Builds the app and all test targets. Runs all tests. Useful when working on code
205225
# Use the new Xcode build system
206226
In Xcode 9 Apple [quietly introduced a new build system](https://developer.apple.com/library/content/releasenotes/DeveloperTools/RN-Xcode/Chapters/Introduction.html#//apple_ref/doc/uid/TP40001051-CH1-SW878). This is a “preview” and is not enabled by default.
207227
It can be significantly faster than the default build system.
208-
To enable it, go to Workspace or Project Settings from the File menu in Xcode. There you can switch build systems to the new build system preview.
228+
To enable it, go to Workspace or Project Settings from the File menu in Xcode. There you can switch build systems to the new build system preview.
209229

210230
📖 Sources:
211231

0 commit comments

Comments
 (0)