XCode doesn't show all subclasses in drop-down when creating a new file - ios

I'm building an iOS application with Xcode 6 and I want to add a UINavigationController file into my project.
When I click 'New File' and select 'Cocoa Touch Class', it doesn't show all the subclasses it should in the specific project I'm working on. It used to be pretty long scroll-down, but now I see only eight options not containing UINavigationController.
What should I do to fix this problem?

remove the string from "Class". Now hit tab to enter subclass of , start typing your Super class name, It will update the dropdown, just like the search in iPhone. :)

Related

My main.storyboard is not showing up on Xcode

So here are the steps that I do when opening Xcode to make a basic application. I first click on "create a new Xcode project" then I tap on "single view app" for "ios" then I fill out the information such as the name of the app and if I want to use core data etc.. and when I finish and tap on "create" I see no main.storyboard on the left side navigation panel... I do not know if I am doing something right. I initially did everything on the LaunchScreen.storyboard, but when I did something it did not allow me because something called segues..
Select Storyboard in User Interface as shown in the image
Please, select storyboard instead of SwiftUI, as with XCODE 11 by default the value of User Interface is set to SwiftUI and it doesn't include storyboard.

Custom class not automatically showing up - Swift 3 iOS 10.2 Xcode 8

So I have my app set up with two view controllers. The first one is my initiation screen, where the app starts, and the second is one the user can navigate to. I added the second one later on in my development, but when I went to the right column under the identity inspector, my new Cocoa Touch Class file is not populated for me to select. Now if you ask me to just type it in, I've tried that, it does not seem to connect. I've tested it by printing a simple line in the viewDidLoad() of the new second class when it is loaded in the simulator, but nothing is printed. Any help would be greatly appreciated!! Thanks!
EDIT
Easy fix is:
Select the activity indicator on storyboard and go to identity inspector and copy the object id. as image: ObjectID_ActivityIndicator
Right click the storyboard file which has the view controller you are working at.
Open as > Source Code
Press command + F to find and look for the id you copied previously
Paste this: customClass="yourclassname" customModule="moduleNAme" customModuleProvider="target"(don't change this target word, you can choose desired module from identity inspector if any).
Command + S to save it and again right click on storyboard file > openAs> Interface builder
Now select activity indicator again and go to identity inspector. You will now see it there. You can also change it as per requirement.
Enjoy. I faced this problem today and found no help online. My class and module field were greyed out. Tried this fix and it worked.
Note: Make sure your custom class is accessible and is in app directory i.e it's not highlighted in red color but gives a normal look.
I have seen a problem like this where the solution was to change the "Module" to a specific value, close the storyboard, reopen it and delete the "Module" setting (assuming it was originally blank or restore it to its original value). This happened in project with many targets and their names may have changed.

Xcode when adding localization not all storyboards are found

When I try to add localization to my app by clicking on project-> localization -> + and add a new language the popup will only show two storyboards even though my app has three.
One storyboard file is missing from the popup
You need do following steps :
First you need to create new string file.
after select this string file and In file inspector and click on Localize button .
then you can see string file along with storyboards.
Adding Localizable.strings is a needed. If you still don't find some storyboards when adding a language, select the storyboards that don't appear and click localize button on the File Inspector in the right pane. Now when you add a new language the popup will show those missing storyboards
I had to open my storyboard and add a base localization, then it would show up in the popup when I wanted to add a new language

StoryBoard Assistant Editor stopped showing associated file

Xcode storyboard assistant editor stopped showing related files.
"Automatic" is selected and "Class" is filled in Identity Inspector.
It was working before, but know it has stopped.
"Auto" or "CounterPart" modes are still woking for other files except StoryBoard.
A few days ago, I tried to update from Xcode 5 to 6, but later on gave up.
Would that have something to do with it?
With XCode 11 onwards, you can option(alt) + click on the file that you want to view in assistant editor.
Simple Fix.
Found the solution (at least worked for me), it's the same bug that causes you not to be able to create new outlets. You must delete the [DerivedData] folder:
Close the project you are working on with.
Delete the【DerivedData】folder of you project. (This folder may inside your project's folder, or inside
~/Library/Developer/XCode/DerivedData/(your project)/ ) or somewhere
else that were setup by you.
Restart Xcode.
see here.
In same case this worked for me:
Right click on ViewController file(on left pane) and choose Delete -> Remove Reference.
Right click on folder where this ViewController file was and choose Add files to .. and add this ViewController file which your just deleted.
Profit.
Deleting the Derived Data didn't work for me nor force quitting Xcode and restarting it.
The only thing that worked was deleting both the class and the storyboard (only the reference to them) and adding them back to the project.
Hope to help someone.
If anyone is wondering how to find Assistant editor in XCode 11 then
please find the steps from the below image. You can show this options
in storyboard or Xib files on upper left corner.
Maybe it's too late but just with the keyboard, you can launch a reset for associated files.
Use the keyboard :
command + option + shift + z
You can find it in the menu Xcode->View->Assistant Editor->Reset Editor.
Click first on the assistant window, then click on 'option'+'alt' and right click on the view controller that you want.
I have Xcode 13.1 and none of these solutions is working for me, but this simple solution works for me every single time. With your Storyboard and (empty) Assistant Editor open, in the upper right of the Editor window click the "Add Editor on Right" icon Editor On Right Icon, and just as promised, it will open a new editor to the right of your Storyboard and (broken) Assistant Editor, only the Assistant in THIS window will be working! Just find the "Close Window" x on your broken editor, close it, and in its place will be your shiny new working Assistant!
Full Editor View of where to click to open the new Editor On Right
Tried all the above methods whereas after simply running the app Command + B fixed this issue and I was able to select the screen under automatic.
This command on terminal fixed my issue:
defaults write com.apple.dt.XCode IDEIndexDisable 0
simply exiting and reopening Xcode worked for me.
For Xcode 8+ versions
Check at top process indicator that if Xcode is "indexing" files... if yes, then, please wait until it finishes. Once it get finished. Your file will automatically appear as counterpart in Automatic section.
If Xcode is not showing "indexing" in process bar, then perform as #Anna Chiara's Answer
I deleted ~/Library/Developer/XCode/DerivedData -> didn't work
Xcode->View->Assistant Editor->Reset Editor is disable
Finally, I figured out that the class name of File's Owner of .xib file is incorrect (the class doesn't exist). I corrected it and Assistant Editor works again.
Hope this helps you
I had the same problem. Finally this is what worked for me.
Changing the name of the ViewController File.
Change the name of the class to the new name via the Refactor tool
Refactor tool
The only thing that ended up working for me was copying over the code from the offending ViewController files and completely deleting them, then creating new ones with the exact same name and pasting in the previous code.
The assistant then linked up to the new ViewController files with no issue.
None of these answers worked for me w/ XCode 13. However, the following worked:
Rename the ViewController class to ViewController2
Update the reference in the storyboard to ViewController2
This made the assistant editor appear.
Change the name of the class back to ViewController. Change the reference in main.storyboard back to ViewController and hit enter (Step 2)
I had same issue and spent almost 2 hours of trying different aproaches finally I found something to solve problem.
I've created two or more VC at the same swift file and I think that's why IDE confused about the files.
So I suggest that you should delete your viewcontroller class and clean than reassign class.
I hope it works for you too.
For what it is worth, this was happening to me for the last couple days on 9.3 . I had just added a new build schema for an alternate debug symbol on testflight. It was not until I removed the new schema and then deleted Derived Data and restarted did it start working again. I have re-added the new schema back in and it continues to work. Not sure what the issue was, but that is what solved it for me.
In case anyone is watching I had a bizarre instance of this (Xcode 11): I deleted a View Controller that I'd done incorrectly; dropped in a new one, created the UIView and associated. BUT I didn't bother to create the outlet from the View Controller on the previous screen. Strange that it let me work for a few minutes, then after I had turned off the assistant editor to do something else, turned it back on and only had the UIResponder.h file. Edit - this happened again. Had to delete the 'wire' to the next screen, then recreate - then option to get to the correct .m and .h files reappeared.
I faced a similar issue and here's what I did
I had a swift file and a xib file with its class connected to the swift file like so inside a group folder, and it doesn't show that they're connected.
But when I take them off the folder the assistant works somehow, so I took them off the folder and made an outlet from a UILabel then put them back inside the folder then they're permenantly connected.
Quite Xcode and reopen it. This is solve my problem.
I had the same problem. But my problem was about having the VC's under "View Controller" folder. When I move VC's to main folder instead of "View Controller" folder, I was able to reach the assistant without problem. If you have the same issue like mine, you can solve by deleting all the VC's and create again under your sub folder.
Just add the Class on right side of your story board which you want to open in assistant

