News
What's New in Visual Studio Mobile Development
Mobile developers using your favorite flagship IDE from Microsoft have a lot of new features, tweaks and improvements to work with, including functionality for faster deployments, improved XAML editing, AI-assisted IntelliCode and much more.
This month's Visual Studio Mobile Developer podcast handily rounds up the new goodies as detailed by Microsoft's James Montemagno and Matt Soucoup, who discuss all of the above along with complete guidance for using existing C++ libraries, iOS and Android designer improvements, the much-requested bindable layouts, new previews and releases and so on. Here are some highlights.
Faster Inner Development Loop
The big news for Visual Studio 2019, of course, is the third preview and a launch date for the main release on April 2. In last month's preview 2, Soucoup said one of the features he's most excited about is a faster build-deploy-debug experience, or an inner development loop.
"So what does an inner dev loop mean?" Soucoup asked. "It's for people who like to make typos like me, so it gives you faster builds. So if you make a, let's say you make a XAML change, that's gonna make faster builds so you can redeploy quicker. So it's that inner dev loop when you're making compile-type-compile and going back and forth, so it's ... you're more productive that way so it has up to 50 percent difference."
A blog post by Microsoft's Pierce Boggan explains more. "From your feedback, we found that we could get the highest impact by focusing on optimizing incremental builds and deployments.
"Incremental build times in the Visual Studio 2019 Preview for the SmartHotel360 app are 29.66 percent better than the Visual Studio 2017 version 15.8 release, and deployment times are over twice as fast."
Improved XAML Editing
Preview 2 also introduced better XAML UI authoring for iOS and Android apps, such as the ability to edit common attributes for Xamarin.Forms controls in Visual Studio 2019 via new property panels.
"We have now what's been called a property panel," Soucoup said. "And so what you can do with that is, you have your XAML on screen, you can go into a panel on the other side and start editing your properties there, like your background color, so you don't actually go in and type into the background color, add to it, get it on the property panel and get it in there. It's gonna save you some keystrokes so you don't have to remember names of XAML or anything like that."
Smarter IntelliCode
IntelliCode is Microsoft's new take on the traditional IntelliSense auto-completion technology that has saved so many keystrokes for developers typing out list members, property/method calls, parameters and so on. IntelliCode uses artificial intelligence technology to prioritize the list of code-completion options available based on the project context, putting the most likely-to-be-used option at the top of the list.
"Pretty soon you're not going to have type at all," Soucoup said in introducing IntelliCode functionality that comes after last year's introduction of new Xamarin.Forms XAML IntelliSense in VS 2017. "IntelliCode is gonna actually bubble up to the top a thing that it's gonna think that you want next in your IntelliSense." An example is coding up a button, for which text is likely going to be entered, so IntelliCode puts the text property at the top of the suggestion list.
Montemagno also mentioned the ability to train IntelliCode "models" to further leverage the AI technology in IntelliCode. A December 2018 blog post about Visual Studio IntelliCode says, "With this latest update, you can easily train IntelliCode on your own codebase to provide contextual IntelliSense recommendations customized for you."
Android and iOS Designer Improvements
"The Android stuff now has some auto completion for constraint layouts, which is really nice if you're using Android XML for that," Montemagno said. "Lots of new IntelliSense features, pop-ups, going to definitions, quick navigating around, have been added into the Android XML, which is very nice. It's a different implementation from raw XAML so they did a lot of work on that just based on feedback.
"iOS designer had some little tweaks here and there to be able to load some dynamic libraries. Anytime there's a change to the Android designer or iOS designer a lot of the work of the rendering bubbles up to the previewer. We're still working hard ... we're still working really hard on stuff. Nothing landed really in preview 2 that we're ready to talk about yet but hopefully preview 3 will have some bigger changes."
D8 Dexer and R8 Shrinker
"D8 is the next-generation DEX (Dalvik-executable) compiler," Montemagno said. "DEX is what turns your code into like the runtime bits and pieces of it. And R8 is the shrinking and minification tools that comes kind of before D8. So you go R8 into D8, so that converts the Java byte code into optimized DEX code to get it ready for ProGuard." D8 is Google's improvement upon the existing DX compiler.
All of that is explained in more detail in last month's blog post by Jonathan Peppers, who explained that using Google's D8 compiler resulted in:
- About a 25 percent reduction in DEX compile times. Contributes to a 5-10 percent improvement in overall Xamarin.Android build times.
- About a 15 percent reduction in DEX file size. Contributes to 2-3 percent reduction in overall APK file size (DEX file are compressed).
Peppers predicted D8 will eventually become the default DEX compiler as Google is likely to sunset support for DX in the Android SDK.
Xamarin.Forms 4.0 Preview
"Another big thing that's great in the box of preview 2 is shipping with Forms 4.0 preview built right in," Soucoup said. "And so what comes with that, there's a brand-new template 4 shell. Now before when you built a shell app is that you actually had to go into the page that you wanted to add shell into it and go through all the typing, and as we discuss with the IntelliCode, who wants to type? So you can just do a file new and get a shell page in there, which is just nice."
Bindable Layouts in Xamarin.Forms
These are the creation of Andrei Nitescu, who in a blog post last month explained how the feature can bind a layout class to a collection of items, whose appearance can be set via a DataTemplate. "While the 'binding layout' name might suggest that it’s an addition to the base Layout view class, it actually works as an adaptor," Nitescu said. "It takes a source of data items and calls the Layout<T> view to create and update its child views based on the changes in the data item source."
Montemagno and Soucoup explained more. "So this actually is not preview, it's in Xamarin.Forms 3.5," Soucoup said. "It's called bindable layouts, and so what this does ... is something that's been asked for over and over again ... it makes your layout essentially like a ListView. And so let's say you had a bunch of labels and you wanted to add a label at run time, or bind it to some kind of, like in a data source essentially. You can do that now with the bindable layouts. So the bindable layouts is you have an item source, you're gonna have an item template, and there you just ... something comes into your item source, boom!"
Documentation for Using C++ Libraries in Xamarin.Forms
In discussing documentation for complex scenarios, Soucoup and Montemagno pointed out complete new documentation for such a scenario, specifically using C++ libraries in Xamarin development.
"So like why would you want to do this?" Montemagno asked. "Well you may be using some third-party libraries like AI machine learning stuff, a game engine, maybe you're building the Hyperlapse app and you have all this C++ code that's doing all this video processing, well you want to not rewrite any of that in C# so it may not be as performant as you're using C++ and you know what runs great everywhere? C++."
More on this topic can be found in a blog post titled "Using Existing C++ Libraries in Cross-Platform Xamarin.Forms Applications," authored earlier this month by Mike Parker. He said the article "walks through developing a C# wrapper for a given native library and an approach for keeping it decoupled from the mobile application(s) enabling greater re-use and segregation of development responsibilities."
Many more new developments in the mobile world were mentioned by the podcasters, along with a list of additional resources, all of which can be found in the February installment of the Visual Studio Mobile Developer podcast, titled "Releases and Previews and Roadmaps!"
About the Author
David Ramel is an editor and writer at Converge 360.