Will Xamarin carry its runtime for all its apps? - xamarin

I am wondering Xamarin carries Mono runtime with its all app package. In this case, if two Xamarin based app installed in a device which will be having two Mono runtime right. Is it a limitation with Xamarin?

On iOS each app has its copy of the runtime. iOS does not allow for sharing of between apps.
On Android you have the ability to select whether or not to use a shared runtime, but this is generally recommended only for debugging, not production.

Related

Xamarin iOS GUI

We've been developing a cross-platform app in Xamarin on Windows and now we are moving to make GUI for iOS counterpart.
If I'm understanding correctly we need to switch to Visual Studio for MAC, on a MAC machine, and continue our GUI development there.
Is it possible to develop everything on Windows and just publish an app on the MAC machine?
How do we include the logic and everything from the android app?
You can use Xamarin.Forms to develop UI for both Android and iOS.
But if its already native then you can still continue developing it in Windows.
For the build and testing you definitely need a MAC, if you don't want to use a VM then you can build it on the cloud using a https://www.macincloud.com/ or other party that uses the same service, and use a simulator on windows.
If its cross platform then I assume you're using a .NET Standard for the shared codebase. So there would be no problem using the same logic for both the Android and iOS.
It is up to you. Many apps will work by just publishing on the Mac. Of those many will have some artifacts that shouldn't be in the end version.
To simplify it is like asking whether you should publish the app without testing and fixing. In 99% no, but sometimes it may work.

Can xamarin apps be built for Windows, MacOS with same source code?

Given an app written in C# for Xamarin, can it be built to run on all the supported platforms with minimal changes, including Android, iOS, MacOS, Windows?
I realize that Xamarin claims 90% of the code is shareable across platforms (and 10% needs to be customized), and I'm referring to that "90%".
What I don't understand is whether that 90% is shareable across the different Xamarin tools,e.g. Xamarin.Forms and Xamarin.Mac or if those are substantially different tools with different APIs, etc.
For example, I see that with Xamarin.Forms I can build for iOS, Android, and Windows. But not MacOS. So, on a Mac, can I install Xamarin.Mac and then build the same app for MacOS ?
You can add a MacOS target for your Xamarin.Forms-based UI, of course, this is done via Visual Studio for Mac:
https://learn.microsoft.com/en-us/xamarin/xamarin-forms/platform/other/mac
There are items within Forms that are not feature complete on MacOS and thus it is still in a "Preview" release and those are listed on the "Platform Support macOS Status" wiki:
https://github.com/xamarin/Xamarin.Forms/wiki/Platform-Support-macOS-Status
Xamarin.Forms is the framework that allows you to create cross-platform apps between Android, iOS and UWP. In my experience, a lot of the features of Xamarin.Forms do not transfer over to Xamarin.Android. In fact, a big chunk of the way things are done for UI Xamarin.Forms will not transfer over to the Xamarin.iOS and Xamarin.Android. Most of the times when I find a solution that works in Xamarin.Forms and I try to do the same thing in Xamarin.Android I end up just figuring out the problem myself in Xamarin.Android from scratch.
When they say that 90% is shared, they mean that within Xamarin.Forms... 90% of the work on your models and code behind can be shared between the projects (within that Xamarin.Forms solution) and 10% will have to be custom tailored for each platform (UWP, Android, iOS)
EDIT: Just for clarification in the future, you need an iOS device or an iOS virtual machine to compile the code on iOS
To build Xamarin.iOS apps with Visual Studio 2019 on Windows, you will
need:
A Windows machine with Visual Studio 2019 installed.
This can be a physical or a virtual machine.
Windows system requirements
A network-accessible Mac set up with Apple's build tools and Xamarin.iOS.
Visual Studio 2019 accesses this machine over a network
connection to use Apple's build tools, which are required for
compiling native iOS applications.
Mac system requirements
source: https://learn.microsoft.com/en-us/xamarin/ios/get-started/installation/windows/?pivots=windows
As long as you use .Net code and Xamarin.Forms it is 100% portable/sharable across every single project. Xamarin.Forms are currently in beta for macOS and Windows WPF (but for UWP it is not beta), and for macOS particularly they don't have the true native look.
Xamarin does support using the native interfaces and native APIs and whenever you do that, it is not portable.
So there is nothing like 90% sharable, it may be some estimate for some cases. It can be 100% sharable or it can be only 10% sharable depending on your project and how much you stick to the sharable APIs.