Why does my Xcode 5 doesn't autocomplete nothing?

I'm starting a project but I have another one very similar as base.
I create my new project with storyboard and CoreData, create a new file of NSObject class, and when I start writing in the .h file:
#property (nonanatomic, retain) ns...
nsstring or any type of variable doesn't appear... for example, I start writing ns and it appears:
NS_DURING
NS_ENDHANDLER
NS_HANDLER
NS_VALUERETURN
NS_VOIDRETURN
and the most of code is in black letter, i mean, nothing is coloured as it shoud be normal like purple, blue, etc... the colour that xcode sets... here you can see it:
http://oi61.tinypic.com/359iws6.jpg
P.S: I'm using Xcode 5 Preview 3 and OsX Mavericks. I've never had this problem I think.
Possibly your dot-m (the implementation) file is not a member of the target.
When adding a new file to the project on the bottom of the save dialog there is a Target Membership window . Did you check that box?
To view the target membership and/or to add an existing file to your target open the implementation file. Then open the File Inspector using ⌥+⌘ 1 or View, Utilities, Show File Inspector.
In the File Inspector window halfway down there is the Target Membership. Check the box next to your target.
Syntax highlighting will begin after a short moment, wait for Xcode to finish its indexing.
Try out this: In XCode open Preferences, click on the Text Editing Tab and make sure "Use Escape key to show completion suggestions" is checked.

Resources