Xcode 6.3 always does full rebuild of Swift project - ios

One of the long anticipated features of Swift 1.2/Xcode 6.3 is incremental builds. They worked fine for me until recently, but now almost every time I change even a single line of code it does full rebuild.
I tried restarting Xcode, computer, cleaning derived data, but to no avail. Googling doesn't seem to reveal anything.
Does anyone else have this problem? How do I fix it?

I think that this is what you searching for

I am not this is a source of the problem. According to https://developer.apple.com
Swift Performance
A new compilation mode has been introduced for Swift called Whole Module Optimization. This option optimizes all of the files in a target together and enables better performance (at the cost of increased compile time). The new flag can be enabled in Xcode using the “Whole Module Optimization” build setting or by using the swiftc command line tool with the flag -whole-module-optimization. (18603795)

Related

Xcode 14 slow incremental builds

After updating to Xcode 14.0 (happens still for 14.0.1, and 14.1) I felt massive slowdown in incremental build times even if changing just a single property. For my project it's 3x, but read about 10x or more.
To fix that, you simply need to add user defined build setting SWIFT_USE_INTEGRATED_DRIVER and set it's value to NO you can do so by going to project navigator -> select your target -> Build Settings -> Now you need to click on the plus in the section below and tap "Add User-Defined Setting"
Xcode should scroll to the field and focus on it automatically, but if not scroll to the bottom or search for your field in the filter on the right and set your value to "NO"
This topic is covered more broadly on swift forum and this is from where I got this fix
I believe this is a temporary solution, due to some swift driver issues, if I found it to be no longer needed. I'll update the answer. From my own observations, I can't see any parallel compilations tasks being run with the driver on. Only one big emit module for main app target.
Xcode 14.1 has the same bug. Due to the previous answer I've updated from 14.0.1 to 14.1 today and the build times increase from build to build in exponential manner, below tested for the first 10 subsequent compilations without (!) any changes to the code base:
Update: The problem occurs only after the first debug run with or without change the code base.
Interestingly the time cannot understand by sum up the part times shown in the build statistic:
Deleting derived data folder doesn't resolve the problem.
The only working workaround is to close/open the whole project, making some changes, compile, close/open etc.
It's a mess.
The last Xcode update (1 November - Version 14.1.0) fixed the issue for me.
When i updated to 14.0.1 i felt massive increase in the build time, it was extremely slow. Now i can't say is it like before, but for sure it's better.
Here is the summary:
Xcode 14.0.0 - Builds fast
Xcode 14.0.1 - Builds very slow
Xcode 14.1.0 - Builds faster than 14.0.1
You can also try to download and install an older version from here, if the update doesn't work for you.

Xcode 8.3 Indexing & Building Extremely Slow

I am posting this after reading many similar posts on here regarding this issue and none of the solutions that worked for other people not working...
Xcode Version 8.3.3 (8E3004b)
Swift 3.1
Things I tried
Deleting Derived Data folder
Deleting Workspace File
Cleaning Build Folder
Cleaning Build
Reinstalled Xcode (after complete removal)
I also looked for Swift Issues:
Removed all concatenating strings
Cleaned up Swift arrays and dictionaries
Added Whole module optimizations
This all started happening after last Xcode update of 8.3.3. My project was compiling within seconds and now I have to wait at least 15 mins for it to index, then 5 minutes to compile after everything I change even something small in code.
When Building, it get stuck in "Compiling Swift source files". Is there way for me to look in to where it is actually getting stuck?
BIG UPDATE
I tried pretty much everything. Read every article, post, ect. NOTHING worked. My project was created right after 10.0.
Solution
Creating a new project and copying each file worked! It used to take 8-9 minuted to build. Now less than 2 seconds!
Apple knows about this problem, and says that Xcode 9 beta will perform much better. Note that if you don't want to update to Swift 4, you can continue compiling in Swift 3 mode using Xcode 9. The big limitation is that you won't be able to submit your project to the App Store until Xcode 9 goes final.
Also, Xcode 9 contains a new build system. You don't get it by default: you have to turn it on for this project. Choose File > Project Settings and switch the pop-up menu to New Build System (Preview). This is experimental, but it will be the default build system eventually, so it would be interesting to know whether this makes an appreciable difference.
If you don't want to update to Xcode 9 beta, you will just have to do a binary search: comment out all your code and start adding it back, piece by piece, until you find that piece that's causing the trouble.
The best way to work this out is to find what out what the build is doing while compiling your code. This is a really useful tool to use: https://github.com/RobertGummesson/BuildTimeAnalyzer-for-Xcode
When you run this tool it will show you what methods are taking the longest to compile, and then you fix those. Once you have done that, you can also try the answer I gave here to decrease the build times: Extremely long compilation times with Swift in Xcode