Visual Studio App Center Build for iOS

I know that all iOS apps must be built on a Mac before they can be submitted to the App store but I've noticed that Visual Studio App center provides build services - even for iOS.
Can this be used for beta testing purposes or do I still need a Mac to do the build even for beta testing purposes?
BTW, the app is an enterprise Xamarin Forms app for internal use.
Yes, you also need Mac for Beta testing.
But I use https://www.macincloud.com for testing rather then buying Expensive hardware.
It has built in Support for Xamarin and it very cheap.
iOS not like Android you also ned Apple Developer Lic. for distribute your app.
you can purchase your Lic. as your Requirement from hear : https://developer.apple.com/support/compare-memberships/
(if you just want to check how look your app in Device you can use Xamarin Live )

Xamarin based Mac OSX app deployment size

I'm thinking about porting a .NET based desktop application to Mac using the Xamarin.Mac platform. I can't seem to find any info about deployment size of the resulting application. Is it like Xamarin iOS development i.e. the C# code is natively compiled into mac code and I don't have to worry about distributing the .NET runtime? If no, then how large is the .net runtime that I need to distribute with my application?
Xamarin.Mac apps are self-contained and do not require a separate Mono framework to be installed. Only the portions of the framework that your app uses are included inside the app bundle in order to keep the size as small of possible.
A x86_64 Xamarin.Mac Cocca Hello World Xamarin.Mac Mobile Framework based App with the linker set to:
Don't Link: ~48mb
Link Framework SDKs Only: ~20mb
Link All: ~20mb
Note: Sizes based on Xamarin.Mac 2.9.2.81
Note: Using the other Xamarin.Mac frameworks will of course produce slightly larger bundle sizes...
Note: This is a do nothing app, so once you start adding assets, content, code, external packages, etc... your app size is going to grow.
Xamarin.Mac apps are not compiled via LLVM into bit-code and/or machine code like Xamarin.iOS apps. There are some old email threads floating around that this was begin looked at along with AOTing, but I assume lack of demand vs. engineering time required never was justified.
Note: It is possible to use a custom OS-X Mono build that is LLVM-enabled, but I have not done this in x86_64-based Mono OS-X apps for App Store distribution, only local app for private distribution. This is all done outside of Xamarin Studio and not a supported configuration. That said and with xamarin-macios begin open-source now, if you are using Xamarin.Mac Mobile Framework in your OS-X app which is the shared Unified framework, you can wire up an Mono/LLVM-based build environment, but again, not a Xamarin supported configuration.
Dec 2018, Xamarin.Forms + Xamarin.Mac give 16Mb bundle size for a an app with 5+ forms. This is a self-contained application with no dependency on Mono or whatsoever framework installed.

Xamarin: Can I do in a cross platform project the "Android part" and do IOS when the rest is finish?

I have a project in Android Studio (on a pc), and as far as I know now Microsoft owns Xamarin and its free once you have a Visual Studio license, then you can develop apps using C#(Already know that I have to port the JAVA code) and then compile in a MAC the IOS app.
My 2 concerns are:
When you can't compile, will the IDE show the IOS related errors?
There is a clear implementation of "cross platform code" vs "specific code"?
How Xamarin manage it?
In addition, our plan is to finish the app for Android which is our primary target and then manage the IOS, besides the other questions, what I need to know is if that is possible.
Yes, the VS IDE will show you build errors from the iOS build server.
Yes, you can build an Android app using Xamarin and later extend it to build an iOS app also. This is easiest if you use Xamarin Forms, but it also possible with native Android/iOS UI, but will be much more dependent on how you architect your applications.

Resources