Xcode 6.1 swift autocomplete and code sense broken - ios

I am using Xcode Version 6.1 (6A1052d), it is working well except the only problem is auto complete and code sense is broken for swift projects.
I can fix it by deleting derived data and the folder ~/Library/Caches/com.apple.dt.Xcode, which is described here, or changing the deployment target of the project from 8.1 to 8.0.
However, the first solution only last me for 1 or 2 days, out of no where it doesn't work again, I don't want to delete the folders every so often or change the target iOS versions all the time. Please help me.

I have had the same issue for many days while working in swift, finally I have deleted some old data in the directory ~/Library/Developer/Xcode/DerivedData and started the xcode again and error is disappeared.
Hope it helps!

it's not gone .. I do this procedure 3-4 times a day while coding .. did anyone find a permanent fix? I'm on Xcode 6.3 beta on Yosemite.. on 6.1 I had to do this process more than 5-6 times per day, but they did not fix it entirely :(. I observed that working in one file and not switching back and forth really delays this from happening + if you work with collection views or table views and switch and modify in all files of your MVC architecture, there are greater chances you will need to restart Xcode (which in 6.3 beta fixes this issue automatically). If only there was a way to force a re-indexing on the project ..

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 editor taking too much time in compiling

I'm a newbie in Swift. I just created a new single view project in xcode9.3 and tried building it and its taking forever to compile.
Why is this so?
I have had something similar to this, and I found that restarting Xcode a few times should solve the problem.
If this doesn't work, you might want to download the latest version of Xcode. As of now, I think the latest non-beta version is 9.4.1.
Had the same issue in the past.
The swift compiler have some issues with specific code styles which makes it sometimes compile files even slower.
In the end we quit Swift as a development language and moved to React Native and back to Objective-C on iOS projects as swift became too cumbersome.
Moving forward, you might want to look at some of guides out there.
This two looks promising.
https://medium.com/rocket-fuel/optimizing-build-times-in-swift-4-dc493b1cc5f5
https://github.com/fastred/Optimizing-Swift-Build-Times
Back when I was working on swift, this was guide we were using as a guideline:
Part 1
Part 2

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

Xcode 7.3.1 autocomplete code completion not working

Ever since Xcode 7.3 the autocompletion or code completion doesn't work properly.
I have tried:
Deleting Derived Data folder
Clean Targets and Build
Reinstalling Xcode
It does autocomplete after you type it out fully the first time. But if you haven't referenced it once (i.e. like enums) it only shows what you typed out before (not showing full list of enums). Pressing escape doesn't help either.
Any other suggestions? Or anyone else experiencing the same?
Without doing anything, In Build-Settings -> Deployment changing iOS Deployment target from 8.0 to 8.1 resolved the issue for me.
It also works for XCode 6 as mentioned here
Also works on Xcode 8, Simply change the deployment target from iOS 9.0 to iOS 9.1.
Xcode 8 has now fixed this very annoying autocomplete issue. So anyone who is still having this problem, update to Xcode 8.
Edit: Please note, this has not solved for others. So your milage may vary. For me, it has fixed without doing anything extra. But they are using their new 'intelligent' autocomplete. Thinking about it, it could be part of the indexing. Deleting the DerivedData folder could help.
Perhaps, this answer is too late, I'll share it anyway.
First of all, I've uninstalled Alcatraz and all plugins.
Second, I've followed ElonChan's instructions explained on:
Xcode 7.3 autocomplete issues
As a result, autocompletion automagically got back! Thanks #ElonChan.
I hope this answer also solves your problem.
This Happen usually when you are using core Data in your project.(because of automatic indexing of files by xcode not been done) The simple way to avoid this thing is that just click to your project name and clean project come back the same file where you wanna see suggestions type any word and thats it.
There is a way to set shortcut keys for code completion. Xcode -> Preferences -> Key Bindings -> find Show Completions and set whatever non-duplicate keys you want.

Can Xcode 4.6.x and Xcode 5 share project directories?

After installing Xcode 5 I immediately noticed it bringing up the windows/projects from a previous Xcode 4.6 session. Of course this is expected behavior if I am upgrading, but since this is only a preview/beta release it made me a bit nervous....
Is it reasonably safe to let Xcode 5 and Xcode 4.6.2 point to the same project directories (maybe not while running simultaneously?
Yes, it is perfectly fine and I have been using mainly XCode5 but switching to 4.x every once in a while. The only thing to be careful of is when opening some files, it may ask if you want to convert them to XCode 5 format. If you do, you will not be able to open that file in XCode 4.X anymore (or so the warning says, I've never clicked yes).
JSdodgers's answer is perfectly valid.
Upgrading XIBs is a big pain.
Note that you won't be able to use every new XIB feature in Xcode 5 if you don't use the Xcode 5 format.
The best solution is to have a separate branch (git or svn) for your iOS 7 code.

Resources