neo-6m uno_Uno-统治所有人的平台
neo-6m uno
First, we should start off with what Uno is and why you should care.
首先,我們應(yīng)該從Uno是什么以及為什么要關(guān)心開(kāi)始。
As stated on their website, Uno is "The only platform for building native mobile, desktop and WebAssembly apps with C#, XAML from a single codebase. Open source and professionally supported."
如其網(wǎng)站上所述 ,Uno是“唯一的平臺(tái),可通過(guò)單一代碼庫(kù)使用C#,XAML構(gòu)建本機(jī)移動(dòng),桌面和WebAssembly應(yīng)用程序。開(kāi)源且受到專(zhuān)業(yè)支持。”
這是什么意思? (What does this mean?)
Well if you have any experience (or not) building a mobile app and a subsequent web app, you have essentially had to build both separately, outside of potentially sharing data through an API.
好吧,如果您有(或沒(méi)有)構(gòu)建移動(dòng)應(yīng)用程序和后續(xù)Web應(yīng)用程序的經(jīng)驗(yàn),那么除了通過(guò)API可能共享數(shù)據(jù)之外,您實(shí)際上必須分別構(gòu)建兩者。
Before Xamarin, you would even have had to build the iOS and Android apps separately using different languages (Swift/Objective-C and Java/Kotlin respectively). Uno introduces a way to build for iOS, Android, Web, and UWP using shared logic and UI.
在使用Xamarin之前,您甚至不得不使用不同的語(yǔ)言(分別為Swift / Objective-C和Java / Kotlin)分別構(gòu)建iOS和Android應(yīng)用程序。 Uno引入了一種使用共享邏輯和UI為iOS,Android,Web和UWP進(jìn)行構(gòu)建的方法。
This is huge.
這是巨大的。
Sharing logic between platforms has been the "easy" part for developers. Sharing UI, however, is not. There is a huge difference in UI between Android and iOS and even larger differences between web and mobile. Xamarin.Forms allows us to share UI for Android and iOS but we were still on our own for the web.
平臺(tái)之間共享邏輯一直是開(kāi)發(fā)人員的“輕松”部分。 但是,不是共享UI。 Android和iOS之間的UI差異巨大,網(wǎng)絡(luò)和移動(dòng)設(shè)備之間的差異甚至更大。 Xamarin.Forms允許我們共享Android和iOS的UI,但在網(wǎng)絡(luò)上我們?nèi)匀豢孔约骸?
Uno enables you to write the UI once, then, using native controls, deploys native UI look and feel to each of your platforms. This means, you write the same code for a button regardless of the platform the button is for, and the user will see the native button for their platform.
Uno使您可以編寫(xiě)一次UI,然后使用本機(jī)控件將本機(jī)UI外觀部署到每個(gè)平臺(tái)。 這意味著,無(wú)論按鈕用于哪個(gè)平臺(tái),都為該按鈕編寫(xiě)相同的代碼,并且用戶將看到其平臺(tái)的本機(jī)按鈕。
它是如何工作的? (How does it work?)
The Uno Platform works differently depending on what you're building.
Uno平臺(tái)的工作方式取決于您所構(gòu)建的內(nèi)容。
The platform specific UI is created by taking the visual tree and rendering into what the platform supports:
通過(guò)將可視化樹(shù)并渲染為平臺(tái)支持的內(nèi)容來(lái)創(chuàng)建特定于平臺(tái)的UI:
iOS - UI Kit
iOS - UI套件
Android - ViewGroups and Views
Android的 - ViewGroups和視圖
Web - Native controls
網(wǎng)絡(luò) -本地控制
The logic is also deployed differently for each platform.
每個(gè)平臺(tái)的邏輯部署也不同。
When building a UWP app, Uno runs on top of, well, UWP and WinUI. When building Android and iOS apps, Uno runs on top of the Xamarin Native Stack. Finally, when you're building a Web App, Uno runs on top of WebAssembly. The mobile apps and web apps all run with Mono runtime. When it all comes together, it looks a little like this:
在構(gòu)建UWP應(yīng)用時(shí),Uno可以運(yùn)行在UWP和WinUI之上。 在構(gòu)建Android和iOS應(yīng)用程序時(shí),Uno在Xamarin本機(jī)堆棧的頂部運(yùn)行。 最后,當(dāng)您構(gòu)建Web應(yīng)用程序時(shí),Uno在WebAssembly之上運(yùn)行。 移動(dòng)應(yīng)用程序和Web應(yīng)用程序均與Mono運(yùn)行時(shí)一起運(yùn)行。 當(dāng)所有這些放在一起時(shí),看起來(lái)有點(diǎn)像這樣:
Well this looks nice, but what's really happening under the hood?
好吧,這看起來(lái)不錯(cuò),但是引擎蓋下到底發(fā)生了什么呢?
讓我們分解一下: (Let's break it down:)
Android and iOS
Android和iOS
This process is essentially the same as regular Xamarin. The big difference between Xamarin and Uno comes with the ability to run the same UI on the Web.
此過(guò)程與常規(guī)Xamarin基本相同。 Xamarin和Uno之間的最大區(qū)別在于可以在Web上運(yùn)行相同的UI。
Web Apps -
網(wǎng)絡(luò)應(yīng)用 -
You reuse both your logic and UI ?that you wrote for your mobile apps.
您可以重用為移動(dòng)應(yīng)用程序編寫(xiě)的邏輯和UI 。
Uno uses the Web Assembly Bootstrapper to take any .NET standard library and execute these files in the JavaScript console.
Uno使用Web Assembly Bootstrapper來(lái)獲取任何.NET標(biāo)準(zhǔn)庫(kù)并在JavaScript控制臺(tái)中執(zhí)行這些文件。
The ability for Uno to utilize Web Assembly (which is what allows you to write your code in C# and not JavaScript) is what makes Uno so unique.
Uno能夠利用Web Assembly(這是使您可以用C#而不是JavaScript編寫(xiě)代碼的能力)的能力使Uno如此獨(dú)特。
UWP -
UWP-
You reuse both your logic and UI ?that you wrote for your mobile apps and Web Assembly Apps.
您可以重用為移動(dòng)應(yīng)用程序和Web Assembly Apps編寫(xiě)的邏輯和UI 。
The big difference here is that UWP apps already have the Windows namespaces and do not need to reference the Uno.UI. The benefit Uno provides here is the ability to reuse the code you've already written for mobile and web.
這里的最大區(qū)別是UWP應(yīng)用程序已經(jīng)具有Windows名稱(chēng)空間,并且不需要引用Uno.UI。 Uno在此提供的好處是可以重用您已經(jīng)為移動(dòng)設(shè)備和Web編寫(xiě)的代碼。
Now that we have an idea of how this beauty works, let's write some code!
現(xiàn)在我們已經(jīng)了解了這種美的原理,讓我們編寫(xiě)一些代碼!
To get started with Uno, follow their instructions here.
要開(kāi)始使用Uno,請(qǐng)按照此處的說(shuō)明進(jìn)行操作。
When you create your Uno solution in Visual Studio, there is a similar feel to when you create a Xamarin.Forms solution because of the different projects created for you. Here is a look at the projects that are auto-created:
在Visual Studio中創(chuàng)建Uno解決方案時(shí),由于為您創(chuàng)建了不同的項(xiàng)目,因此與創(chuàng)建Xamarin.Forms解決方案時(shí)的感覺(jué)相似。 看一下自動(dòng)創(chuàng)建的項(xiàng)目:
As you would see in a Xamarin.Forms project, there are separate projects for each platform and a single shared project. The Droid, iOS, UWP, and Wasm projects are all the same as if you had created a blank app for each, the only difference being references to the Uno UI. The magic happens in the Shared project.
正如您在Xamarin.Forms項(xiàng)目中看到的那樣,每個(gè)平臺(tái)都有單獨(dú)的項(xiàng)目,而單個(gè)共享項(xiàng)目也有。 Droid,iOS,UWP和Wasm項(xiàng)目與您為每個(gè)項(xiàng)目創(chuàng)建一個(gè)空白應(yīng)用程序一樣,唯一的不同是對(duì)Uno UI的引用。 魔術(shù)發(fā)生在共享項(xiàng)目中。
Similar to the Shared project in Xamarin.Forms, this is where you will write all your shared logic and UI. Uno provides support for the MVVM, a design pattern many developers are familiar and comfortable with.
與Xamarin.Forms中的Shared項(xiàng)目相似,在這里您將編寫(xiě)所有共享的邏輯和UI。 Uno提供了對(duì)MVVM的支持, MVVM是許多開(kāi)發(fā)人員熟悉并熟悉的設(shè)計(jì)模式。
那么,成品看起來(lái)像什么? (So, what does a finished product look like?)
Using the example "Todo" app provided by Uno here, here are examples from each of the four platforms.
使用Uno 這里提供的示例“ Todo”應(yīng)用程序,這里是來(lái)自四個(gè)平臺(tái)的示例。
iOS
的iOS
Android
安卓系統(tǒng)
Web
網(wǎng)頁(yè)
UWP
超人
These projects all use logic and UI from the shared project. Code once, four apps.
這些項(xiàng)目都使用共享項(xiàng)目中的邏輯和UI。 編寫(xiě)一次,四個(gè)應(yīng)用程序。
讓我們談?wù)務(wù){(diào)試。 (Let's talk debugging. )
Debugging in Uno can be a bit different depending which platform you are trying to debug.
Uno中的調(diào)試可能會(huì)有所不同,具體取決于您要調(diào)試的平臺(tái)。
Android and iOS - For mobile, you will use the same Mono debugger you are used to using in Visual Studio, with access to all your favorite breakpoints, value changes, etc.
Android和iOS-對(duì)于移動(dòng)設(shè)備,您將使用與Visual Studio中相同的Mono調(diào)試器,并可以訪問(wèn)所有喜歡的斷點(diǎn),值更改等。
Web - Currently there is only support for chromium debugging, which means Chrome and Edge.
網(wǎng)絡(luò) -目前僅支持Chrome調(diào)試,即Chrome和Edge。
UWP - Here, the tooling comes from .NET studios which is not as efficient with the mono runtime.
UWP-在這里,該工具來(lái)自.NET Studio,這在Mono運(yùn)行時(shí)中效率不高。
Want to try out Uno but don't want to go through the steps to get set up through Visual Studio?
是否想嘗試Uno,但不想執(zhí)行通過(guò)Visual Studio進(jìn)行設(shè)置的步驟?
Then checkout their playground!
然后結(jié)帳他們的游樂(lè)場(chǎng) !
The Uno Playground is a fun and easy way to look at how different items render on different platforms. They make it quick and easy to try out new styles and is great for beginners and tutorials.
Uno Playground是一種有趣而簡(jiǎn)單的方法,可以查看不同項(xiàng)目在不同平臺(tái)上的呈現(xiàn)方式。 它們使您可以輕松快捷地嘗試新樣式,非常適合初學(xué)者和教程。
我們可以期待哪些未來(lái)功能? (What are future features we can look forward to?)
The true beauty of Uno is that it encompasses what we as developers should all be striving to accomplish - building on top of each others' accomplishments. We don't need to re-create the wheel, real innovation happens when you stand on the shoulders of giants and we all move upwards.
Uno的真正優(yōu)點(diǎn)在于它涵蓋了我們所有人作為開(kāi)發(fā)人員都應(yīng)努力實(shí)現(xiàn)的目標(biāo)-建立在彼此的成就之上。 我們不需要重新制造輪子,當(dāng)您站在巨人的肩膀上并且我們都向上移動(dòng)時(shí),真正的創(chuàng)新就會(huì)發(fā)生。
Happy coding.
快樂(lè)的編碼。
For more lessons and tips for Uno, checkout my blog.
有關(guān)Uno的更多課程和提示,請(qǐng)查看我的博客 。
翻譯自: https://www.freecodecamp.org/news/uno-platform/
neo-6m uno
總結(jié)
以上是生活随笔為你收集整理的neo-6m uno_Uno-统治所有人的平台的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 做梦梦到丧尸什么意思
- 下一篇: 做梦梦到别人怎么回事