Is this informatoin true about Xamarin?

Hello,
I am looking for a cross platform framework for a mobile app development. Since I love developing using .NET, it was natural for me checking out Xamarin, as I love static languages (and C# specifically) and don't like the dynamic ones that are common for other cross platform frameworks (HTML, CSS, JavaScript).
As I was searching for other frameworks just to see what's out there and if there's something for free (I am a private developer, so money is more of an issue to me) I came across another framework. They made a comparison of their framework to Xamarin and listed some items that a bit concern me about Xamarin and I'll be glad if you could elaborate on them.
Here are the few points they listed:

1) Xamarin UI code is not cross-platform: instead, the user needs to write specific code for each platform.
2) Xamarin often requires platform-specific coding.
3) Xamarin doesn’t support Linux.
4) With Xamarin, you still need to know ObjectiveC and Java.

Is there any truth to these points?

Best Answers

Answers

  • YonatanNYonatanN ILMember

    @adamkemp Thank you for the reply!

    regarding what you said about section 1 and 4.
    In section 1 you wrote: "the advantage is that you are using native APIs, which means your app is a native app. Anything someone can do in an Objective-C or Swift app for iOS you can do with Xamarin.iOS, and anything someone can do in a Java app for Android you can do with Xamarin.Android. There are no limitations."

    And then in section 4: "When writing a Xamarin app you should pretty much never have to actually write Objective-C or Java code. Our (very complex) apps have zero Objective-C or Java code, and most of my team doesn't know a thing about those languages."

    It sounds a bit strange that you say in section 1 that using the native APIs makes them native apps which implies for better and faster apps (at least as I understand it), but in section 4 you wrote that you got very complex apps and did not use any of the native APIs at all? I would expect that a complex app would need native API usage?

  • adamkempadamkemp USInsider, Developer Group Leader mod

    I understand your confusion. The word "native" is ambiguous. Let me explain using iOS as an example (Android works the same). The way Xamarin.iOS works is that they take the Objective-C API and then create a C# wrapper around it (they call that a "binding"). Then you write your code in C# using that wrapper. That means, for example, when you create a UIButton in Xamarin.iOS in C# you are literally creating the same kind of object using the same API as you would in Objective-C. It calls into the Objective-C API. That is what I mean by "native API". It's not trying to abstract away UIKit. It's just reflecting that platform API into a different language.

    What I said about our complex apps is that none of our code is written in Objective-C or Java. All of the code that my team wrote is in C#. However, that code is still using UIKit on iOS and the standard Android UI framework for Android. Only the language is different. We're using the same framework, the same APIs, as everyone else, but we write all of our code (for both platforms) in C# instead of writing iOS code in Objective-C/Swift and Android code in Java.

  • YonatanNYonatanN ILMember

    So if I understand you correctly, the UI code might differ between the platforms but at least it is still written using C#? And the only thing you need regarding the native API is just finding out the class names of the UI object so you can create them using the C# wrapper?

    And just another question about what you said "The downside is that Xamarin.Forms is a bit more limited in what kind of UIs you can make" - What limitations are there when using Xamarin.Forms? Where is that point when you say something "Well I need to make that [some feature] which needs to use [some UI elements] so I won't be able to use the Xamarin.Forms" ?

  • SKallSKall USMember ✭✭✭✭

    Simple example about Xamarin Forms is UI control checkbox. In iOS there is no native checkbox control as Apple has decided the UISwitch is enough. Both Android and Windows Phone have checkbox controls but since there isn't one on iOS then there isn't one in Xamarin Forms. When you start abstracting then most of the time this leads to what is called "Lowest Common Denominator" where one platform is limiting the others. This applies to Xamarin.Forms applications but not to Xamarin.iOS nor Xamarin.Android.

  • YonatanNYonatanN ILMember

    And can the UI be built partially with Xamarin Forms and partially with the Xamarin.iOS and Xamarin.Android? Meaning I can have a certain screen built with the forms which will be common for all platforms and another screen with a check box that will be built for each platform with its own native API?

    And was I right about the C# usage that even when constructing Xamaron.iOS or Android, it's actually still using C#, only with classes that are named as the native GUI elements?

  • adamkempadamkemp USInsider, Developer Group Leader mod

    So if I understand you correctly, the UI code might differ between the platforms but at least it is still written using C#? And the only thing you need regarding the native API is just finding out the class names of the UI object so you can create them using the C# wrapper?

    Correct.

    What limitations are there when using Xamarin.Forms?

    Sami's example is a good illustration of this. To add on to that, the primary use case that Xamarin intended for Xamarin.Forms is relatively simple forms-based applications. If you want to learn more about Forms and which use cases it's good for you should start here.

    And can the UI be built partially with Xamarin Forms and partially with the Xamarin.iOS and Xamarin.Android?

    Yes. Xamarin.Forms can be extended using native APIs. For instance, if you wanted a checkbox you could make a custom checkbox on iOS and then make a custom renderer for each platform that uses the native checkbox controls on Android and Windows and then your custom checkbox on iOS.

    And was I right about the C# usage that even when constructing Xamaron.iOS or Android, it's actually still using C#, only with classes that are named as the native GUI elements?

    Your code is in C#, but when you call a native API (for example when you construct a UIButton) you're calling into native code. Xamarin didn't just port the native frameworks. They wrapped them.

  • YonatanNYonatanN ILMember

    By the way, can you use Xamarin for the server side as well?

    On a personal note, do you recommend Xamarin for a personal developer? I am conflicted... I love using C# (even though in my current job I usually use Java for native Android programming), and the fact the everything will probably go faster if I use it. I am also not thrilled at all about using other cross platforms frameworks which will probably require me to study HTML, CSS, JavaScript since I don't really like dynamic languages. On the other hand, Xamarin is not free... Maybe it's an overkill for a personal developer? And maybe the indie license which is the only one I can afford, won't give me everything I need?

  • adamkempadamkemp USInsider, Developer Group Leader mod

    No, Xamarin only supports client-side apps. I would say more specifically that Xamarin only supports platforms that other companies aren't support with C#. Microsoft supports Windows desktop programming with WPF, for instance, so Xamarin doesn't need to support that. Likewise, you can write a backend in C# using Microsoft tools so you don't need Xamarin to do that.

    On a personal note, do you recommend Xamarin for a personal developer?

    If you can afford it (or one of the free or cheaper options is available to you) and you will be supporting multiple platforms and you know C# then I would recommend it.

  • YonatanNYonatanN ILMember

    And just one last question...

    No, Xamarin only supports client-side apps.

    but you can still make a code in Xamarin that is using asynchronous calling to a web service right? and also use LINQ? These are some of the most basic things I would expect possible from a framework that is supporting C#.

  • YonatanNYonatanN ILMember

    Adam thank you very much for all your help! I might indeed try it out instead of learning other languages.. time is money as well.

  • SKallSKall USMember ✭✭✭✭

    @YonatanN I just wrote a sample POC (Proof-of-concept) project where I am using the code both on the server side and on the client side. High code reuse and you get both a website and mobile client relatively easy. On the server side data interface is implemented with SQLite (and reused on the mobile side) with WebAPI implementing the same interface and using SQLite as the data source. View models on PCL library together with the data interfaces and it was very easy to use them both with Xamarin.Forms and Razor on the server side. Add in Knockout.js for MVVM binding on JavaScript and it's so easy it should be criminalized... ;)

    I'll see if I can find the time to publish some of the code.

  • YonatanNYonatanN ILMember

    Thank you I'll appreciate it.
    I am not very experienced in server side development and only know a bit of what we're doing at my current job which is using PHP with MySql. It would be nice to see a code shared between the client and server.

Sign In or Register to comment.