Xcode 6 isn't autocompleting in Swift

前端 未结 10 757
清酒与你
清酒与你 2020-11-29 15:57

I am trying to import various libraries which I can\'t remember their exact name. Unfortunately Xcode 6 (using swift) isn\'t auto completing th

相关标签:
10条回答
  • 2020-11-29 16:25

    Sometimes it doesn't autocomplete for me either. I think this is due to the fact that Xcode 6 is still in beta. Btw, have you been updating Xcode 6 beta? The latest is beta 5 at the moment. I failed to notice for some time that the App Store does not update Xcode 6 beta, so I was stuck with beta 1 for a while. If you haven't been updating it, then do it. Maybe that will help with bugs like this.

    0 讨论(0)
  • 2020-11-29 16:34

    I have had this happen quite a bit, and yes making sure you are on the most recent beta version does help. Unfortunately you have to download the newest one through the developer portal each time.

    I have also noticed that the the autocompletion goes away when the swift compiler is struggling with compiling something even though it is error free and if you comment out or remove the right line of code the feature comes back as expected. Most definitely resulting from beta quality software.

    A last week I was beating my head against the wall because the swift compiler wasn't playing nice with the sqrt() function. Hopefully these issues are ironed out by the time of full release.

    Sorry there's no real 'fix' yet!

    0 讨论(0)
  • 2020-11-29 16:35

    I find that if my deployment target is 8.1 then autocomplete always works. But it is unreliable if it is not.

    enter image description here

    0 讨论(0)
  • 2020-11-29 16:35

    I find this extremely annoying. Posted answer to clear derived data works bulletproof, however you should close xcode before clearing folder. I've made small script to do the work for me.

    #!/bin/bash
    
    echo "Start fixing xCode"
    echo "Closing xCode"
    osascript -e 'tell app "Xcode" to quit'
    sleep 2
    echo "Clearing DerivedData..."
    rm -rf "$HOME/Library/Developer/Xcode/DerivedData"
    sleep 2
    echo "Launch xCode again"
    osascript -e 'tell app "Xcode" to run'
    echo "Finish fixing xCode"
    

    Now whenever xCode gives me a finger I simply run it. The problem that you need to recompile everything however still persists.

    EDIT

    Thanks to on suggestion in the comments from @Nikolay Spassov, I adjusted the script to capture your home directory instead of changing it. So below step is no longer neccessary.

    OLD Step

    Please note you have to change '/Users/iphonedev5...' part to make it work in your system :)

    0 讨论(0)
  • 2020-11-29 16:42

    If you can't locate all the folders mentioned above or you are too lazy to type in the terminal try the following below:

    •Create a new folder on desktop

    •Go to your application folder copy the Xcode application

    •Paste the application in the folder you created on the desktop

    *Go back to the application folder again and delete Xcode from the application folder. You can delete the Xcode app by using cleanMyMac2 or any other cleaner app so that all such files like com.apple.Xcode and others with go it.

    •After you have done that restart your computer

    •Go to the folder you created early open Xcode you will see the terms and conditions just accept and start your projects

    Good Luck

    0 讨论(0)
  • 2020-11-29 16:45

    This is the same as the correctly chosen answer above but just made slightly easier.

    I've had to do it several times and in my testing you can skip restarting your mac.

    1) Close Xcode

    2) Terminal -> rm -rf ~/Library/Developer/Xcode/DerivedData/*

    3) Terminal -> rm -rf ~/Library/Caches/com.apple.dt.Xcode

    Restart Xcode and it should be back to normal.

    0 讨论(0)
提交回复
热议问题