(Xcode 6) - Code completion not work (UIKit, Foundation...) - swift

I need help with Xcode 6.
It only happens with the project I'm working with. For the other one, code suggestion works.
What's wrong with my project?

The answer was to delete ~/Library/Developer/Xcode/DerivedData/ModuleCache (while Xcode is closed)

I have been researching the same issue on StackOverflow and here are what most threads suggest: delete Derived Data folder files (or maybe just the files relevant to your troublesome project!). It worked for me hence this answer. Details below:
Fix manually by deleting all the files in ~/Library/Developer/Xcode/DerivedData
Note: If Library folder is new to you, follow this CultOfMac article:
Library access on.
Open a Finder window and then navigate to the Home folder. That’s the one represented by the cute little house icon over in the sidebar. If you don’t see it, click on something like the Desktop or Documents folder, and then Command-click on the title bar of the window. You’ll get a drop-down menu that shows the file path of the current folder, which–if you’ve picked a folder from your Home directory–will show the Home folder somewhere in the list. Click on it to go to the Home folder.
Now, once you’re there, hit Command-J to bring up the View Options panel. You’ll see a checkbox to “Show Library Folder” somewhere in that panel, depending on the view your Finder window is in. Simply check it to show your User account’s Library folder. Now you can go in there and mess around to your heart’s content.
Note: Some StackOverflow members suggested pressing 'Escape' key or Command and + keys after the dot (.), others suggested typing a white space (control+space bar). However, your post seems to suggest it's project-specific (works for the other project) so it may prove useful to try different approaches. Hope this helps.

Swift files will NOT have code completion for UI classes (e.g. UIImage, UIDevice) unless there is an "import UIKit" at the top of the file.

Related

how to remove google sign in button in eclipse

I'm facing a wierd problem. My eclipse, has a google signin button which is occupying some of the space which I do not want to happen. Initially it had "Sign-in to Google" text along with it. I've followed some blog post and set accordingly to show just the icon (I don't remember that blog post link).
But now, the icon is getting replicating .. it is being shown 12 times. It is actually creating childs :P
I've gone through all the options present in Customize Perspective menu, none of them had this button listed. Can someone help me in removing that google sign button from my perspective? One possible suspect is- my eclipse crashes when I suspend and wakeup my machine.
You can use the Window > Reset Perspective... menu command to reset the perspective to its default state, which might eliminate that toolbar and buttons. If that fails, I would create a new workspace and import the projects into it using File > Import > Existing Projects into Workspace.
If you want to try to salvage your existing workspace, it's possible to do so my manually editing Eclipse's internal file that stores your Workbench layout, but it's a bit tricky. Here are the steps I've followed to eliminate a similar repeated toolbar item:
Exit Eclipse.
Find the Workbench layout file, it's path is <workbench>\.metadata\.plugins\org.eclipse.e4.workbench\workbench.xmi. Make a backup of this file before you touch it - this is essential because it's easy to corrupt the file if you change the wrong things.
Open the file in your favorite XML-aware editor - most packages of Eclipse include the XML editor that works just fine1, but be aware that if you use Eclipse to edit the file you can't have Eclipse open on the workspace that contains the workbench.xmi you want to edit.
Find the section of <trimBars> nodes in the XML; from there you have to determine which <trimBars> node you need to edit. In your case it looks like a vertical one, probably with a side="Right" attribute.
Under the correct <trimBars> node you'll find multiple <chlidren> nodes, each with an elementId attribute that should help you identify it; you're looking for <children> nodes that are identified as something related to the Google plugin.
Delete the <children> nodes that seem related to the unwanted toolbar buttons. In your case, it appears that there is an entire toolbar that you might want to eliminate, so you might want to delete the entire containing <trimBars> node.
Save the file and start Eclipse on that workspace.
1Some packages of Eclipse include EMF tools that will open it in a special XMI editor that does not provide a view of the source, only a structural tree view. Depending on how you like to work with XML, this might be easier than editing raw XML.
This is not a perspective but a view. You can hover over that bar with the buttons and click Alt+Shift+F1 to check where this View comes from. Then you can either disable/uninstall the contributing feature (Help -> Installation Details) or check where the feature came from.
If it comes from the IDE, you can open a bug for it. If it is contributed from a third party plugin, contact the developers of that plugin.
There is an eclipse bug concerning duplicate view toolbar buttons in Luna that has recently closed as well. Maybe this solves your problem as well.
Edit: Taken from this bug:
root cause is that in Luna 4.4M5 WorkbenchWindowControlContribution.createControl is called twice, the
first time with a null value for
WorkbenchWindowControlContribution.getWorkbenchWindow() while it is
still being created. This is related to what has been reported here
https://bugs.eclipse.org/bugs/show_bug.cgi?id=427452
second cause is that my createControl(Composite parent) method was calling PlatformUI.getWorkbench().getActiveWorkbenchWindow() instead
of WorkbenchWindowControlContribution.getWorkbenchWindow(). This
resulted in an attempt to create a new Workbench Window, which
recursively calls createControl() again. This has already been
reported here https://bugs.eclipse.org/bugs/show_bug.cgi?id=366708

Xcode Base internationalization doesn't work

I'm trying to localize my app.
I noticed that if I add a language every localized file become doubled.
In this way it's impossible to maintain code or storyboard so I learnt that I need Base internationalization.
The problem is that when I select that checkbox in xcode project setting it shows a window without nothing to select, does anyone know how to fix this?
Here's a screenshot
First, you need to go to your storyboard file, open the bar on the right side, and go to Show the File Inspector, the furthest tab to the left. Then, scroll down and click localize. After this, when you check Use Base Localization, you should see the storyboard appear.
This could happen if Base Internationalization was active before then disabled and files deleted manually.
Create Base.lproj folder in your project folder using the finder.
Move your main story board to it also using the finder.
fix the reference to it from Xcode.
remove app. from device, clean & build your project.
All will be back to normal.

Show the name of the containing folder in the Eclipse tab of a file

I have the same set of files in N folders, one of them, say, blank.xhtml. The files contain somewhat similar information and it is becoming overwhelming to figure out which file comes from which folder every time I switch between the tabs. When I open one of them to edit and happen to open a file with the same name from another folder I get confused and more often than not end up editing the wrong file: nullifying my hard work. So I am wondering if there is a way to show the name of a containing folder in the tab like this G-06/blank.xhtml or G-07/blank.xhtml. I will be very very thankful to anybody who has pointers to how I can make this happen.
As an addition to the Maroun's answer there is an alternative solution.
It's not exactly what you want (full name in the tab's title), but may be useful sometimes.
In the "Project Explore" view (the same goes to "Navigator" view) click the "Link with Editor" button. That way, whenever you choose some file opened in the editor, it will be automatically selected/highlighted (see the picture) in the "Project Explorer" view.
Here is the picture:
Maybe this will be useful to you too.
If you hover the mouse over the tab containing the file name then a popup appears showing the full path. Not exactly what you wanted, but it should help. (This with Eclipse Neon.3 Release 4.6.3 on a Mac).
Not quite what you're looking for, but ctrl+shft+e will open the switch editor window that shows all the open editors with their filepaths. I use this shortcut for the same reason. I'll have multiple build.gradle files open from multiple projects and this helps pick the correct one

