PhpStorm's Extract Interface refactoring not working - refactoring

I'm trying to extract the interface from class using Context Menu on class name -> Refactor -> Extract interface.
Dialog window appears where I enter the interface name and press the "Refactor" button.
It looks for class usages and then nothing happens: no preview window opens, no new file with interface created.
Just the dialog window continues to be shown and that's it.
This happens on MacOS, PhpStorm 2022.2 and 2021.2
What should I do to make it generate a new interface from the existing class?

I tried to Invalidate Caches with different checked options and then with all checked options, but it doesn't solve problem
After that I removed all files from directories:
Settings: ~/Library/Application Support/JetBrains/
Plugins: ~/Library/Application Support/JetBrains/Plugins/
Caches: ~/Library/Caches/JetBrains/
Logs: ~/Library/Logs/JetBrains/
Problem was gone
Then I localized problem by restoring Plugins folder and trying to disable different plugins
At last it was "Yii2 Support" plugin unfortunately

Related

My storyboard custom class property doesn't generate a custom class in Xamarin anymore?

I'm using Visual Studio for Mac and design my UI in a storyboard using Xcode interface builder.
I'm trying to create a custom class of a UILabel and usually I just select the control and add my custom class name in the class property in xcode, and when xcode synchronises with Xamarin, the custom class is generated as a new file in the xamarin project, but this has stopped working.
Actually is seems to have stopped syncing all together. Are there any logs that I can check to see why? I have restarted xcode. Visual Studio for Mac, cleaned the project, deleted the bin and obj folders from the active project and rebooted the machine without success.
Any tips is very much appreciated!
My answer is a workaround and not a true answer as this has never worked for me. I have always used Xamarin iOS Designer to create custom class, then after file generation, close xib/storyboard and reopen in Xcode Interface Builder. Double checking for [Register("ClassName"]` tag.
Select Label in iOS Designer:
View -> Pads -> Properties Add Class name in Class Field:
Should see custom class autogenerated in SolutionExplorer:
Ensure .designer.cs file has Register Tag:
Now you can close the .xib in VS for Mac and reopen in Xcode. It probably won't autocomplete. But any Outlets you create will be an instance of your custom class as well as any custom attributes specified in .cs files will apply at runtime. Not as convenient as creating the custom class with Xcode but at least now you can use your custom class with Xcode Interface Builder.
I love my XCode as well! Instead of doing what you used to do, you can
Open the file in Xcode interface builder as usual with the Label
Find and Open the ABCViewController.h file in the other XCode window.
Hold control on your keyboard, click on your label on the GUI and drag it to the ABCViewController.h file and it should prompt you to create an outlet and name the class.
Save and Quit, and you should see the new Properties in your ABCViewController.designer.cs file
There's definitely a new issue after the update as you can see here as well

Use Xcode's Test Classes Assistant Editor with Swift Classes

When working in Xcode, it's often nice to pull up unit test cases in an assistant editor. Currently, I've been selecting the tests file manually, but I see the assistant editor has an option for Test Classes.
I've tried to get this option to pull up my tests file automatically, but I can't seem to make it work. Is there some sort of configuration required for it? Does it just not work for swift projects?
The assistant editor can automatically open the companion file in many cases. However, afaik, there is no automatic setting for opening the unit test.
To get the behavior you want you can fuzzy search with open quickly ⌘+⇧+o then open the result in the assistant editor with ⌥+⏎.
You might also find use in open quickly ⌘+⇧+o then ⇧+⏎.
You can see more about "Working Efficiently with Xcode" here.
The shortcuts mentioned in other answers work great, but they don't make the assistant editor automatically work with test classes. Turns out it didn't work with swift code previously, but Apple just added support for this to Xcode 9:
A file with a base name of FooTest or FooTests is now considered a counterpart of a file with a base name of Foo for navigation and the Assistant Editor. (28981734)
So, with Xcode 9, the test target filename needs to have the same name as the main code file + either 'Test' or 'Tests' and the Xcode test classes assistant editor will work automatically.
It seems that on Xcode 8 it automatically setup the suitable test class in the assistant editor after you import the original class inside the test class.
#testable import YOUR_MODULE_NAME
class MyViewControllerTests: XCTestCase {
var myVC : MyViewController!
}
After that you will find MyViewControllerTests on the assistant editor under "Tests Classes".

iOS - Using Base localization pane is always empty

In Xcode have added two localizations, German and English. I am following documentation on Apple regarding "Use Base Internationalization" which is obtained by going to the project, clicking Info and pressing on the checkbox.
If I do this, it launches a pane or page which is empty.
IE:
How do I get it to be populated, or otherwise be in a situation to select the relevant resource file?
The answer is to localize your storyboards. Go to storyboard, there is a button called localize. If you do this, the pane is no longer empty.
Check the answer from hassan83 (https://stackoverflow.com/users/1586924/hasan83) in another question. It solved my problems.
https://stackoverflow.com/a/27720065/7017099
"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."

Is there any way to compile a single file in Xcode 5?

I'm talking about a functionality such that you can just quickly open a .cpp file (C++ console application, nothing regarding Apple ecosystem), work on it, compile and run, without all the project creating mumbo-jumbo. When I open a file with code, all the "Product" options are greyed out for me but after some googling, I found posts claiming that Xcode 5 was to be the first one offering such functionality. Has it been implemented and it's just available elsewhere or were they false rumors and you still have to create a project and import a file there?
Or if you want a shortcut: CTRL + COMMAND + B.
In the top menu of XCode "File - Edit - View" you will see Product.
Click Product->Perform Action->Compile "myfile.xxx"
If you want a shortcut for that command, click XCode -> Preferences-> Key Bindings and set one up.

How To Get Xcode Interface Builder To Pop Up When I Click My NIB File?

I am at work and trying to make an application for my company in Xcode, however when I click the Nib file I cannot get the interface builder to pop up. I am on a Mac that has lockdown control on it, and I am wondering if this is affecting my development environment? When I double-click the Nib file nothing happens. It just modals the normal Xcode window. Am I at a loss on this? I am wondering if I am going to have to develop this application away from my work?
I only know that when the file is open with Xcode you must add the quarts composer framework
You can do this going to build phases, frameworks and add
When you make a right-click (ctrl-click) on the file and move to open with is there a link to interface builder? If so you can select the preferred program for all .nib files with
*right-click* > information on a .nib file.

Resources