0

I have been working on an app for a long time now with Xamarin Native for ios and android. Recently I have started making new views in forms and using them in the native app. This is a huge improvement for the development process and step in going all the way for forms eventually. I do have some issues, specially on android, the first time opening a forms view it takes a long time, the second time its like opening a normal native view. This is really annoying and doesn't give a good user experience.

I have tried this guide https://learn.microsoft.com/en-us/xamarin/xamarin-forms/platform/native-forms

I hope some of you can help or tell me this is a bad idea.

1 Answer 1

1

Firstly, Xamarin forms application load is slower than the Xamarin.Android application load. Because Xamarin.Forms provides not only the ability to share UI across targets, but common application features such as AppLinks for deep linking, Navigation, MessagingCenter, and DependencyService, as well as several pieces needed for cross-platform UI alerts, action sheets, toolbars, status bars, etc.

When you load the Forms views to the native project, the process is as follows:

  1. Add the Xamarin.Forms NuGet package to the native project.
  2. Add the ContentPage-derived page, and any dependencies, to the native project.
  3. Call the Forms.Init method.
  4. Construct an instance of the ContentPage-derived page and convert it to the appropriate native type using one of the following extension methods: CreateViewController for iOS, CreateSupportFragment for Android, or CreateFrameworkElement for UWP.
  5. Navigate to the native type representation of the ContentPage-derived page using the native navigation API.

It needs to do more than the navite views. You could try to load local content and reduce number of assemblies and so on. Here are several tips in the blog, you can take for reference. https://devblogs.microsoft.com/xamarin/5-ways-boost-xamarin-forms-app-sta

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for the reply. I am aware that it cannot be as fast as a "normal" view, but I don't understand that iOS is way faster loading forms views than android.
Xamarin.Android is only a layer of wrapper for Android native libraries, no extra operations. For the ios, they are use two different systems. You could turn to github.com/xamarin/Xamarin.Forms/issues for help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.