Visual Studios For Macos

Back in .NET Conf 2017 The Xamarin team already shared what’s going to be new with Xamarin Forms 3.0 and it actually surprised me. I was expecting some performance improvements, bug fixing and a big upgrade on XAML. But, what they announced focuses on enabling the usage of Xamarin.Forms in more ways and on more platforms. I was really hoping for XAML improvements, maybe add some cascading styling like how CSS works. Maybe sometime in the future, we’ll get it. For now, I’ll just use the XAMLCss by warapa. Anyway if you want to watch all sessions from .NET Conf 2017, you can check it out on Channel9. Going back, I really didn’t expect these new features, but definitely, I love it and really excited to try it out!

That’s why right now, I’m going to show to you one of the exciting features added to the Xamarin.Forms 3.0 that I think you’ll also love. I’m talking about Xamarin.Form’s macOS support.

Traces of Visual Studio for mac throughout macOS! How to run tests showing code coverage in Visual Studio for Mac Community 8.3.4. Hot Network Questions.

One of the Xamarin team’s plan is to reach more platforms. That means UWP, iOS and Android are not only platform the Xamarin.Forms will be able to target from now on, they are also bringing macOS, GTK#, Linux and WPF!

You might think that it will be hard and will take a lot of time to integrate your Xamarin.Forms solution into the macOS project, but it’s not. Not at all. You’ll be able to create a native macOS application using your Xamarin.Forms solution using Visual Studio for Mac or Xamarin Studio in just 3 quick steps!

First step: Add a Cocoa App project

Right now, Xamarin.Forms template doesn’t have a Cocoa App initially. So, what you would do is to start Visual Studio for Mac or Xamarin Studio and open your existing Xamarin.Forms solution. Then, add a project into the solution by right-clicking the solution and selecting Add > Add New Existing Project.

Studio

You can then select Mac > App > Cocoa App and name it whatever you want, but ideally, the name has a suffix of .macOs.

Studio

Second Step: Add the Xamarin.Forms NuGet Package

You will have to add the Xamarin.Forms’ latest pre-release nuget package or specifically 2.4.0.282. To do this, right click the Cocoa App project that you just created and select Add > Add Nuget Packages.

Then, search for ‘Xamarin.Forms’ and make sure that the ‘Show pre-release packages’ is ticked. Click ‘Add’ to add Xamarin.Forms nuget package.

You will also need to update the Xamarin.Forms on your shared project and the version should be the same with what the Cocoa app have.

Third Step: Configure the Cocoa App Project

The first thing that you should do with your Cocoa app project is to add the shared project into your Cocoa app as a reference.

Then, open the Info.plist and remove the ‘Main storyboard file base name’ entry (Opened with XCode)

Or just open the Info.plist inside Visual Studio or Xamarin Studio by clicking it and leave the Main Interface blank.

The next one is to update your Main.cs’ Main method to initialize the AppDelegate:

Lastly, update the AppDelegate by changing the NSApplicationDelegate to FormsApplicationDelegate:

Initialize the Cocoa app window within the constructor:

Then inside the DidFinishLaunching method, initialize Xamarin.Forms and load the application:

You can now set your project as the startup project and run your macOS!

Again, in just 3 quick steps, it’s done!

This is just a basic walkthrough since this is still on preview. Expect that there are still bugs and not ready for production. Not all nuget packages are compatible and surely, there are lots of UI features still not implemented, but this is a good start. For now, you can send your issues and problems that you encounter in this forum discussion: https://forums.xamarin.com/discussion/93585/preview-xamarin-forms-for-macos/p1

-->

First-class support for Xamarin allows you to develop rich native experiences for Android, macOS, iOS, tvOS, and watchOS. Xamarin.Forms cross-platform applications help you share XAML-based UI code between Android, iOS, and macOS without limiting access to native functionality.

Xamarin.Forms

XAML Hot Reload for Xamarin.Forms is built into Visual Studio for Mac in version 8.3 and later. With this feature enabled changes are instantly reflected in your running app every time you save the file.

XAML Hot Reload can be enabled by checking the Enable Xamarin Hot Reload checkbox at Visual Studio > Preferences > Projects > Xamarin Hot Reload.

For more information on Hot Reload, see the XAML Hot Reload for Xamarin.Forms guide within the documentation.

Android

Visual Studio for Mac has its own integrated Android SDK manager, allowing you access to the SDKs you want your app to target.

For Android applications, Visual Studio for Mac includes its own designer, which works with Android .axml files tovisually construct user interfaces. Visual Studio for Mac will open these files in its Android Designer, as illustrated in the following image:

Visual studio for macos 10.10

For more information on the Android Designer, see the Xamarin.Android Designer Overview guide.

iOS

The iOS Designer is fully integrated with Visual Studio for Mac and enables visual editing of .xib and Storyboard files to create iOS, tvOS, and WatchOS UIs and transitions. The entire user interface can be built using drag-and-drop functionality between the Toolbox and Design Surface, while using an intuitive approach to handling events. The iOS Designer also supports custom controls with the added benefit of design-time rendering.

For more information on using the iOS Designer, see the Designer guides.

Mac

Xamarin provides native Mac API bindings that allow you to create beautiful Mac applications.

For more information on writing Mac applications with Visual Studio for Mac, refer to the Xamarin.Mac guides.

Xamarin Enterprise features

Note

These products can only be used with a Visual Studio Enterprise subscription.

Profiler

The Xamarin Profiler has three instruments available for profiling. The Introduction to the Xamarin Profiler guide explores what these instruments measure and how they analyze your application, and clarifies the meaning of the data presented on each screen.

Inspector

Visual Studio For Macos Sierra

The Xamarin Inspector provides an interactive C# console with user tools. It can be used as a debugging or diagnostics aid when inspecting live applications, as a teaching tool, as a documentation tool, or an experimentation tool.

It consists of a standalone application that provides a rich C# console that can target various programming platforms (Android, iOS, Mac, and Windows) and integrate into your IDEs debugging workflow.

Visual Studios For Macos Windows 7

For more information, see the Xamarin Inspector guide.