i am learning swift programming language. Unlike objective-c , it does not have automatic method suggestion and variable replacement. Is there any trick or setting for automatic method suggestion in swift?
Thanks in advance.
If you're referring to autocomplete, Swift does have autocomplete, but it's buggy and sometimes breaks. If it's not working, try deleting the derived data for your project and letting it re-index. The directory should be at ~/Library/Developer/Xcode/DerivedData/
Related
I have noticed that the coding style in Swift appears to be to put braces on the same line as a method signature or if statement etc. Without getting into a debate about which is right or wrong, my aim is simply tom get Xcode to put the braces on a new line when it does its auto completion and for the new file templates.
I've tried the advice here and it doesn't work: https://forums.developer.apple.com/thread/23087
I'm using Xcode 8.1 on Sierra.
Has anyone else been able to get this to work?
Thanks,
Alan
You can use below methods in conjunction to accomplish this task.
ClangFormat and Uncrustify
Above method will only change the default statement templates and not the inbuilt methods formatting. (i.e autofilled viewDidLoad() method will still have the braces in the same line.) For this you should consider using these plugins. They have options to save the file with specified format.
(UPDATE Snippet Edit no longer works)
Snippet Edit
Snippet Edit is a small program that is used to edit the Xcode's standard code snippets. We have to do this way because there is no direct way to change the code style in Xcode settings and XCCodeSenseFormattingOptions is not supported since Xcode 4
You can follow below screenshot for reference. Remember to restart Xcode once you are done with editing.
So, I started learning with the 3.0 RC1 version of the Godot Engine and I noticed, that code completion isn't working. No suggestions, no completions, nothing. Only highlighting and bracket completion works. Is that because of the RC1 or am I missing something? Code completion is enable in editor settings.
Thanks alot.
Greetings, Nils
Since Godot 3.1 you can use typed variables in GDScript like this:
var myTexture : ImageTexture
And then autocomplete will work a little better for those. Otherwise Godot can not always figure out what type your variable is.
Solved this myself. I just weren't writing the code inside the scene functions.
I have noticed that the coding style in Swift appears to be to put braces on the same line as a method signature or if statement etc. Without getting into a debate about which is right or wrong, my aim is simply tom get Xcode to put the braces on a new line when it does its auto completion and for the new file templates.
I've tried the advice here and it doesn't work: https://forums.developer.apple.com/thread/23087
I'm using Xcode 8.1 on Sierra.
Has anyone else been able to get this to work?
Thanks,
Alan
You can use below methods in conjunction to accomplish this task.
ClangFormat and Uncrustify
Above method will only change the default statement templates and not the inbuilt methods formatting. (i.e autofilled viewDidLoad() method will still have the braces in the same line.) For this you should consider using these plugins. They have options to save the file with specified format.
(UPDATE Snippet Edit no longer works)
Snippet Edit
Snippet Edit is a small program that is used to edit the Xcode's standard code snippets. We have to do this way because there is no direct way to change the code style in Xcode settings and XCCodeSenseFormattingOptions is not supported since Xcode 4
You can follow below screenshot for reference. Remember to restart Xcode once you are done with editing.
I've upgraded my IOS4.3 app to IOS5 and am getting compile errors. From what I can tell, the syntax looks fine, but the compiler is complaining of "Unexpected #" when I synthesize properties, but only in some classes.
I also have an "Undeclared identifier" in one ViewController's viewDidLoad method.
I've performed a clean build and I'm guessing that there's a default setting which has been changed somewhere, but from scouring around this doesn't seem to be a common issue. Is there a list of common breaking changes anywhere?
EDIT:
This screenshot is one of my ViewControllers, which is derived from UITableViewController
There is a missing # in the line self.title = NSLocalizedString(...). The second parameter doesn't have the leading #.
Coming from a .NET/PHP background, I have very little experience with compilers. The problem was that Apple seem to have changes the default compiler for IOS5 from GCC to LLVM, hence the difference in syntax. It would be nice to be able to use the newer compiler, but GCC's the only one which gets anywhere near close.
I installed the iPhone SDK 3.2 in my mac mini. my problem is, i am using UITableview* i want to get the properties of the tableview i.e, when i am typing tableview. and press escape i have to get the corresponding values instead i am getting "No Completions found" if i am typing the wanted property and build i am not getting any errors.
Try this for autocompletions [UITableview ...] where ... is where you type.
Xcode will only autocompletes on method calls and properties, as well as when you start typing the class type for a declaration. However the class name itself is up to you.
So in your example UITableView* ... it cannot autocomplete because it is up to you to declare the instance name (although a mind reading autocomplete would be nice sometimes!)
Hope that helps.
This is not the place for that question. The FAQ writes:
If your question is about […] general
computer software or hardware
troubleshooting, ask on Super
User.