简体   繁体   中英

What are diffs between iOS App (Xamarin) vs. iOS XAML App (Xamarin.Forms) vs. Cross-Platform

What is the difference between these Visual Studio 2017 new project options?
File > New > Project > Visual C# > …
OPTION 1. > Cross-Platform which supports iOS, Android, etc.
OPTION 2. > iOS Extensions
OPTION 3. > iPhone & iPad > iOS App (Xamarin)
OPTION 4. iOS XAML App (Xamarin.Forms)

I want to make an app on iPad that displays live images from a remote USB camera, via a socket. Later to also run on iPhone, Android, and Windows 10.

OPTION 1. > Cross-Platform which supports iOS, Android, etc.

Creates a cross platform Xamarin.Forms (XF) solution with projects to support iOS, Android, and UWP and a project to hold all of your shared code, which may be all code depending on your needs.

With XF all, or most, of your back end and front end code can go in one shared library project, which is also created when you create this template solution.

In the shared library project, you will have access to cross platform abstracted controls and views like Label, Button, Image, ListView, and most other standard user controls/views, as well as all APIs in .NET Standard 2.0 . These Xamarin.Forms controls/views will be rendered on each platform by platform specific renderers, ie a XF Button will render as a UIButton on iOS and an Android Button on Android, etc.

Depending on your needs, you still may need to add some platform specific code to your iOS, Android, or UWP projects, either to make your own custom renderers to render XF controls/views to native controls/views of your choosing or access control properties that are not available in the shared, abstracted XF control, or to run other platform specific code, like converting text to speech, which is different on each platform. Xamarin.Forms does provide methods to write platform specific code which can then be invoked from the shared code project, and also a way to make your own custom control/view renderers.

OPTION 2. > iOS Extensions

The are additions to an iOS app project. With these projects, you can create iOS extensions that can be used within iOS iMessage app or the iOS Share menu, for example.

OPTION 3. > iPhone & iPad > iOS App (Xamarin)

This is to develop an iOS only app project using Xamarin.iOS . Xamarin.iOS is a C# binding to the native iOS SDK, so anything that can be done with Obj-C or Swift in XCode can be done in C# using Xamarin.iOS.

OPTION 4. iOS XAML App (Xamarin.Forms)

This is the same as OPTION 1 above, but only the core shared project and the iOS project are created by default. You could later add an Android and UWP project, but if you do plan on supporting all three platforms in the future, you might as well use option one as a starting point.

Xamarin Forms is a write once deploy many option. You write your code and do your UI in Forms, and it will run on iOS, Android and Windows(ish)

iOS (Xamarin) is a native iOS app, but written using C# and Xamarin compiles to native iOS. If you wanted Android, you'd have to rewrite in Xamarin (Android).

There are a number of reasons to use one over the other, that is beyond the scope of SO, but there are a few good articles on the Xamarin site, and other places.

https://docs.microsoft.com/en-us/xamarin/xamarin-forms/get-started/introduction-to-xamarin-forms

https://arctouch.com/blog/xamarin-forms-xamarin-native/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM