- Xamarin Mac Textshouldendediting
- Xamarin Studio Mac
- Vs For Mac Xamarin
- Xamarin Forms Mac
- Xamarin Vs Mono
- Xamarin Mono For Mac Download
- Xamarin Mono For Android
A chat room to discuss Xamarin.Mac exists on Discord. Obtaining Xamarin.Mac Xamarin.Mac is available as part of Xamarin Studio or Visual Studio to download your package. Xamarin and Mono. Xamarin is a developer platform that is used to develop native applications for iOS (Xamarin.iOS), Android (Xamarin.Android), and macOS (Xamarin.Mac).It is technically a binding layer on top of these platforms. Binding to platform APIs enables.NET developers to use C# (and F#) to develop native applications with the full capacity of each platform.
JetBrains Rider supports creating and working with Xamarin applications for both Android and iOS. Although currently JetBrains Rider does not provide a designer or a previewer for Xamarin forms, you can still benefit from code analysis, coding assistance, and debugging features in C#, VB.NET, and other languages, as well as from general IDE features, such as the integrated VCS client.
If other tools that Xamarin relies on (for example, Android SDK, Android Emulator) are configured properly, you will be able to build and run your Xamarin application right from the JetBrains Rider IDE.
Xamarin SDK
To develop Xamarin Applications you need to have a Xamarin SDK on your machine. There are two different Xamarin SDKs — for iOS/Mac and for Android.
Xamarin SDK consists of two parts:
Assemblies with .NET types for the target platform. For example, a .NET type to represent the base OSX
NSObject
. Using these assemblies, IDE and compiler resolve and build user code.Tools that transform .NET projects into native applications, which can be deployed and executed on the emulator or a physical device. For example, using these tools .apk packages for Android are built.
JetBrains Xamarin SDK
JetBrains Rider can use different Xamarin SDKs, for example the one from Visual Studio. However, if you do not have Visual Studio on your machine, you can use JetBrains Xamarin SDK prepared and packed by the JetBrains Rider team.
JetBrains Xamarin SDK is a custom build of Xamarin GitHub sources with some improvements and additional code.
Currently JetBrains Xamarin SDK lacks some features compared to Visual Studio Xamarin SDK, but it is in the process of constant improvement.
Xamarin Mac Textshouldendediting
JetBrains Xamarin SDK is available for Windows and macOS:
There are two JetBrains Xamarin SDK builds available on Windows targeting the following platforms:
- Apple platform (iOS, Mac, tvOS, watchOS)
JetBrains Xamarin SDK for iOS development provides a limited feature set on Windows. For example, currently it does not supportconnecting to a remote Mac and perform full build/deploy.
JetBrains Xamarin SDK for Apple platforms on Windows ships as a .zip file (~ 60Mb) and installs into the JetBrains MsBuild directory:
%LOCALAPPDATA%JetBrainsBuildTools. - Android
JetBrains Xamarin SDK for Android development provides a solid feature set. However, fast deployment is currently not supported.
JetBrains Xamarin SDK for Android platforms on Windows ships as a .zip file (~ 700Mb) and installs into the JetBrains MsBuild directory:
%LOCALAPPDATA%JetBrainsBuildTools.
There are two JetBrains Xamarin SDK builds available on macOS targeting the following platforms:
- Apple platform (iOS, Mac, tvOS, watchOS)
On macOS, JetBrains Xamarin SDK for Apple platforms provides almost the same feature set as Visual Studio SDK, all known scenarios are supported.
JetBrains Xamarin SDK for iOS development on macOS ships as a .dmg file (~ 700Mb) and installs into:
/Library/Frameworks/Xamarin.iOS.framework
/Library/Frameworks/Xamarin.Mac.framework
/Library/Frameworks/Mono.framework/External
- Android
JetBrains Xamarin SDK for Android development provides a solid feature set. However, fast deployment is currently not supported.
JetBrains Xamarin SDK for Android development on macOS ships as a .dmg file (~ 700Mb) and installs into:
/Library/Frameworks/Xamarin.Android.framework
/Library/Frameworks/Mono.framework/External
Before you start
Xamarin aims to be executed on a variety of different platforms and therefore Xamarin development relies on several different tools for building and running your applications.
On Windows, you can develop Xamarin applications for any platform, but local build and run/debug is limited to Android devices and emulators.
If you use Visual Studio Xamarin SDK, you will be able to build and run your application on iOS and macOS. To do so, configure a Mac agent accessible on the network, and then connect to it (Tools | iOS | Xamarin Mac Agent).
Install a Xamarin SDK for iOS on your machine in one of the following ways.
Install Xamarin in Visual Studio. Note that you can use Visual Studio Community, which is free. If you already have Visual Studio installed, you have to add Xamarin support to it.
Start installation of Xamarin iOS & Mac on the Environment page of JetBrains Rider settings Ctrl+Alt+S and follow the installation wizard. This way JetBrains Rider will automatically download and install JetBrains Xamarin SDK for iOS & Mac.
Alternatively you can clone the Xamarin open-source repo from GitHub, build it and install on the machine. This way is quite complicated and we do not recommend it.
Install Android development tools in one of the following ways:
Start installation of Xamarin Android on the Environment page of JetBrains Rider settings Ctrl+Alt+S and follow the installation wizard. This way JetBrains Rider will automatically download and install JetBrains Xamarin SDK for Android.
Alternatively, all components that are automatically installed on the the Environment page of JetBrains Rider settings Ctrl+Alt+S, could be also installed manually:
Rider Xamarin Android Support plugin. It has all necessary features, like Android SDK manager.
Android SDK developed and provided by Google. You can install it from Visual Studio, Android Studio, Rider (with Rider Xamarin Android Support plugin), or downloaded as a set of command line tools.
On macOS, you can develop, build and run fully cross-platform Xamarin applications.
Install a Xamarin SDK on your machine in one of the following ways.
Install Visual Studio for Mac.
Start installation of Xamarin iOS & Mac on the Environment page of JetBrains Rider settings Ctrl+Alt+S and follow the installation wizard. This way JetBrains Rider will automatically download and install JetBrains Xamarin SDK for iOS & Mac.
Alternatively you can clone the Xamarin open-source repo from GitHub, build it and install on the machine. This way is quite complicated and we do not recommend it.
For iOS and Mac development, install Xcode. You will need an Apple ID for installing and signing into Xcode. If you do not already have it, you can create a new one at https://appleid.apple.com.
JetBrains Rider will detect Xcode automatically. If you have several Xcode versions, you can choose which one to use on the Build, Execution, Deployment | iOS page of JetBrains Rider settings Ctrl+Alt+S.Install Android development tools in one of the following ways:
Start installation of Xamarin Android on the Environment page of JetBrains Rider settings Ctrl+Alt+S and follow the installation wizard. This way JetBrains Rider will automatically download and install JetBrains Xamarin SDK for Android.
Alternatively, all components that are automatically installed on the the Environment page of JetBrains Rider settings Ctrl+Alt+S, could be also installed manually:
Rider Xamarin Android Support plugin. It has all necessary features, like Android SDK manager.
Android SDK developed and provided by Google. You can install it from Visual Studio, Android Studio, Rider (with Rider Xamarin Android Support plugin), or downloaded as a set of command line tools.
You can check the status of Xamarin tools and install or update them on the Environment page of JetBrains Rider settings Ctrl+Alt+S:
Create and open Xamarin projects
JetBrains Rider supports creating new and working with existing projects. Project templates are available, too.
You can create a new Xamarin project in a new solution using File | New... or add a new Xamarin project to the existing solution by right-clicking the solution or solution folder node in the Solution Explorer, and choosing Add | New Project.
Xcode integration on macOS
When developing Xamarin applications on macOS, it is recommended to edit resource files and connect resources to code using Xcode.
You can use context menus of .storyboard, .xib, .plist files or of the Xamarin macios project node to open them in Xcode.
If the file or project has never been opened in Xcode before, JetBrains Rider will generate an Xcode project as follows:
xcodeproj project specifications (a project descriptor similar to csproj but for Xcode) is generated
Source files for all user types inherited
NSObject
(forms, delegates, views, controls, and so on) in Objective C are generatedAll resources (images, designer files) are copied
When the project structure is ready, Xcode will start automatically and you can use it to edit resources. Every time Rider receives focus, it looks for changes (edits in existing files, new files, removed files) and integrates these changes into the Xamarin .NET project. It modifies .designer.cs parts of user types (inherited from NSObject
) and copies back all changed resources.
All Xcode-related events are printed in the Xcode console tool window, which appears when you open resources or projects in Xcode:
When you create a new Xamarin macios project
JetBrains Rider creates the corresponding xcodeproj project (pbxproj and other necessary files) project in the objxcode subdirectory with all required settings and configurations.
Copies of all content files (views, plist files, images, and so on) are created in that directory.
For each
ViewController
type JetBrains Rider generates an objc class with actions and outlets.The generated project is opened automatically in Xcode.
When you made changes in Xcode and then switch to Rider
All modified content files are copied back into .NET project.
Settings are updated.
objc files are parsed and *.designer.cs files are regenerated for view controllers. For all these files you will see a generated header:
// 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.
Run and debug Xamarin applications
When you create or open a Xamarin project, JetBrains Rider automatically creates run/debug configurations for each Xamarin project in the solution.
If you want to adjust something in the way your application starts and executes, you can edit and create new run/debug configurations. When you start a Xamarin application from the IDE, you can use the corresponding selector on the navigation bar to choose which configuration should be used:
Debug a Xamarin project, which was not created with JetBrains Rider
In the Settings/Preferences dialog Ctrl+Alt+S, select Environment.
Enable Xamarin Android and Xamarin iOS & Mac support.
If you are on Windows and have Xamarin SDK installed via Visual Studio, it will be detected automatically. Otherwise, JetBrains Rider will suggest installing JetBrains Xamarin SDK.
JetBrains Xamarin SDK cannot be installed alongside with Visual Studio Xamarin SDK.
Once Xamarin SDK is installed, you can create Xamarin-specific run/debug configurations.
Open the Run/Debug Configuration dialog in one of the following ways:
Select Run | Edit Configurations from the main menu.
With the Navigation bar visible (View | Appearance | Navigation Bar), choose Edit Configurations from the run/debug configuration selector.
Press Alt+Shift+F10, then press 0 or select the configuration from the popup and press F4.
In the Run/Debug Configuration dialog that opens, press Alt+Insert or click , then choose Xamarin.Android, Xamarin.iOS, or Xamarin.Mac from the list.
Specify the target project and other parameters if necessary, then click OK.
Use the newly created configuration to run and debug your Xamarin project.
Webinar recording: Better Xamarin Development with Rider for Mac
You can also watch this webinar recording where Dylan Berry explores the various ways Rider can help you improve your coding speed and quality when developing Xamarin apps.
Webinar agenda:
0:05 – Introduction
1:22 – Tools are important
11:00 – Get started with Rider on Mac
13:43 – Exploring Rider
1:04:46 – Plugins
Chapter 1. Xamarin and Mono – a Pathway to the Unnatural
This chapter provides an overview of the Mono project and the suite of Mono-based commercial products offered by Xamarin. To begin this pathway into the unknown, this chapter will cover the following topics:
Xamarin Studio Mac
Understanding Mono
Why you should use Xamarin
Installation of Xamarin.Android and Xamarin.iOS
Using Xamarin Studio and Visual Studio for development
Options for source control
Before we jump straight into a conversation about Xamarin, let's discuss a related topic: Mono. Mono is an open source cross-platform implementation of the .NET platform. This includes a Common Language Runtime (CLR) that is binary compatible with Microsoft .NET, a set of compilers for languages such as C#, and an implementation of the .NET runtime libraries. The Mono CLR has been ported to many platforms, which include the Linux and BSD-based operating systems (which are not limited to just Android, iOS, and OS X), Windows-based systems, and even some game consoles such as the Wii, Xbox 360, and PS4.
The Mono project was started by a Ximian, which was purchased by Novell. Xamarin now leads Mono.
Xamarin is a software company that offers a suite of commercial Mono-based products that allow developers to create apps for Android, iOS, and OS X using C# and the .NET framework. Xamarin's cofounder, Miguel de Icaza, has directed the Mono project since its inception in 2001.
Xamarin's primary product offerings are:
Xamarin.Android (formerly Mono for Android)
Xamarin.iOS (formerly MonoTouch)
Xamarin.Mac
Each of these products is licensed through an annual subscription with the following levels being available:
Starter: This subscription is actually free, but restricts the size of apps.
Indie: This subscription provides everything needed to build and deploy full-featured mobile apps, but can only be purchased by companies with five or less employees. This subscription also does not include the use of the Visual Studio add-in discussed in the Using the Visual Studio environment section.
Business: This subscription adds the use of the Visual Studio add-in as well as e-mail support.
Enterprise: This subscription adds access to a set of prime components, hotfixes, and enhanced support.
Note
A link for the pricing information can be found at the end of this section. For quick reference, please visit https://store.xamarin.com.
Vs For Mac Xamarin
Xamarin also hosts a component store; a market place to buy and sell components that can be used in Xamarin apps. The components in this store can be distributed for free or sold, and Xamarin pays component vendors a percentage of the revenue collected from the sales.
Another service that Xamarin offers is the Test Cloud. As the name implies, this is a cloud-based testing service that allows teams to create automated testing capabilities for their apps that can be run against a plethora of physical devices. This is particularly important for Android developers as there are far more devices that need to be considered.
The following table provides useful links to additional information about the Xamarin suite:
Type of information | URL to access it |
---|---|
Product information | |
Product pricing | |
Component store | |
Xamarin Test Cloud |
Now that you have some background on Mono and the Xamarin suite of products, you might want to ask yourself: 'Is Xamarin the right tool for my project?'
The benefits of using Xamarin are as follows:
It builds on your existing skills of using C# and .NET: Because of the huge number of features available to both the C# language and the .NET framework, it requires a huge investment of time and energy for developers to master them. Although you can argue that Java and Objective-C have similarities (being object-oriented languages), there is a real cost associated with transferring your proficiency in C# and .NET to make the same claim regarding Java or Objective-C. This is where Xamarin comes to your rescue; individuals and groups that have made a significant investment in C# and .NET might turn to it if they wish to develop iOS and Android apps due to the requirement of these skills.
Allows for reusability of code in cross-platform development: Although the Xamarin suite prevents you to create an app that can also be deployed to Android, iOS, and WP8, it compensates for this by providing you with the capability to recycle huge portions of your code base across all of these platforms. The general process that makes this all so much easier for you is that the user interface code and the code that deals with the device capabilities tend to be written for each platform. With this, things such as client-side logic (proxies and caching), client-side validation, data caching, and client-side data storage can potentially be reused, saving you a huge amount of time and energy. I have personally seen Android and iOS apps share as much as 50 percent of the code base and some report as high as 80 percent. The more you invest in the approach to reuse, the more likely you will achieve a higher percentage.
However, there are some drawbacks when it comes to using Xamarin:
Costs due to licensing requirements: The Xamarin suite or tools are all commercial tools and must be licensed, meaning there is a tangible cost of entry. You can check Xamarin's website for the current pricing.
Waiting for updates: You will find that there is some lag time between a new release of a platform (Android/iOS) and the corresponding release of the Xamarin products that support it. Xamarin has done a great job of releasing Xamarin.iOS on the same day when the new versions of the OS are made available. Xamarin.Android generally lags behind because Google does not make beta/preview versions available. In some ways, this delay is not a big issue at least for phone apps; the telecoms generally take some period of time before they provide the newest Android versions to be downloaded.
Performance and memory management: This is probably more of a concern for Xamarin.Android than Xamarin.iOS. As you will see in Chapter 2, Demystifying Xamarin.iOS,Xamarin.iOS essentially builds a binary executable much like those produced by using just Xcode and the iOS SDK. However, as we will see in Chapter 3, Demystifying Xamarin.Android, Xamarin.Android relies on deploying the Mono CLR and the communications between the Mono CLR and the Dalvik VM. In some cases, Xamarin.Android will allocate Java and C# objects to achieve some of the 'magic' and 'sorcery' behind developing in C# or .NET on an Android device. As a result of this, Xamarin.Android will affect both the memory footprint and execution performance.
Distribution size: There are a number of runtime libraries that must be distributed or linked with Xamarin apps. A discussion of the actual size and strategies to minimize the distribution size is reserved for the last chapter.
While the list of drawbacks might seem extensive, in most cases, the impact of each can be minimized. I have chosen to build out a Xamarin consulting practice because I place a high value on the benefits identified and feel like many groups that have a significant investment in C# and .NET will see the same value. If you are a group or an individual that places a great value on Xamarin's benefits, then you should certainly consider using it.
This book assumes that you have a working knowledge of C# and .NET. Since this might not be the case for some readers, we have included a few links to help you get up to speed. Xamarin provides the following link which presents C# from an Objective-C perspective: http://docs.xamarin.com/guides/ios/advanced_topics/xamarin_for_objc/primer
Microsoft provides a set of tutorials for learning C# available at: http://msdn.microsoft.com/en-us/library/aa288436(v=vs.71).aspx.
Before moving on, we need to install Xamarin. This section will show you the steps to install Xamarin on both the Android and iOS platforms, notably Xamarin.Android and Xamarin.iOS, on both OS X and Windows.
Since Xamarin.iOS is dependent on the latest iOS SDK and the latest Xcode, both of these should be installed prior to starting the OS X install.
Tip
Both Xcode and the iOS SDK are free and you can download these installs from: https://developer.apple.com/devcenter/ios/index.action#downloads.
Also, note that you can install Xcode from the OS X App Store.
Likewise, Xamarin.Android is dependent on the latest Android SDK; however, the difference being that the Xamarin install will automatically download the Android SDK and install it as part of the overall install process. So, no separate steps need to be taken. If you already have installed the Android SDK, you have just been handed the opportunity to use it.
To install Xamarin on OS X, go to www.Xamarin.com, download the OS X installer to launch it, and follow the directions. Be sure to choose to install both Xamarin.Android and Xamarin.iOS; Xamarin.Mac is optional.
The Xamarin.iOS Visual Studio plugin uses the build server called mtbserver
to compile the iOS code on your Mac. If you plan to use the Visual Studio plugin, be sure to choose to allow network connections.
Now, we move on to the Windows installation process. If you plan on using the Visual Studio add-in, Visual Studio will need to be installed prior to installing Xamarin.
To install Xamarin on Windows, you need to visit www.Xamarin.com, download the Windows installer, launch it, and then follow the directions. Be sure to install both Xamarin.Android and Xamarin.iOS.
Developers have two options when it comes to IDEs: Xamarin Studio or Visual Studio. This section will show you how to develop apps for both Android and iOS through both of these studios.
Xamarin Studio is a customized version of the MonoDevelop IDE and this can be used to develop applications for Android, iOS, and OS X. Xamarin Studio is available on both OS X and Windows with highly advanced and useful features such as:
Code completion
Smart syntax highlighting
Code navigation
Code tooltips
Integrated debugging for mobile apps running in emulators or on devices
Source control integration with Git and Subversion built-in
If you look at the following screenshot, you will see how Xamarin Studio is shown with the Android user interface designer opened:
Xamarin Studio and the Xamarin.Android add-in allow the complete development and debugging of Android apps without use of any other IDEs. The Android UI designer can also be used from within Xamarin Studio.
Xamarin Studio and the Xamarin.iOS add-in allow the development and testing of iOS apps when installed on a Mac with Xcode and the iOS SDK. All code can be written, compiled, and debugged from within Xamarin Studio. In general, the user interface XIB and/or storyboard files must be built within Xcode; Xamarin Studio provides a link to Xcode such that when a xib or storyboard file is double-clicked on, Xcode will be launched.
There is a caveat to this; Xamarin has an iOS UI designer built for Xamarin Studio, yet it has remained in an alpha status for almost a year. I have seen a number of posts on various forums indicating it is stable and safe to use, but Xamarin has been slow to clarify why it is still in alpha status and when it will move to a stable status. We will discuss the use of the iOS UI designer in more detail in Chapter 4, Developing Your First iOS App with Xamarin.iOS.
Xamarin for Visual Studio is an add-in that supports the development of the Xamarin.Android and Xamarin.iOS apps and is available to business and enterprise subscribers. This add-in can be used with any non-Express edition of Visual Studio 2010 through to Version 2013. Android apps can be completely developed using Visual Studio. In order to develop iOS apps, you will still need a Mac with the iOS SDK and Xcode to compile and create the user interface xib and/or storyboard files.
Tip
If you already have a license for Visual Studio and are comfortable with the environment, this add-in will be better suited to you than Xamarin Studio due to it being simple to use.
The following screenshot shows Visual Studio 2012 with the Android user interface designer opened:
The Visual Studio add-in for Xamarin.Android allows the full development and debugging of Android apps without the use of any other IDE. This add-in provides the usage of the Android UI designer from within Visual Studio. For those that have the appropriate licenses and are comfortable with Visual Studio, this might be the best option for Android development.
The Visual Studio add-in for Xamarin.iOS allows you to develop and test iOS apps, but only in conjunction with the use of a Mac with both Xcode and the iOS SDK installed. The iOS code must be compiled and executed on a Mac using the Xamarin's mtbserver. Xcode on a Mac must also be used to develop the user interface xib and/or storyboard files for an iOS app. We will discuss this configuration in more detail in Chapter 4, Developing Your First iOS App with Xamarin.iOS.
Note
Solution and project files created and used by Xamarin Studio are completely compatible with Visual Studio. This gives teams the flexibility to choose which IDE to use and they can easily change throughout the duration of a project.
The advantages and disadvantages of adopting each IDE are shown in the following table:
IDE | Pros | Cons |
---|---|---|
Xamarin Studio | Available for all Xamarin subscription levels Runs on Windows and OS X | Limited number of productivity add-ins available Does not offer support for the use of TFS for source control |
Visual Studio | Most C# developers are already familiar and comfortable with Visual Studio Allows the use of popular productivity add-ins such as ReShaper and CodeRush Allows the use of TFS for source control and issue tracking | Requires a business or enterprise subscription of Xamarin Requires a license of VS Runs on Windows only For iOS development, requires a more complex configuration in which VS must communicate with a Mac running Xcode to perform builds and UI development must be done with Xcode |
Version control can be a challenge anytime you have a diverse set of development tools, and Xamarin certainly adds diversity to most shops. The challenge is making it easy to share and manage code from all of the different IDEs and client apps that folks will be working with; many times they do not have access to the same repositories. Since the benefits of using Xamarin are very attractive to existing .NET shops, many Xamarin developers will find themselves working in environments already committed to using Microsoft Team Foundation Server (TFS). Unfortunately, it's not always easy to connect to TFS from non-Microsoft tools. In the case of Xamarin Studio, there is an open source add-in that cannot be directly supported by Xamarin and can be challenging to configure.
Other version control systems to consider include Git and Subversion. Xamarin Studio contains built-in support for both Git and Subversion, and add-ins for both of these tools exist for Visual Studio. The following table contains useful URLs to download and read about the various add-ins:
Add-in | URL to access it |
---|---|
TFS add-in for Xamarin Studio | |
Git for Visual Studio | (VS2013 has built-in support) (VS2012 requires a free plugin) |
Subversion add-in for Visual Studio (by VisualSVN) |
Xamarin Forms Mac
Like many aspects of software development, there is not a 'one size fits all'. The following table outlines some of the pros and cons to consider when deciding on a source control solution for Xamarin projects:
Xamarin Vs Mono
VCS Tool | Pros | Cons |
---|---|---|
TFS | Already in use by many shops that will consider Xamarin. Free add-in for Xamarin Studio. | Xamarin Studio add-in has been known to be problematic to use in the past. |
Git | Built-in support in Xamarin. Free add-in available for Visual Studio 2012 and 2013. | Difficult to share and synchronize code with other teams in a large organization that might be using TFS for their C# code. |
Subversion | Built-in support in Xamarin Studio. Commercial add-in for Visual Studio. | Difficult to share and synchronize code with other teams in a large organization that might be using TFS for their C# code. |
Xamarin Mono For Mac Download
If you already have a significant investment in using TFS, try to make that work for your Xamarin development as well. This can be done by either having developers use Visual Studio or trying your luck with the TFS add-in for Xamarin Studio.
In this chapter, we provided an introduction to Mono and the suite of commercial products offered by Xamarin and considered the pros and cons of using Xamarin. We also went through the installation process and took a first look at the IDE options available to developers.
Xamarin Mono For Android
In the next chapter, we will take a look at the architecture of the Xamarin.iOS product.