Toggle between .m and .h file in Xcode 9 - xcode9

With Xcode 9 cmd+ctrl+โ†‘ no longer toggles between .m and .h files but jumps to the previous counterpart which results in annoyingly navigating between .m, .h and test cases files. Anyone knows a shortcut just to toggle between interface and implementation files?

Related

Xcode will not open the ViewController.swift source files

I am in the Xcode editor. I can view the Main.storyboard or edit most of the source files. But for some reason the [*]ViewController.swift files will not display in the Editor section. What is going on?
The screenshot below shows that after hitting "enter" on the SecondViewController.swift instead of opening it in the editor the experiments.js remains. The same thing happens for SecondViewController.swift. However other .swift files do open properly.
I had edited those *Controller files in the past so this is bizarre. Any tips?
Observe how the icons are dimmed in the two ViewController files compared to experiments.swift
This usually means that the files are not where Xcode thinks they are. Check the path in the Document inspector and if needed use the widget in the inspector to correct the path or you can add the files again from their current location.
Maybe you moved the files outside of Xcode during organising or refactoring to cause this.

Show authors of .pbxproj, .xib, .storyboard in Xcode?

Is it possible to show Authors in files that are not .swift, .m, .h etc. in Xcode 11+?
For example .pbxproj, or .xib or .storyboard Interface Builder files.
"Show Authors" via โŒƒโ‡งโŒ˜A is not working, as it does for text source files.

Add both .h and .m files in Xcode

When I add a new file in Xcode 6.3.2 I see templates for the .m and .h file but how do you add both at once?
I'm sure there used to be a way of adding both at once.
The option has been moved into the more generic "Cocoa Touch Class" template, which allows you to make the class in either Objective-C or Swift.
Complete the name of your pair of files with the default prefix filled-in for you. Choose the superclass such as NSObject. Choose the Objective-C language. Click the Next button, then choose the folder location where to save your pair of new .h and .m files.
You can do this by add new file and "Cocoa Class"

Xcode 5 can't open .m file

I installed Xcode 5 a few hours ago. I opened my project with it. I have several .h and .m file in my project. I could view all of them except one of my .m file. When i clicked that .m file, the cursor became rainbow and nothing happened.
To be sure , i checked my project folder, go to the that .m file and click get info. I could see the preview of that file. Also i could open it in text editors.
I couldn't find the problem. Any advice is appreciated.
Best Regards,
Taha
I created a new project to check that .m file. And the result is positive. But still i can't open that .m file in my real project.
Weird solution but works for me.
1) Delete .h and .m files.
2) Right click on xx.xcodeproj and click show package contents.
3) Delete project.xcworkspace.
4) Add .h and .m files again.

XCode has lost associating from xib to .h file (MonoTouch)

When I am editing an XIB in XCode I don't get the associated .h file to show up in the assistant editor window. Other XIB's work fine.
This is a problem as it's the way I create outlets by dragging onto the assistant window. If I open the .h file manually in another window I can't associate an outlet this way either. The .h file exists.
Also, my project is MonoTouch and therefore I invoke the opening of the file from MonoTouch. I assume it's a problem originating in MonoTouch and not Xcode.
Someone please help, or I will be forced to learn Objective C soon and quit with this MonoTouch business.
Sometimes there is a different solution, such as when the controller file is RENAMED.
When this happens, edit the .XIB file with the Source Control Editor (right click on .xib, Open With->Source Control Editor), and make sure that all references to the name of the controller are correct and that the path and name of the .h file are correct.
Look in the "IBClassDescriber" element specifically. The "className" under the "IBPartialClassDescription" element and the "minorKey" under the "IBClassDescriptionSource" element must be correct. MT will generate a .h file with the same name as the controller.
After making the changes, save the file, choose Build->Clean All, then double-click the .XIB file to open it in XCode.
It may or may not work for you, but it worked for me when everything else failed.
As Stuart mentioned in his comment, deleting the /obj folder under the project which contains the .xib files, force MT to regenerate .h files
Came across the same issue and removing the /obj directory and restarting did the trick.
MonoDevelop 3.0.3.5 with XCode 4.4.
Was rather confusing as I am came across issue whilst on first MonoDevelop iOS Helloworld tutorial.
In my case, this issue has appeared when I change a namespace in .cs view controller file according to the file location. But after that, I caught this issue. When I have returned namespace to incorrect variant I got back my .h file.
Update:
You need to change the namespace in view.cs and in view.designer.cs, then Xcode .h file will be generated correctly.

Resources