10 ms·
Some thoughts after (almost) a year of real Xamarin use
- mark9white 12y agoHaving been building a decent size app (tens of thousands of lines) in Xamarin this really reflects our experience. One particular point is that the memory management is fairly complex under the covers with bridged objects and multiple memory management mechanisms working in parallel, this occasionally rears its head. Another important point is they do provide a single automation test framework that targets both platforms. If I was starting the app again I'd be very conflicted whether to use Xamarin vs native, though ReactNative looks very interesting too and doesn't have the complexity of running the full .net stack.
- mwcampbell 12y agoI wonder if RubyMotion is much better when it comes to memory management. According to the website, RubyMotion objects are platform native objects (ObjC objects for iOS/Mac, java objects for Android), so each platform's native memory management scheme applies, rather than having two GC's or GC plus reference counting. I'd probably use RubyMotion for an upcoming project at work if it had a port to WinRT for Windows universal apps.
- badlogic 12y agoJudging by the docs [1], RubyMotion does indeed not seem to use a GC on iOS but instead relies on ref counting, reusing auto-release pools. That means cyclic refs are an issue. You have to explicitely use weak references throughout your code. They are not on Android, where RubyMotion uses the Dalivk/ART GC. So, your cross-platform Ruby code has to deal with two different types of memory management systems. I'm not sure this qualifies as a better option to what Xamarin provides. [1] http://www.rubymotion.com/developers/guides/manuals/cocoa/runtime/ http://www.rubymotion.com/developers/guides/manuals/cocoa/ru...
- mwcampbell 12y agoDoesn't seem like a problem to me. The occasional weak reference to break cycles wouldn't hurt anything on Android, would it?
- badlogic 12y agoI guess not. But it's going to be tough to use normal Ruby gems on iOs that aren't aware of the ref counting.
- candl 12y agoHere's a recent extensive benchmark against popular cross-platform toolkits: https://medium.com/@harrycheung/cross-platform-mobile-performance-testing-d0454f5cd4e9 https://medium.com/@harrycheung/cross-platform-mobile-perfor... (including memory usage)
- alimoeeny 12y agoNow that we are at it, if you have experience / recommendations on developing for multiple mobile platforms please share it here. As far as I understand it, if you are big and have the resources, your best bet is still to develop separate native apps for each platform. Right?
- ccvannorman 12y agoI use Unity3D to develop for multiple platforms and can't recommend it enough -- it is a 3D game engine so it may be too heavy for some applications, but it can do anything you want it to. Everything is written in C#/.net on your end, Unity cross-compiles to other platforms. Unfortunately, the built-in IDE for Unity is MonoDevelop, which has all the problems Xamarin does, You don't have to use Mono though, you can use any editor.
- alok-g 12y agoHow useful is it to develop non-gaming applications (including 2D UIs)? And how much overheads it results in in terms of application performance and size? Thanks.
- strangecasts 12y agoNot very: it fundamentally assumes you're making a game, so it draws 3D scenes and uses a continuous update loop, which taxes the battery on mobile devices. The UI tools are also just finicky enough to make non-game app development a pain. In addition, it does have a little size overhead - the smallest possible build on iOS (a blank screen) is 12 MB with all the optimizations on, and double that if you need to invoke System functions or libraries that need them.
- dangero 12y agoHave you actually seen a performance comparison when idle? I ask because I have been curious about trying to build a full application inside Unity. Update() on Unity doesn't strike me as being all that different than a normal GUI app's message loop.
- miguelrochefort 12y agoMost people don't realize how convenient it is to build and maintain your entire codebase (iOS, Android, Windows Phone, Windows 8, web client, web server) all in one place (Visual Studio), mostly using C# and Typescript. Just have a Windows VM on your Mac. It truly is the best of both worlds.
- omegavesko 12y agoYeah, a huge part of why I still (mainly) run Windows at home is easy access to Visual Studio. With third party extensions (e.g. ReSharper), and even without them, it's probably the best single IDE I've ever used. I still use WebStorm + JS for frontend Web work, though. Would you say it's worth the switch to VS and TypeScript (though WebStorm supports TypeScript, too)?
- bkjelden 12y agoI haven't used WebStorm, but using VS for typescript was way better than using it for javascript. Developing typescript in VS is about as easy as developing C# in VS. Everything "just works".
- the_rosentotter 12y agoThe .Net/Visual Studio ecosystem has been looking increasingly compelling these last few years. But, I am old enough to remember evil Microsoft, so I will almost certainly never go there.
- miguelrochefort 12y agoVisual Studio with Web Essentials is awesome. http://www.asp.net/visual-studio/overview/2013/visual-studio-2013-web-editor-features-browser-link http://www.asp.net/visual-studio/overview/2013/visual-studio...
- forcer 12y agoGreat article, we have a similar story but only used Xamarin for 1 iOS app. If I had option to go back I would not chose Xa marin, we would have used native. Main reason being that we now need to add 3 SDKs to our app and none of them are supported in Xamarin, it seems it will be cheaper and more predictable to rewrite to native than implementing SDKs. Porting libraries to Xamarin is possible in theory but in practice major effort and hard to do without access to library code.
- badlogic 12y agoI think this is the key to making a great cross-platform solution. Pretty much any mobile app that's not a toy relies on native 3rd party sdks, be it ad providers or fancy Ui compinents. Whatever platform first solves the issue of making integration of pods on iOs or AARs on Android a smooth process, will win. I don't see any options that come close to solving this. Xamarin is not native to either iOS or Android. RoboVM (the one i work on) can cheat, as we only need to solve it for iOS, Android comes for free. React Native has no clear path for accessing 3rd party libs at all yet. Whatever they can come up with will be further complicated by the fact that the JS engine is single threaded.
- peterhunt 12y agoWhat? http://facebook.github.io/react-native/docs/nativemodulesios.html#content http://facebook.github.io/react-native/docs/nativemodulesios...
- badlogic 12y agoI stand corrected, I must have overlooked that section. Callbacks (used to pass return values) are still experimental though, and it's unclear how this will port over to Android once that backend works.
- ianlevesque 12y agoBindings are actually not that bad with Objective Sharpie. What SDKs are giving you trouble? I would agree that for a single platform it is not worthwhile though.
- Avalaxy 12y agoMy experience with Xamarin: I've been working for half a year with Xamarin Forms. I Think using Xamarin is the way to go, there is no need to re-code something for 3 different platforms when you can just have a shared codebase. Tools like Cordova and Phonegap don't work. They produce a very crappy experience that doesn't use the native OS functions, doesn't look and feel native, feels slow and has many bugs (for example they can't use the hardware back button). So Xamarin can create real native apps, which is a HUGE advantage over Cordova/Phonegap/others, but there are also serious downsides: 1) It's BUGGY. Many components have bugs, and the code often behaves in very very weird ways (I had exceptions not being caught by catch blocks for example), many debugger functions don't work properly with mono (like locals) and very, very often exceptions are thrown without ANY indication what caused them or where they occurred exactly. 2) You a limited in the features you can use because it's a wrapper (as mentioned in OPs post). 3) Documentation sucks and is very limited. It's getting better (mostly because of StackOverflow), but it's still not sufficient. 4) It has XAML which is very nice combined with MVVM, but the XAML implementation sucks. It doesn't have intellisense and it's just generally very awkward. I don't think the 'big cost' is a valid argument against Xamarin. If you can develop 1 app for $40k where you would normally have to develop 2 or 3 apps for $30k each, that's a BIG win and Xamarin's costs are negligible.
- JamesMontemagno 12y agoHey there, I am James Montemagno a developer evangelist at Xamarin. I have been developing native apps with Xamarin for nearly 4 years now across iOS, Android, and of course Windows (I was a customer for 2 years before joining Xamarin). I just wanted to clarify a bit about Xamarin and Xamarin.Forms. It is important to know that Xamarin.Forms is a cross platform UI layer that sits on top of the core Xamarin platform. Using native Xamarin you are still sharing your backend C#/.NET code and then building out native user interfaces for each platform. The Xamarin.Forms library adds an abstraction over common controls available on iOS, Android, and Windows Phone. Xamarin.Forms is extremely extensible, but it is not for every app, especially if you need a lot of custom UI or API access. For data entry, proofs-of-concept, or other simple apps it is great and we have a guide to help you select: http://cdn1.xamarin.com/Architecture%20Selector.pdf http://cdn1.xamarin.com/Architecture%20Selector.pdf. The nice thing here is that either approach can use a shared-code backend. I think I can address some of your concerns below: 1.) I would love to know which components you were having issues with and I can work with the team. There are a lot of settings in Visual Studio and Xamarin Studio as far as when to break on exceptions so I would love to help out here. 2.) If you are exclusive to using Xamarin.Forms then yes you will have a limited set of controls, since Xamarin.Forms is a subset of common controls. It is extensible via “CustomRenderers”, but that require some work and if you need a lot of them then it might be worth looking into the native approach without Xamarin.Forms as this approach will automatically give you access to every control on each platform you are creating. 3.) We are always looking to expand our documentation across all of our products and highly recommend checking out our updated developer portal: http://developer.xamarin.com http://developer.xamarin.com there is a plethora of Xamarin.Forms related documentation as well as http://developer.xamarin.com/guides/cross-platform/xamarin-forms/ http://developer.xamarin.com/guides/cross-platform/xamarin-f... It is pretty extensive, but if there is something missing please please please let us know and we will work with the documentation team to add it. In addition to this documentation we do have a book that has been written by Charles Petzold on Xamarin.Forms that is freely available: http://developer.xamarin.com/guides/cross-platform/xamarin-forms/creating-mobile-apps-xamarin-forms/ http://developer.xamarin.com/guides/cross-platform/xamarin-f... 4.) For XAML intellisense it is built right into Xamarin Studio, for Visual Studio there is an extension that you can install: http://www.cazzulino.com/mobileessentials.html http://www.cazzulino.com/mobileessentials.html This will be integrated automatically in the future. I apologize that this is tricky to find. Hopefully this helps out a bit with some of the issues that you have run into, but again please please feel free to email me with any questions, encounter any problems please reach out to us so we know and can fix them. You have my direct line: james@xamarin.com.
- tluyben2 12y agoWe tried mostly anything (and not only tried; we used for production work because clients wanted us to) and, outside native, Xamarin really is the best thing we worked with so far. For it's downsides, the upsides are too good to not take advantage off. Some cons I recognize but the case everyone keeps mentioning that you get into issue when you really want to do complex native platform stuff with animations etc I haven't encountered. Nor is integrating SDK's an issue. It's just something you plan in your project; it's a one-off. We integrated very large SDKs for hardware products and the hardware vendors, when something goes wrong, always blame the wrapper and it has 0 times been the wrapper; most of the times a bug or undocumented feature by the SDK creator. The wrapper is so thin and the mapping is so clear that it's actually never an issue.
- fnayr 12y agoHave you tried Cocos2d/Spritebuilder? If you don't ever make games for clients it wouldn't really make sense. But if so could you explain what you didn't like about it?
- tluyben2 12y agoI have used Cocos2d for clients and Monogame and Unity as well and the combination as well. I was talking about Xamarin here as app building tool, not for games. I do like Cocos2d. Cocos2d is nice to work with as well as with Unity; we had most issues with Monogame (and that uses Xamarin) but once we got over those issues I believe we would be effective equally with Cocos2d & Monogame and slightly more so with Unity (because of the community mostly).
- seanwilson 12y agoI've used Cocos2d with JavaScript binding a few times and really like it. You can develop primarily in a browser then package a web (without requiring plugins), Android, iOS, Mac and Windows app from your code with minor modifications.
- DenisM 12y agoCan anyone comment on Xamarin learning curve? If I have experience in both iOS and c#, how much time does it take to get up to speed with Xamarin?
- natfriedman 12y agoWe launched an online training program called Xamarin University, and so we have a fair amount of data on how long it takes people to get to the point where they are proficient enough to write a production app. As you might expect it's highly varied. But the median is about 45 days to pass our certification.
- DonGateley 12y agoIf one is not burdened with knowing anything yet is it feasible to start and stay with C#/Xamarin alone or must one also master the other environments to fill gaps?
- skwirl 12y agoI'm sure they'll tell you that you can do this using Xamarin.Forms but we quickly realized that it is only useful for very basic UI. Anything of more than trivial complexity is going to require that you learn the platform specific frameworks and idioms (on top of learning Xamarin). At this point I have no idea if Xamarin is going to save time or cost time over going native. My guess is that it will depend on how much domain logic you can share between platforms.
- skwirl 12y agoI have been starting to learn how to write mobile applications with Xamarin to contribute to a friend's project and had not heard of Xamarin University until I saw this comment. Now that I have looked at it, I'm a little confused. I can understand charging for 1-on-1 help, interactive classes, and certification exams, but why wouldn't "recorded class videos, class labs and materials" be free? Don't you want it to be easy for people to use your software so that people will? Charging $1995/year for learning materials seems pretty steep. The learning investment is what makes me most hesitant to use Xamarin. It was supposed to be less of a learning investment because we all have C#/.NET experience, but now I'm not so sure. It now seems like we're going to have to dive deep into learning iOS and Android specific UI concepts anyway, and on top of that learn Xamarin concepts and quirks, and if we want to continue using Visual Studio when the trial is up we'll have to pay $1000/year. Maybe we're just not the target market.
- ParanoidShroom 12y agoI've been using Xamarin forms a lot now. They are miles from being as good as native development. Soooo many bugs in xamarin itself. When using Xamarin forms, you will not provide as good of product as you would native. There are also very little controls. Xaml works, but is really slow. And the layout is SOOO inefficient ! But the problem is even greater, you can't merge Android and iOS layout passes. On one platform, measuring is really fast and the other really slow ... Xamarin forms can't compensate and give native performance to this. They don't even have listview recycling ... One developer even said "RelativeLayout is probably best for you here and can do this" to the question what the fastest layout is. For Android, this is the WORST layout possible. Anyway, you will spend a LOT of time fixing Xamarin bugs and developer their controls. However, I LOVED .net functions, especially LINQ ! Anyway, development was really slow and performance is no were near to native. So if you want to deliver a simple app to a client and be cross platform, then sure. But don't try to maintain that app, you will regret it. I'm afraid the whole Xamarin thing won't solve "cross-platform" which isn't a real problem but sure. Its just another horse that Microsoft is betting on. Oh and for the people that will have to do it anyway. Use Resharper ! Xaml IntelliSense !!! It will help you a lot. I'm sorry I'm so negative, but it was genuinely the worst development I had.
- radiofan 12y agoWhilst it may require more work than Xamarin Forms, MvvmCross is a way of creating cross-platform applications using Xamarin without any of the issues you've documented above.
- taspeotis 12y agoI have helped ship two commercial apps with MvvmCross and it works pretty well.
- themothaship 12y agoMvvmCross is pretty legit. I felt that it really made Xamarin worthwhile. I found it quite a bit easier to keep the platform specific code to a minimum and when I needed to write it it was abstracted out as much as possible.
- curiously 12y agocan you develop iOS apps in a windows environment without any mac machine? is there a cloud build service for mac that you can integrate?
- moljac 12y agoNo. Xamarin stuff obeys others: Apple says no dev w/o Apple hardware
- moljac 12y agomacincloud?
- curiously 12y agoit would be nice if xamarin implemented it.
- bernadus_edwin 12y agoMacincloud is enough. If you dont have mac, and belive in xamarin, My sugestion is try build on android first, If have good respond from customer, then buy mac and porting to iOS Porting xamarin android to iOS is very easy if you have mvvm knowledge
- JamesMontemagno 12y agoIf you are building for Android you can do it 100% of on Mac OR a PC. Since Google ships sdks and tools for both Mac or PC that is why you can do this. Apple is much trickier. You can still open iOS projects, modify code, and compile without a Mac connected. However, to actually do design in the storyboard designer in VS or build the package to deploy on a simulator or device you need to be connected to a Mac somewhere on your network. This is apple restrictions and also for the fact that all of the simulators and tooling only exists on the Mac. You don't have to have a power house machine to do this though, something like a Mac Mini would work fine. There are some cloud solutions out there as well.
- lordnacho 12y agoI built the same app using Android and iOS, but considered Xamarin at one point. I'm still considering it. When I was deciding, I had a look at the Xamarin docs, and it seemed to reference the underlying native idioms quite often. I figured that I'd end up spending the same amount of time learning Xamarin as iOS, so what's the point? In the end, I found the backend logic was pretty easy to write in Android or iOS. They're both OO languages, and once you've figured out the model it's not going to be hard to port. After all the phones all have similar hardware, and there's got to be some way to do the same thing. The problem is the UI. I found it was a massive pain to learn two ways to lay out stuff. Android seems to encourage you to layout things in group containers (horizontal/vertical) that have an internal logic of their own. iOS seems to have a thing for constraints. Neither is very obvious, and they are not that easy to port from one to the other. They also each have somewhat different aesthetics (this friggin changes every time there's an update), which means you need slightly different designs (no hardware back button? no built in check box?). After grappling with this for ages, I ended up doing webviews with responsive pages. Makes the thing look like a web page, but a simple one that works like an app and can also be tested on a desktop browser.
- rhodysurf 12y agoI completely agree.. I just feel that native is worth the extra time, at least for me. Its really not hard to reimplement OO logic in objective C or Java if you have already written it for one of the two.
- golergka 12y agoIs it possible to do logic code in Xamarin and develop UI natively for each platform?
- moljac 12y agoyup. Xain is native... if you are picky enough "subnative"
- izacus 12y agoThat's actually the way Xamarin works the best - you usually don't develop UI natively, but use Xamarin's wrappers for native UI elements for each platform separately. They're not all that compatible when it comes to UI and UX anyway.
- JamesMontemagno 12y agoThe approach with Xamarin is that you are able to build out a shared C#/.NET business logic layer. All of your platform independent code such as Models, ViewModels, Database code, Restful Service calls, etc. You get to use the power of C# and .NET to build this out. Then you build out user interfaces for iOS, Android, and Windows and tie this logic all together. Xamarin apps are native so you follow the same paradigms for building the UIs out such as Android XML and iOS Storyboard or XIB files, but you can build these out in the Xamarin Designers for both iOS and Android inside of Visual Studio or Xamarin Studio. On the code behind side of iOS/Android (UIViewController or Activity) you write all of this in C# with C# features like LINQ, events, delegates, etc. and you have access to 100% of the iOS and Android APIs of the platform as well. Now we do have the Xamarin.Forms library which adds on top of this to build on a shared UI layer for iOS, Android, and Windows Phone as well. However it is not for every app and we have guidance at www.xamarin.com/forms. Hopefully this is a nice overview of the platform.
- aliakhtar 12y agoIf anyone here has tried out Titanium by Appcelerator, I'd very much like to know how your experience was. I've heard conflicting reports on how native it actually is. This article says it uses HTML5 / web views, but I've heard that it uses native widgets, and is pretty close to native. Any ideas? And, do most of the things listed here apply to it as well?
- dottrap 12y agoTitanium for iOS and Android use native widgets, not web views. They have a target called mobile web which might use web views.
- themothaship 12y agohttp://forums.xamarin.com/discussion/comment/30355 http://forums.xamarin.com/discussion/comment/30355 This to me sums up my experience with Xamarin. It has A LOT of potential, and I did generally enjoy working with it. However, the amount of small issues I dealt with that were never solved (and still haven't been solved 2 years later) are what drove me away. That and the cost...
- insaneirish 12y ago> but 1000$ developer/year is not exactly cheap. That is incredibly cheap. It's the sort of cheap that's so cheap you wonder what the catch is. Assuming a perfectly spherical developer, you're at $100,000/year. You're using Xamarin because it makes that developer more efficient because (1) you've determined C# is an easier language to maintain and/or (2) cross compatibility is worth something. If this developer is just 1% more efficient, you've paid for your Xamarin license. If he's not 1% more efficient, why are you even using Xamarin in the first place?
- balabaster 12y agoEr, that's on top of your Windows license, your Visual Studio license, your Apple Developer License, your Apple Macbook because you can only compile and deploy to the app store with a Macbook... oh and Xamarin university if you want to become certified... and if I understand the terms correctly, it's not $1000 per developer, it's $1000 per developer per platform, so if you want iOS and Android, it's $2000 per developer on top of all that previous licensing. So to say it's incredibly cheap at $1000 isn't the whole story.
- cwyers 12y agoYou don't need a MacBook. You can develop on Windows (which means you don't have to pay for that Windows license) and use a Mac Mini on the network for the OS X build requirements.
- declan 12y agoHas anyone had the opportunity to compare Xamarin with Corona SDK? Corona SDK is free and builds to Android/Windows/iOS with cross-platform wrappers available for what Corona has chosen to wrap, which can be different for each platform. You don't get access to native UI elements. Instead, Corona offers OpenGL-based replacements (which may or may not be sufficient). You can also pay for Corona Enterprise and write your own platform-specific wrappers around native objects.
- Michielvv 12y agoI've been on projects with both: For business like apps, Xamarin (Forms in my case) is miles ahead. Although Xamarin.Forms isn't really stable (We experienced quite a lot of regressions with each new version) neither is Corona. Corona is nice if you have a lot of custom graphics, but if you are going for pretty standard user interaction, you will spend a lot of time recreating what exists on other platforms. For both Xamarin.Forms and Corona you will run into the limitations, but with Forms it is much easier to adjust those with native code. I think the main issue with Corona is that they are more focussed on the game case (for which it works) Finally, I really started to appreciate C# after doing Lua, PHP and JavaScript for years. Especially on a complex app, the static typing really helps making changes to code you did not write yourself.
- BuckRogers 12y agoI've been using Kivy. But decided if I did native, I'd only support iOS. Mostly because I don't want to go down the rabbit hole of having to support some random Android device. So I'm looking at learning more about Swift and that ecosystem someday. I don't know C# but I certainly see Xamarin as an upgraded version of Kivy.. obviously going from a free platform to a paid one. It's something I've keeping my eye on for quite some time. If I ever find Kivy and the native iOS development combo to not meet my needs, Xamarin is the next stop for me.
- jjude 12y agoWhat is your experience with Kivy? Have you submitted to AppStore? I'm evaluating between Kivy & Ionic. Hearing your experience will help.
- michah 12y agoI have worked with various cross platform tools for a few years now and in the end all of them came to the same conclusion: Its faster and easier to get a prototype or very simple (non-polished) app working that does not rely on specific api's to the mobile too much. So basically you will manage to get 80% done more quickly with the cross platform tool. However the last 20% are the very tricky part. There might be some strange bugs appearing from the cross platform tool that are hard to solve or just simply wanting to achieve a very polished app with smooth transition and the latest 'native' UI components and UI paradigms (e.g. Android Lollipop). I also had a few major bugs coming from the interface between the native SDK and the cross platform framework. One example was that suddenly the phone fonts for some Asian languages were not displayed anymore. These problems often happened when there were some SDK changes on Android or iOS and the cross platform framework had to catch up with these changes. Compared to native developments its also way harder to find good libraries and solve bugs (e.g. via stack overflow) because there are just way less people developing with these cross platform tools. Since last year I stopped all cross platform developments and are now developing for iOS and Android natively and I realised that I am actually developing IN SUM faster natively then before with the cross platform tools. Main reason for this is that I have a huge focus on polished and high performing UI's and in the past I wasted a huge amount of hours just to fight the weaknesses of the cross platform tools. So my recommendation for all who want to develop polished and professional iOS and Android Apps is now to go the native route from the beginning. Its better to try and save time by shifting some code to the server side (if you have a mobile app that extends a web app) and by developing a great abstract documentation/specification that can then be quickly implemented in the respective native language.
- deleted 12y ago[deleted]