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

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

Related

PhpStorm's Extract Interface refactoring not working

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

How to show storyboard instead of text

enter image description here
Im a noob when it comes to this but, I wanted to show the storyboard file that I made instead of the "Hello world" when I launch the app. Pls Help..
You created a SwiftUI project in your screenshot. That's why you have code instead of a storyboard file.
The fix is to choose Storyboard from the Interface menu when creating the project. Then choose File > Add Files to ProjectName to add your storyboard file to the project. Xcode defaults to using SwiftUI for new projects so you have to explicitly choose Storyboard to use storyboards for your app's user interface.
If you don't see the Interface menu in the second step of creating the project, make sure you didn't select a Multiplatform project. Multiplatform projects don't have the option to choose a storyboard for the user interface.

ViewController.h and ViewController.m are not created automatically

I am studying by self for application development.
OS: MacOS
Software: Visual Studio(8.10.11 - build 8) for coding
Xcode(13.1)
I am referring a help article below published by Microsoft since I am using Visual Studio.
Ref; https://learn.microsoft.com/en-us/xamarin/mac/get-started/hello-mac
However, I am sticking at Outlets/Actions section.
I open storyboard on Xcode, and tried to sync between UI change to ViewController.h file.
I recognized that I do not have .h nor even .m file.
Did I have to create ViewController.h file manually??
There was also a sentence like this below.
This stub .h file mirrors the ViewController.designer.cs that is automatically added to a Xamarin.Mac project when a new NSWindow is created. This file will be used to synchronize the changes made by Interface Builder and is where the Outlets and Actions are created so that UI elements are exposed to C# code.
I researched NSWindow but I am super newbie on App Dev. So I am about to lose my mind and wasting my time for a long (T_T)
Could someone help me here?
This Visual Studio ver will not create .h/.m file anymore?
Kind regards
I am sorry for this dumb question.
I still do not have any header file nor m file.
However, when I double clicked storyboard, I saw header and m file.
I used to open storyboard file on Xcode because I did not have an option to open from Visual Studio even though I right-clicked storyboard file like "open -> Xcode interface builder" stuff.
Anyway, the issue was resolved.
Case closed.

xamarin mac Controller.designer.cs file not being filled

I am currently developing a cocoa app using Xamarin mac. to do this i open the story board in the XCode interface builder add my controllers and UI then run the application with visual studio mac. the problem I'm running into is even on a simple project if i open the story board add a controller and a button the controller's .designer.cs file never contains the button or any other control. through debugging ive confirmed its using the correct controller and the UI is display correctly but that intermediary designer.cs file only contains the default code
[Register ("ReportController")]
partial class ReportController
{
void ReleaseDesignerOutlets ()
{
}
}
I'm unable to build XCode as it is just generating a dummy project and fails with undefined symbol: _main but visual studio is able to build fine and reflects any UI changes made in XCode.
Thank you all for your time I fear I'm missing something really basic, I've used the windows version of the interface builder for IOS before and never ran into this issue however for that it was built into visual studio so perhaps there is a step I'm missing.
You could see that I have added a Hello button in the storyboard, and if you want to see the Button in .designer.cs, you need to connect this Button to the Controller.h in Xcode. More can refer to Adding an Outlet.
Then Hello button will show in .designer.cs automatically:
Finally, Screenshot at runtime.

Could not set modules automatically via return key and bind IBAction methods rom Interface Builder

I create iOS application using Xcode 8.3.3, but suddenly one day, Interface Builder is broken...
IBDesignable does not render styles on Storyboard and not raise any warnings and errors
Press return key at Custom Class textfield in Identity inspector, does not set Module and check "Inherit From Target", set "None" automatically
Does not show existed class names in Custom Class in Identity inspector while inputting
Could not bind components such as UIButton to declared IBAction methods in Swift files using drag and drop pressing the Ctrl key
I tried...
Remove caches related to Xcode
Restart Xcode and macOS
Install Xcode 9 beta4 and run it
Of course, I confirmed file differences but there is no problem. Also I create a new project, all work fine in it.
What should I do for this project?
Images
case 2 (just pressed a return key)
case 3 (inputting)
case 4
I removed this project files and pull this project source codes via Git from a remote repository again, it works.

Resources