Files missing in XCode 4 Project Navigator after archiving

I'm currently trying to create version 1.1 of a project I created in XCode 4, but after archiving the files do not appear in the Project Navigator. My initial thought was that I had to clone my repository (git) and thus create a new version in which I could see the
files, but the clone is also missing the files.
I can access the files from the top bar, but that's not really a desirable solution when
working with a big project. The case is the same for another project that I have archived
so I suspect it is supposed to be a feature of XCode 4.
What am I missing here?
(I'm just combining your "nevermind, I found it" comments into an answer, to maintain the SO style, so this question doesn't pop up as needing an answer.)
Check that you're not filtering file names (left column, bottom.)
Also make sure you haven't pressed one of the "show only files with..." toggle buttons (same location, near the search entry.)
Note that these buttons are toggles
Yes. I had to hit the X button with the icon that was blue at the bottom. This corrected my issue for XCODE Version 6.1. Thanks.

Eclipse: shortcut for "open project"?

Is there a shortcut in Eclipse for "open project"? Ideally, I'd like something like the "Open Resource" dialog.
I want this because I have a "testing" project, which I use whenever I want to try something out… But it's annoying to scroll through the massive Navigator trying to find it and click it when it gets closed.
Not by default. The action is defined here, with no keyboard shortcut.
http://eclipse-tools.sourceforge.net/Keyboard_shortcuts_(3.0).pdf
You could add a Working Set that contains only your test project, and use 'Select Working Set...' functionality from the Navigator tab's view menu:
While this won't open the project for you, it WILL make it the only thing you see in navigator or package explorer.
Once you've added it, it will be in a list and you won't need to open the 'Select Working Set...' dialog, just select 'my test project' from the popup menu. It's triggered by that small triangle in the upper right of Navigator, I'm not sure if there is a shortcut.
To switch back to your normal work, simply 'Deselect Working Set' and you will then see everything again.
I also find the 'Collapse All' button/shortcut to be handy when finding things in the Package Explorer or Navigator tabs.
I'll offer a solution to a problem I've had which, if I've interpreted the question correctly, is very similar to yours.
I find that when I have a lot of projects with loads of expanded directories/packages inside Project Explorer, trying to find a particular project is irritating because I have to scroll through all this. I could collapse all projects down but then I also lose my current position in every project.
I'd just like to be able to search for a particular project by name and open it, in the Project Explorer tree. Opening a file inside the project using Open Resource isn't a good enough workaround, as having to think of the name of a file inside that project completely out of context is often equally annoying!
A solution that works great (at least in Eclipse Juno, Mac OSX) is, with the Project Explorer focused, to hold Shift and start typing the project name. This dynamically selects the best matching project in the Explorer as you type. Then with your hands still on the keyboard you can use the arrow keys to open up and browse the project.
It ain't pretty but it gets the job done, and saves some valuable seconds :)
You could also:
switch workspace (in a workspace with only this test project in it) (no shortcut: you can define one)
install mylyn and select a "test" task (which would immediately empty your Navigator view, leaving only the relevant classes/methods).
If the test project is already opened and you know the name of the class in it, you could go to this class with Navigate -> Open Type (There is a shorcut also, on mac osx is Shift + Command + T)
I find it easier to move with this method, but I didn't know it until someone else showed me, maybe it helps.
You can set a shortcut at Preferences->General->Keys, search for Open Project. However, for me it does not work from the editor itself. I have to click the package explorer, for example. Also, if you have a lot of projects, there will be a huge list of them as well, as expected.