If I am using Visual Studio for Mac it has this field in the designer.
It creates a property in the View.cs file that allows me to bind to it.
I found a similar section in xcode (that is what rider opens up) and it only has these options. No field for Name.
This name field is not what shows up on the button label. I know how to set that.
I would much rather use Rider than Visual Studio for mac. If I have to constantly jump back and forth this would obviously be a problem.
EDIT: From what I can tell, it seems to edit the View.designer.cs.
It has this comment though. How would I be able to edit this from Rider?
// WARNING
//
// This file has been generated automatically by Visual Studio from the
outlets and
// actions declared in your storyboard file.
// Manual changes to this file will not be maintained.
//
This was what it looks like on default with a new MvvmCross project
using Foundation;
using System;
using System.CodeDom.Compiler;
namespace HelloCrossPlatform.iOS.Views
{
[Register ("FirstView")]
partial class FirstView
{
[Outlet]
[GeneratedCode ("iOS Designer", "1.0")]
UIKit.UILabel Label { get; set; }
[Outlet]
[GeneratedCode ("iOS Designer", "1.0")]
UIKit.UITextField TextField { get; set; }
void ReleaseDesignerOutlets ()
{
if (Label != null) {
Label.Dispose ();
Label = null;
}
if (TextField != null) {
TextField.Dispose ();
TextField = null;
}
}
}
}
Here is what it looks like when I add the name property to the button in Visual Studio for Mac with the Designer
using Foundation;
using System;
using System.CodeDom.Compiler;
namespace HelloCrossPlatform.iOS.Views
{
[Register ("FirstView")]
partial class FirstView
{
[Outlet]
[GeneratedCode ("iOS Designer", "1.0")]
UIKit.UILabel Label { get; set; }
[Outlet]
[GeneratedCode ("iOS Designer", "1.0")]
UIKit.UIButton SayHelloButton { get; set; }
[Outlet]
[GeneratedCode ("iOS Designer", "1.0")]
UIKit.UITextField TextField { get; set; }
[Action ("UIButtonDZD114An_TouchUpInside:")]
[GeneratedCode ("iOS Designer", "1.0")]
partial void UIButtonDZD114An_TouchUpInside (UIKit.UIButton
sender);
void ReleaseDesignerOutlets ()
{
if (Label != null) {
Label.Dispose ();
Label = null;
}
if (SayHelloButton != null) {
SayHelloButton.Dispose ();
SayHelloButton = null;
}
if (TextField != null) {
TextField.Dispose ();
TextField = null;
}
}
}
}
Is rider even a good tool to use with Xamarin? I'm getting disappointed they even market it as an option. Really questioning my subscription to JetBrains.. Vscode seems to work just as well as Webstorm which is the only other product I work with from them.
Rider does NOT have a special designer for .xib
and .storyboard
UI files. We (the Rider team) think we will not be able to implement as good (and actual) UI designer as the native xcode is. So the main scenario to work with Xamarin macios UI in Rider - use xcode interface builder.
You can check the apple documentation about outlets generating: https://developer.apple.com/library/archive/documentation/ToolsLanguages/Conceptual/Xcode_Overview/ConnectingObjectstoCode.html
This is a brief description how to do it in xcode 11 with default settings.
Ctrl+Click the control you want to bind and drag it into the code. Important note: use .h files to create new actions and outlets, Rider analyzes .h files to build a public API model.
Now you can enter the name of the control it the binding will be created. You will see corresponding outlets in objc code.
Maybe it is not that straightforward so I will try to explain how it works internally. Xamarin macios project is an (almost) regular .NET C# project. So to allow you edit UI in the xcode, Rider (and VS actually) do some magic. It takes the .NET project and:
obj\xcode
folder with specific settings and configurations.ViewController
types. For each of them Rider generates objc class with actions and outlets. When you have made some changes in that generated project and go back to Rider, it tries to apply all changes:
*.designer.cs
files for view controllers. For all these files you will see this generated header (can be changed in the future):// WARNING
//
// This file has been generated automatically by Rider IDE
// to store outlets and actions made in Xcode.
// If it is removed, they will be lost.
// Manual changes to this file may not be handled correctly.
//
To control xcode synchronization process and see whats going on and see what errors occur you can use a special Rider toolwindow: xcode console
. It is shown each time you open a project in xcode:
Instead of conclusion: Rider's team tries to provide good experience for Xamarin Developers, even better then VS for Mac. So are working on support some Xamarin parts (Xamarin Forms Hot Reload in the 2020.1) so feel free to share your troubles in our public issue tracker:
https://youtrack.jetbrains.com/issues/RIDER?q=Technology:%20Xamarin%20