Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift code completion isn't working

I installed Xcode 6.0 beta and downloaded the iOS8 library Documentation. but when i create a Swift project, try to typing code

func aa(){
    let format = NSDateFormatter()
    var pageData = format.
}

I find Xcode can't dot any property and function. Am I missing any step?

The problem is sloved, typing a whitespace can aid code completion

like image 942
adeewu Avatar asked Jun 06 '14 07:06

adeewu


People also ask

Why is autocomplete not working Xcode?

This can happen when the file is not a member of the Target. Open the file where autocomplete is not working and show the the "Utilities" tab in the top right of Xcode (blue in the screenshot below). Ensure your Target (typically your app's name) is checked.

How do I update my swift code?

You can also update every single Swift Package in your project at once. To do this, open the Files menu, navigate to Packages and then click Update to Latest Package Versions. Afterwards, make sure to test your project to see if everything still works, especially in projects with a lot of package dependencies.

Does Xcode have code completion?

Conversation. Xcode tip #9: Xcode has great code completion built right in, but sometimes as you scroll through the options you might find the names are too long to fit. Fortunately, you can just grab the edge of the autocomplete popup and drag it as wide as you want!

How do I get suggestions in Xcode?

Show/hide completions: ⎋ ( Escape ) OR ⌃Space ( Control + Space ) Type some code, use either ⎋ or ⌃Space to toggle auto-complete (I'm hooked on Escape ), and Xcode will offer a few intelligent suggestions to complete your code.


2 Answers

It's append when you change the hardware type and you choose less than iphone5.

Choose Iphone 6 for example in the list at the right of the stop button and the code completion for 'format' will appear.

like image 174
Nicolaï Philippe Avatar answered Nov 15 '22 06:11

Nicolaï Philippe


I met the same problem and solve it by removing the non-ASCII char in comment (in my problem, it's a chinese char "年" automatically generated in comment by xcode).

btw. "typing a whitespace can aid code completion" doesn't work for me

like image 27
jasonqu Avatar answered Nov 15 '22 06:11

jasonqu