Apple Mach-O Linker Warning after xCode Update [duplicate]

I have a slight issue when build my Xcode project, get tones of warning after update pod. It looks like this
Already search the whole site here but still no luck. it doesn't affect the project but it is quite annoying. Anyone could help?
It probably means their binary file has non-aligned pointer when they compile their code. In those cases the alignment basically defaults to 1 byte and hypothetically might impact performance.
After updating to Xcode 8.3 public release I am still seeing this error, so Google might need to compile their static library with different settings to make it go away.
Got this response from firebase support:
This is a known issue with Xcode 8.3 beta, so it might be a beta thing
and Xcode being extra verbose. It works well though with 8.2.1 so I
recommend temporarily use it to avoid the warnings or ignore the
warnings on 8.3 beta if it does not affect your app.
This has been fixed in Firebase 3.16.0 (Firebase Core 3.6 + Firebase Analytics 3.8.0)
guys, it is all fixed now. Tested it all myself on two projects. You got to go to the correct directory of your project so that your pod spec file is visible to your command line commands, run
pod update
and see it all fixed and working properly!
These problems are addressed, and likely fixed, with release 3.16.0.

Extremely long compilation times with Swift in Xcode

I have three iOS projects:
First one - 35k Swift LOC, Swift 2.1 (or 2.0?), compiled using Xcode 7.2.3
Second one - 15k Swift LOC, Swift 2.3, compiled using Xcode 8.2.1
Third one - 15k Swift LOC, Swift 3.0, compiled using Xcode 8.2.1
The compile times for all of these are abysmal (10+ minutes for a clean build), and the development on each one of these is slowing to a crawl.
I have already tried:
Using Whole Module Optimization
Changing C Dialect to compiler default
Analyzing build times for the project and optimizing bottlenecks (a few methods that took 6-10s to compile with array concatenation, nil coalescing operators and such), which shaved like 15 seconds - completely unnoticeable difference
HEADERMAP_USES_VFS = YES
A few other I don't remember now
I'm working on a Mac mini Late 2014 with an SSD, 8GB RAM & 2.6ghz i5, if that matters.
Anyone knows what might cause that, what to do with that or even any workarounds for now? From what I've read on SO and other places, it seems like an unresolved compiler issue.
EDIT: Yes, I'm using Cocoapods for dependencies. I'll try moving to Carthage and see what happens.
Try set the following in Build Settings as a workaround. I am assuming you have just one Target.
Set the Build Active Architecture Only to Yes.
Set Optimization Level to None [-Onone]
Add User-Defined setting called "SWIFT_WHOLE_MODULE_OPTIMIZATION" with the value "YES"
Empty your derived data and build.
You can also then use this tool to analyze any slow compiling Swift files: https://github.com/RobertGummesson/BuildTimeAnalyzer-for-Xcode
I was experiencing build times that were taking 6-7 minutes. I moved away from Cocoapods and started using Carthage which helped for clean builds. Even then builds were still taking 3 minutes. The biggest improvement came with the steps I mentioned above.
Update
Instead of adding the User-Defined setting, on your Debug build set the Optimization Level to 'Fast, Whole Module Optimization'. Then in Other Swift Flags for your debug build add '-Onone'.
It's an open issue on swift's site: https://bugs.swift.org/browse/SR-6037
Hopefully they'll fix it soon.

How to remove the Xcode warning Apple Mach-O Linker Warning 'Pointer not aligned at address

I have a slight issue when build my Xcode project, get tones of warning after update pod. It looks like this
Already search the whole site here but still no luck. it doesn't affect the project but it is quite annoying. Anyone could help?
It probably means their binary file has non-aligned pointer when they compile their code. In those cases the alignment basically defaults to 1 byte and hypothetically might impact performance.
After updating to Xcode 8.3 public release I am still seeing this error, so Google might need to compile their static library with different settings to make it go away.
Got this response from firebase support:
This is a known issue with Xcode 8.3 beta, so it might be a beta thing
and Xcode being extra verbose. It works well though with 8.2.1 so I
recommend temporarily use it to avoid the warnings or ignore the
warnings on 8.3 beta if it does not affect your app.
This has been fixed in Firebase 3.16.0 (Firebase Core 3.6 + Firebase Analytics 3.8.0)
guys, it is all fixed now. Tested it all myself on two projects. You got to go to the correct directory of your project so that your pod spec file is visible to your command line commands, run
pod update
and see it all fixed and working properly!
These problems are addressed, and likely fixed, with release 3.16.0.

Resources